Fix winning condition for racing kings (close #9)
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 11 Oct 2018 22:11:25 +0000 (00:11 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Tue, 13 Nov 2018 21:44:22 +0000 (22:44 +0100)
Correctly evaluate positions where both kings are on the back rank.

racingkings STC
LLR: 2.95 (-2.94,2.94) [-10.00,5.00]
Total: 354 W: 144 L: 95 D: 115
http://35.161.250.236:6543/tests/view/5be9cb8e6e23db7639060c7d

racingkings LTC
LLR: 2.97 (-2.94,2.94) [-10.00,5.00]
Total: 273 W: 110 L: 62 D: 101
http://35.161.250.236:6543/tests/view/5bea06106e23db7639060c80

src/position.h

index a993671..2c621b5 100644 (file)
@@ -557,7 +557,8 @@ inline bool Position::is_variant_end(Value& result, int ply) const {
       && flag_move()
       && (capture_the_flag(sideToMove) & pieces(sideToMove, capture_the_flag_piece())))
   {
-      result = mate_in(ply);
+      result =  (capture_the_flag(~sideToMove) & pieces(~sideToMove, capture_the_flag_piece()))
+              && sideToMove == WHITE ? VALUE_DRAW : mate_in(ply);
       return true;
   }
   // nCheck