adjusted mate score and clamping eval | bench 3024652

This commit is contained in:
rektdie committed 2025-04-09 00:33:01 +02:00
1 parent 0df4b40efb
commit 44843fa6a8
3 files changed
+5 -4

No files matched your search

+2 -1
View File
@@ -76,7 +76,8 @@ static int32_t Forward(const Board& board,
} }
int16_t Network::Evaluate(const Board& board) { int16_t Network::Evaluate(const Board& board) {
return Forward(board, this); return std::clamp(Forward(board, this), (-SEARCH::MATE_SCORE + SEARCH::MAX_PLY),
(SEARCH::MATE_SCORE - SEARCH::MAX_PLY));
} }
} }
+2 -2
View File
@@ -288,7 +288,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
// that a quiet move will help us so we skip them // that a quiet move will help us so we skip them
int fpMargin = 100 * depth; int fpMargin = 100 * depth;
if (!isPV && ply && currMove.IsQuiet() if (!isPV && ply && currMove.IsQuiet()
&& depth <= 5 && staticEval + fpMargin < alpha && results.score > MATE_SCORE) { && depth <= 5 && staticEval + fpMargin < alpha && results.score > -MATE_SCORE) {
continue; continue;
} }
@@ -364,7 +364,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
if (moveSeen == 0) { if (moveSeen == 0) {
if (board.InCheck()) { // checkmate if (board.InCheck()) { // checkmate
return MATE_SCORE + ply; return -MATE_SCORE + ply;
} else { // stalemate } else { // stalemate
return 0; return 0;
} }
+1 -1
View File
@@ -14,7 +14,7 @@ enum searchMode {
nodesMode nodesMode
}; };
constexpr int MATE_SCORE = -99000; constexpr int MATE_SCORE = 32767;
constexpr int MAX_DEPTH = 64; constexpr int MAX_DEPTH = 64;
constexpr int MAX_PLY = 128; constexpr int MAX_PLY = 128;
constexpr int MAX_HISTORY = 16384; constexpr int MAX_HISTORY = 16384;