From: Joona Kiiski Date: Sat, 23 Jul 2011 21:18:28 +0000 (+0100) Subject: Do not exit early even when seeing mate X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=a6fc3d6ee501911375b29ebdb09638eb6789d091 Do not exit early even when seeing mate Fixes the reported KNNK ending problem: http://talkchess.com/forum/viewtopic.php?t=39347 Joona says: Now I finally had a time to take a look at on this issue. I've reproduced the problem starting from this position: 1B6/1B2k3/P7/1P3p2/1K6/8/4b3/4b3 w - - 6 85 I made Stockfish play as white and Fruit as black. I repeated test ten times and once SF was not able to deliver mate. But I observed several times that SF had reported on last something like mate in 10. However next time it played move with score mate in 15. Easiest way to solve the problem is attached as a patch. I tested it several times and SF always ended up playing the optimal move. Of course the downside is that now delivering mate takes a bit longer, but IMO it's better to lose once in a while by time in sudden death game than not being able to deliver simple mate with long time controls. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index 94b34389..aec64345 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -633,12 +633,6 @@ namespace { // Check for some early stop condition if (!StopRequest && Limits.useTimeManagement()) { - // Stop search early when the last two iterations returned a mate score - if ( depth >= 5 - && abs(bestValues[depth]) >= VALUE_MATE_IN_PLY_MAX - && abs(bestValues[depth - 1]) >= VALUE_MATE_IN_PLY_MAX) - StopRequest = true; - // Stop search early if one move seems to be much better than the // others or if there is only a single legal move. Also in the latter // case we search up to some depth anyway to get a proper score.