From 3b41c7765be31ae3e200cb8b1cd9b89041f31912 Mon Sep 17 00:00:00 2001 From: rektdie Date: Wed, 16 Oct 2024 00:21:48 +0200 Subject: [PATCH] bugfix: didnt play move in enemy's mate in one --- source/search.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index e03512c..a30b4a3 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -136,8 +136,6 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) { GenerateMoves(board, board.sideToMove); SortMoves(board); - if (board.InCheck(board.sideToMove)) depth++; - if (board.currentMoveIndex == 0) { if (board.InCheck(board.sideToMove)) { // checkmate return -49000 + ply; @@ -183,6 +181,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) { } } + results.score = alpha; return results; } @@ -195,6 +194,8 @@ static SearchResults ID(Board &board, SearchParams params) { int inc = board.sideToMove ? params.binc : params.winc; SearchResults safeResults; + safeResults.score = -50000; + for (int depth = 1; depth <= 99; depth++) { int timeRemaining = (fullTime / 20) + (inc / 2); timeToSearch = timeRemaining;