ordering TT moves first

This commit is contained in:
rektdie committed 2025-03-02 05:04:56 +01:00
1 parent 272fa9a04c
commit 17a0d70db0
3 files changed
+12 -5

No files matched your search

+7 -2
View File
@@ -18,6 +18,11 @@ static int ScoreMove(Board &board, Move &move) {
const int attackerType = board.GetPieceType(move.MoveFrom());
const int targetType = board.GetPieceType(move.MoveTo());
TTEntry *current = &TTable[board.hashKey % hashSize];
if (current->bestMove == move) {
return 50000;
}
if (move.IsCapture()) {
return moveScoreTable[attackerType][targetType] + 10000;
}
@@ -182,7 +187,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
}
if (score >= beta) {
WriteEntry(board.hashKey, depth, beta, CutNode);
WriteEntry(board.hashKey, depth, beta, CutNode, Move());
return beta;
}
@@ -195,7 +200,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
results.score = alpha;
WriteEntry(board.hashKey, depth, results.score, nodeType);
WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove);
return results;
}