X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=ea52fe6cb5216c5c85cc5a6910b86e0ef3662812;hp=f041e29db5102c7defa5ad8a250d20b2309d76c4;hb=fcf2a34080404b90cac46184d76e8f2cdda16bd2;hpb=708cb311a040ca8c676524025c9d72ed4c632267 diff --git a/src/types.h b/src/types.h index f041e29d..ea52fe6c 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,6 +349,10 @@ 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); }