X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=a9aa514c97ab21caf63c0a9355643c0d136148a4;hp=17661c01e800a12b3ee61108173e8773be171477;hb=e8b7109efffd95c8f8f3c030d41952d103b3e0fc;hpb=dc7fd868f4fa41251a9521a0b25e3adb483bfd83 diff --git a/src/types.h b/src/types.h index 17661c01..a9aa514c 100644 --- a/src/types.h +++ b/src/types.h @@ -166,7 +166,18 @@ enum Value { VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + MAX_PLY, VALUE_ENSURE_INTEGER_SIZE_P = INT_MAX, - VALUE_ENSURE_INTEGER_SIZE_N = INT_MIN + VALUE_ENSURE_INTEGER_SIZE_N = INT_MIN, + + PawnValueMidgame = 198, + PawnValueEndgame = 258, + KnightValueMidgame = 817, + KnightValueEndgame = 846, + BishopValueMidgame = 836, + BishopValueEndgame = 857, + RookValueMidgame = 1270, + RookValueEndgame = 1278, + QueenValueMidgame = 2521, + QueenValueEndgame = 2558 }; enum PieceType { @@ -310,17 +321,6 @@ inline Score apply_weight(Score v, Score w) { #undef ENABLE_OPERATORS_ON #undef ENABLE_SAFE_OPERATORS_ON -const Value PawnValueMidgame = Value(198); -const Value PawnValueEndgame = Value(258); -const Value KnightValueMidgame = Value(817); -const Value KnightValueEndgame = Value(846); -const Value BishopValueMidgame = Value(836); -const Value BishopValueEndgame = Value(857); -const Value RookValueMidgame = Value(1270); -const Value RookValueEndgame = Value(1278); -const Value QueenValueMidgame = Value(2521); -const Value QueenValueEndgame = Value(2558); - extern const Value PieceValueMidgame[17]; // Indexed by Piece or PieceType extern const Value PieceValueEndgame[17]; extern int SquareDistance[64][64]; @@ -415,10 +415,6 @@ inline int square_distance(Square s1, Square s2) { return SquareDistance[s1][s2]; } -inline char piece_type_to_char(PieceType pt) { - return " PNBRQK"[pt]; -} - inline char file_to_char(File f) { return char(f - FILE_A + int('a')); } @@ -451,16 +447,9 @@ inline Move make_move(Square from, Square to) { return Move(to | (from << 6)); } -inline Move make_promotion(Square from, Square to, PieceType pt) { - return Move(to | (from << 6) | (1 << 14) | ((pt - 2) << 12)) ; -} - -inline Move make_enpassant(Square from, Square to) { - return Move(to | (from << 6) | (2 << 14)); -} - -inline Move make_castle(Square from, Square to) { - return Move(to | (from << 6) | (3 << 14)); +template +inline Move make(Square from, Square to, PieceType pt = KNIGHT) { + return Move(to | (from << 6) | T | ((pt - KNIGHT) << 12)) ; } inline bool is_ok(Move m) {