From d3d6b09ff34968260cc24281640d33cae4148f36 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Wed, 10 Feb 2021 22:37:29 +0800 Subject: [PATCH] Fix ResignIfMostLose cannot work --- src/position.cpp | 2 +- src/thread.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index b1c5d36a..31a45185 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -891,7 +891,7 @@ bool Position::resign(Color loser) set_gameover(~loser, GameOverReason::loseReasonResign); - //snprintf(record, RECORD_LEN_MAX, loseReasonResignStr, loser); + snprintf(record, RECORD_LEN_MAX, loseReasonResignStr, loser); return true; } diff --git a/src/thread.cpp b/src/thread.cpp index 93ab996a..80968563 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -26,6 +26,7 @@ #include "uci.h" #include "tt.h" #include "option.h" +#include "mills.h" #ifdef PERFECT_AI_SUPPORT #include "perfect/perfect.h" @@ -578,18 +579,16 @@ string Thread::nextMove() } #endif /* ENDGAME_LEARNING */ +#endif + if (gameOptions.getResignIfMostLose() == true) { - if (root->value <= -VALUE_MATE) { - gameOverReason = loseReasonResign; - //snprintf(record, Position::RECORD_LEN_MAX, loseReasonResignStr, position->sideToMove); - return record; + if (bestvalue <= -VALUE_MATE) { + rootPos->set_gameover(~rootPos->sideToMove, GameOverReason::loseReasonResign); + snprintf(rootPos->record, Position::RECORD_LEN_MAX, loseReasonResignStr, rootPos->sideToMove); + return rootPos->record; } } - nodeCount = 0; - -#endif - #ifdef TRANSPOSITION_TABLE_ENABLE #ifdef TRANSPOSITION_TABLE_DEBUG size_t hashProbeCount = ttHitCount + ttMissCount;