/usr/include/osl/checkmate/oracleAdjust.h is in libosl-dev 0.8.0-1.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | /* oracleAdjust.h
*/
#ifndef _ORACLEADUST_H
#define _ORACLEADUST_H
#include "osl/numEffectState.h"
namespace osl
{
namespace checkmate
{
struct OracleAdjust
{
static const Move attack(const NumEffectState& state, Move check_move)
{
assert(check_move.isValid());
if (! check_move.isDrop())
{
// capture
{
const Piece p=state.pieceOnBoard(check_move.to());
if (p.isPtype<KING>())
return Move();
check_move=check_move.newCapture(p);
}
// from
if (state.pieceOnBoard(check_move.from()).ptype() != check_move.oldPtype()
&& Ptype_Table.hasLongMove(check_move.ptype())) {
Piece p;
switch (unpromote(check_move.ptype())) {
case ROOK:
{
mask_t m = state.allEffectAt<ROOK>(check_move.player(), check_move.to());
while (m.any()) {
const int num = m.takeOneBit()+PtypeFuns<ROOK>::indexNum*32;
p = state.pieceOf(num);
if (Board_Table.getShortOffsetNotKnight(Offset32(check_move.to(), check_move.from()))
== Board_Table.getShortOffsetNotKnight(Offset32(check_move.to(), p.square())))
break;
}
break;
}
case BISHOP:
{
mask_t m = state.allEffectAt<BISHOP>(check_move.player(), check_move.to());
while (m.any()) {
const int num = m.takeOneBit()+PtypeFuns<BISHOP>::indexNum*32;
p = state.pieceOf(num);
if (Board_Table.getShortOffsetNotKnight(Offset32(check_move.to(), check_move.from()))
== Board_Table.getShortOffsetNotKnight(Offset32(check_move.to(), p.square())))
break;
}
break;
}
case LANCE: p = state.findAttackAt<LANCE>(check_move.player(), check_move.to());
break;
default:
assert(0);
}
if (p.isPiece()) {
if (check_move.oldPtype() == p.ptype())
check_move=check_move.newFrom(p.square());
else if (check_move.ptype() == p.ptype())
check_move = Move(p.square(), check_move.to(), check_move.ptype(),
check_move.capturePtype(), false, check_move.player());
if (! state.isValidMoveByRule(check_move, false))
return Move();
}
}
}
if (! state.isAlmostValidMove<false>(check_move))
return Move();
return check_move;
}
};
}
}
#endif /* _ORACLEADUST_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|