To be aligned with PolyGlot book castle right definitions.
This will be used by next patch.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
}
inline int Position::can_castle(Color c) const {
}
inline int Position::can_castle(Color c) const {
- return st->castleRights & ((WHITE_OO | WHITE_OOO) << c);
+ return st->castleRights & ((WHITE_OO | WHITE_OOO) << (2 * c));
}
inline bool Position::castle_impeded(Color c, CastlingSide s) const {
}
inline bool Position::castle_impeded(Color c, CastlingSide s) const {
return f.score < s.score;
}
return f.score < s.score;
}
+enum CastleRight { // Defined as in PolyGlot book hash key
CASTLES_NONE = 0,
WHITE_OO = 1,
CASTLES_NONE = 0,
WHITE_OO = 1,
- BLACK_OO = 2,
- WHITE_OOO = 4,
+ WHITE_OOO = 2,
+ BLACK_OO = 4,
BLACK_OOO = 8,
ALL_CASTLES = 15
};
BLACK_OOO = 8,
ALL_CASTLES = 15
};
}
inline CastleRight make_castle_right(Color c, CastlingSide s) {
}
inline CastleRight make_castle_right(Color c, CastlingSide s) {
- return CastleRight((s == KING_SIDE ? WHITE_OO : WHITE_OOO) << c);
+ return CastleRight(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c));
}
inline PieceType type_of(Piece p) {
}
inline PieceType type_of(Piece p) {