mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Add functions to check for decisive scores
Thanks to peregrineshahin and robbyrobbyrob for their suggestions. closes https://github.com/official-stockfish/Stockfish/pull/5696 No functional change
This commit is contained in:
+15
@@ -155,6 +155,21 @@ constexpr Value VALUE_TB = VALUE_MATE_IN_MAX_PLY - 1;
|
||||
constexpr Value VALUE_TB_WIN_IN_MAX_PLY = VALUE_TB - MAX_PLY;
|
||||
constexpr Value VALUE_TB_LOSS_IN_MAX_PLY = -VALUE_TB_WIN_IN_MAX_PLY;
|
||||
|
||||
|
||||
constexpr bool is_valid(Value value) { return value != VALUE_NONE; }
|
||||
|
||||
constexpr bool is_win(Value value) {
|
||||
assert(is_valid(value));
|
||||
return value >= VALUE_TB_WIN_IN_MAX_PLY;
|
||||
}
|
||||
|
||||
constexpr bool is_loss(Value value) {
|
||||
assert(is_valid(value));
|
||||
return value <= VALUE_TB_LOSS_IN_MAX_PLY;
|
||||
}
|
||||
|
||||
constexpr bool is_decisive(Value value) { return is_win(value) || is_loss(value); }
|
||||
|
||||
// In the code, we make the assumption that these values
|
||||
// are such that non_pawn_material() can be used to uniquely
|
||||
// identify the material on the board.
|
||||
|
||||
Reference in New Issue
Block a user