Fix bogus mate scores in some positions
authorJoona Kiiski <joona.kiiski@gmail.com>
Fri, 22 Mar 2013 07:54:03 +0000 (08:54 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 23 Mar 2013 20:28:51 +0000 (21:28 +0100)
Always before pruning the move, it's important to check that:

bestValue > VALUE_MATED_IN_MAX_PLY

See example position:

8/2p1p3/P1NpP3/3k4/1P1BN3/2P1P3/2Q5/6K1 w - - 0 1
http://support.stockfishchess.org/discussions/problems/268-wrong-declaring-a-forced-mate-in-3-moves

This problem was present in 2.3.1, then it was fixed by my patch.

After 24000 games at 15+0.05
ELO: 2.40 +-4.4 (95%) LOS: 95.7%
Total: 24000 W: 4774 L: 4608 D: 14618

bench: 4465997

src/search.cpp

index 7a06dad93f94035b046c9384938ce6d8d0b983b1..6dcd9f1db794f56f1ab5214e21fcab7587d2b3b0 100644 (file)
@@ -856,7 +856,8 @@ split_point_start: // At split points actual search starts from here
           && !captureOrPromotion
           && !inCheck
           && !dangerous
-          &&  move != ttMove)
+          &&  move != ttMove
+          &&  bestValue > VALUE_MATED_IN_MAX_PLY)
       {
           // Move count based pruning
           if (   depth < 16 * ONE_PLY