X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Ftypes.h;h=863e0df2f771be35033dd9e22debaa7d524f4203;hb=25b4d0c127af9fe564f7a797460bed4c2837bcc2;hp=345751455dbf54d853a88dd874eea367ecd58e35;hpb=89ec224cb92f49a6edc3d8b03a43d1c4418c285a;p=stockfish diff --git a/src/types.h b/src/types.h index 34575145..863e0df2 100644 --- a/src/types.h +++ b/src/types.h @@ -201,9 +201,10 @@ enum Depth { ONE_PLY = 2, - DEPTH_ZERO = 0 * ONE_PLY, - DEPTH_QS_CHECKS = -1 * ONE_PLY, - DEPTH_QS_NO_CHECKS = -2 * ONE_PLY, + DEPTH_ZERO = 0 * ONE_PLY, + DEPTH_QS_CHECKS = -1 * ONE_PLY, + DEPTH_QS_NO_CHECKS = -2 * ONE_PLY, + DEPTH_QS_RECAPTURES = -4 * ONE_PLY, DEPTH_NONE = -127 * ONE_PLY }; @@ -251,6 +252,15 @@ enum ScaleFactor { SCALE_FACTOR_NONE = 255 }; +enum CastleRight { + CASTLES_NONE = 0, + WHITE_OO = 1, + BLACK_OO = 2, + WHITE_OOO = 4, + BLACK_OOO = 8, + ALL_CASTLES = 15 +}; + /// Score enum keeps a midgame and an endgame value in a single /// integer (enum), first LSB 16 bits are used to store endgame @@ -336,6 +346,18 @@ const Value RookValueEndgame = Value(0x4FE); const Value QueenValueMidgame = Value(0x9D9); const Value QueenValueEndgame = Value(0x9FE); +extern const Value PieceValueMidgame[17]; +extern const Value PieceValueEndgame[17]; +extern int SquareDistance[64][64]; + +inline Value piece_value_midgame(Piece p) { + return PieceValueMidgame[p]; +} + +inline Value piece_value_endgame(Piece p) { + return PieceValueEndgame[p]; +} + inline Value value_mate_in(int ply) { return VALUE_MATE - ply; } @@ -348,11 +370,11 @@ inline Piece make_piece(Color c, PieceType pt) { return Piece((c << 3) | pt); } -inline PieceType type_of_piece(Piece p) { +inline PieceType piece_type(Piece p) { return PieceType(p & 7); } -inline Color color_of_piece(Piece p) { +inline Color piece_color(Piece p) { return Color(p >> 3); } @@ -419,7 +441,7 @@ inline int rank_distance(Square s1, Square s2) { } inline int square_distance(Square s1, Square s2) { - return Max(file_distance(s1, s2), rank_distance(s1, s2)); + return SquareDistance[s1][s2]; } inline char file_to_char(File f) {