X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=7ebe3f61f8580b0b241a9c0580b8f83768a57fc0;hp=f041e29db5102c7defa5ad8a250d20b2309d76c4;hb=2bfe61c33b99bd5ebb2e4616a6e8ac5790ff4c4f;hpb=708cb311a040ca8c676524025c9d72ed4c632267 diff --git a/src/types.h b/src/types.h index f041e29d..7ebe3f61 100644 --- a/src/types.h +++ b/src/types.h @@ -124,20 +124,20 @@ enum CastlingSide { KING_SIDE, QUEEN_SIDE, CASTLING_SIDE_NB = 2 }; -enum CastlingFlag { // Defined as in PolyGlot book hash key +enum CastlingRight { // Defined as in PolyGlot book hash key NO_CASTLING, WHITE_OO, WHITE_OOO = WHITE_OO << 1, BLACK_OO = WHITE_OO << 2, BLACK_OOO = WHITE_OO << 3, ANY_CASTLING = WHITE_OO | WHITE_OOO | BLACK_OO | BLACK_OOO, - CASTLING_FLAG_NB = 16 + CASTLING_RIGHT_NB = 16 }; template struct MakeCastling { - static const CastlingFlag - flag = C == WHITE ? S == QUEEN_SIDE ? WHITE_OOO : WHITE_OO - : S == QUEEN_SIDE ? BLACK_OOO : BLACK_OO; + static const CastlingRight + right = C == WHITE ? S == QUEEN_SIDE ? WHITE_OOO : WHITE_OO + : S == QUEEN_SIDE ? BLACK_OOO : BLACK_OO; }; enum Phase { @@ -165,9 +165,9 @@ enum Value { VALUE_ZERO = 0, VALUE_DRAW = 0, VALUE_KNOWN_WIN = 10000, - VALUE_MATE = 30000, - VALUE_INFINITE = 30001, - VALUE_NONE = 30002, + VALUE_MATE = 32000, + VALUE_INFINITE = 32001, + VALUE_NONE = 32002, VALUE_MATE_IN_MAX_PLY = VALUE_MATE - MAX_PLY, VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + MAX_PLY, @@ -322,11 +322,11 @@ extern Value PieceValue[PHASE_NB][PIECE_NB]; struct ExtMove { Move move; - int score; + Value value; }; inline bool operator<(const ExtMove& f, const ExtMove& s) { - return f.score < s.score; + return f.value < s.value; } inline Color operator~(Color c) { @@ -337,12 +337,8 @@ inline Square operator~(Square s) { return Square(s ^ SQ_A8); // Vertical flip SQ_A1 -> SQ_A8 } -inline Square operator|(File f, Rank r) { - return Square((r << 3) | f); -} - -inline CastlingFlag operator|(Color c, CastlingSide s) { - return CastlingFlag(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c)); +inline CastlingRight operator|(Color c, CastlingSide s) { + return CastlingRight(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c)); } inline Value mate_in(int ply) { @@ -353,17 +349,21 @@ inline Value mated_in(int ply) { return -VALUE_MATE + ply; } +inline Square make_square(File f, Rank r) { + return Square((r << 3) | f); +} + inline Piece make_piece(Color c, PieceType pt) { return Piece((c << 3) | pt); } -inline PieceType type_of(Piece p) { - return PieceType(p & 7); +inline PieceType type_of(Piece pc) { + return PieceType(pc & 7); } -inline Color color_of(Piece p) { - assert(p != NO_PIECE); - return Color(p >> 3); +inline Color color_of(Piece pc) { + assert(pc != NO_PIECE); + return Color(pc >> 3); } inline bool is_ok(Square s) {