From a9df71207dad096f1e209c7241db90dfd51692d0 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Fri, 11 Dec 2020 21:59:04 +0100 Subject: [PATCH] Cache TsumeMode option Speed-up for horde chess. horde STC LLR: 2.96 (-2.94,2.94) [0.00,10.00] Total: 1761 W: 935 L: 808 D: 18 http://www.variantfishtest.org:6543/tests/view/5fd3c1ac6e23db221d9e94f7 --- src/position.cpp | 3 ++- src/position.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 13b9ac1..6f1a4f9 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -457,6 +457,7 @@ Position& Position::set(const Variant* v, const string& fenStr, bool isChess960, } chess960 = isChess960 || v->chess960; + tsumeMode = Options["TsumeMode"]; thisThread = th; set_state(st); st->accumulator.state[WHITE] = Eval::NNUE::INIT; @@ -2170,7 +2171,7 @@ bool Position::is_immediate_game_end(Value& result, int ply) const { return true; } // Tsume mode: Assume that side with king wins when not in check - if (!count(~sideToMove) && count(sideToMove) && !checkers() && Options["TsumeMode"]) + if (tsumeMode && !count(~sideToMove) && count(sideToMove) && !checkers()) { result = mate_in(ply); return true; diff --git a/src/position.h b/src/position.h index e57c31c..185efc4 100644 --- a/src/position.h +++ b/src/position.h @@ -320,6 +320,7 @@ private: // variant-specific const Variant* var; + bool tsumeMode; bool chess960; int pieceCountInHand[COLOR_NB][PIECE_TYPE_NB]; Bitboard promotedPieces; -- 1.7.0.4