added history moves | bench 1146300

This commit is contained in:
rektdie committed 2025-03-14 15:48:58 +01:00
1 parent 0f412f1081
commit fafa122123
1 file changed
+12 -4
+12 -4
View File
@@ -14,6 +14,8 @@ static inline bool doingNullMove = false;
// [id][ply] // [id][ply]
static inline int killerMoves[2][64]; static inline int killerMoves[2][64];
// [stm][from][to]
static inline int historyMoves[2][64][64];
inline PVLine pvLine; inline PVLine pvLine;
@@ -37,10 +39,10 @@ static int ScoreMove(Board &board, Move &move) {
} else { } else {
if (killerMoves[0][ply] == move) { if (killerMoves[0][ply] == move) {
return 9000; return 9000;
} } else if (killerMoves[1][ply] == move) {
if (killerMoves[1][ply] == move) {
return 8000; return 8000;
} else {
return historyMoves[board.sideToMove][move.MoveFrom()][move.MoveTo()];
} }
} }
@@ -228,8 +230,14 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
// Fail high (beta cutoff) // Fail high (beta cutoff)
if (score >= beta) { if (score >= beta) {
Move currMove = board.moveList[i];
if (!currMove.IsCapture()) {
killerMoves[1][ply] = killerMoves[0][ply]; killerMoves[1][ply] = killerMoves[0][ply];
killerMoves[0][ply] = board.moveList[i]; killerMoves[0][ply] = currMove;
historyMoves[board.sideToMove][currMove.MoveFrom()][currMove.MoveTo()] += depth * depth;
}
TT.WriteEntry(board.hashKey, depth, score, CutNode, Move()); TT.WriteEntry(board.hashKey, depth, score, CutNode, Move());
return score; return score;