Tweak SEE for nCheck and extinction variants
authorianfab <ianfab@users.noreply.github.com>
Sat, 28 Jul 2018 15:22:39 +0000 (17:22 +0200)
committerianfab <ianfab@users.noreply.github.com>
Mon, 30 Jul 2018 17:31:51 +0000 (19:31 +0200)
3check STC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 131 W: 115 L: 14 D: 2

extinction STC
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 92 W: 90 L: 1 D: 1

src/position.cpp

index 098a681..e4044d6 100644 (file)
@@ -1306,6 +1306,20 @@ bool Position::see_ge(Move m, Value threshold) const {
   Color stm = ~us; // First consider opponent's move
   Value balance;   // Values of the pieces taken by us minus opponent's ones
 
+
+  // nCheck
+  if (max_check_count() && color_of(moved_piece(m)) == sideToMove && gives_check(m))
+      return true;
+
+  // Extinction
+  if (   extinction_value() != VALUE_NONE
+      && piece_on(to)
+      && (   (   extinction_piece_types().find(type_of(piece_on(to))) != extinction_piece_types().end()
+              && pieceCount[piece_on(to)] == 1)
+          || (   extinction_piece_types().find(ALL_PIECES) != extinction_piece_types().end()
+              && count<ALL_PIECES>(~sideToMove) == 1)))
+      return extinction_value() < VALUE_ZERO;
+
   // The opponent may be able to recapture so this is the best result
   // we can hope for.
   balance = PieceValue[MG][piece_on(to)] - threshold;