Cache TsumeMode option
authorFabian Fichter <ianfab@users.noreply.github.com>
Fri, 11 Dec 2020 20:59:04 +0000 (21:59 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Fri, 11 Dec 2020 20:59:04 +0000 (21:59 +0100)
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
src/position.h

index 13b9ac1..6f1a4f9 100644 (file)
@@ -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<KING>(~sideToMove) && count<KING>(sideToMove) && !checkers() && Options["TsumeMode"])
+  if (tsumeMode && !count<KING>(~sideToMove) && count<KING>(sideToMove) && !checkers())
   {
       result = mate_in(ply);
       return true;
index e57c31c..185efc4 100644 (file)
@@ -320,6 +320,7 @@ private:
 
   // variant-specific
   const Variant* var;
+  bool tsumeMode;
   bool chess960;
   int pieceCountInHand[COLOR_NB][PIECE_TYPE_NB];
   Bitboard promotedPieces;