mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 01:27:16 +08:00
Fully correct stealmate detection
In the (rare) cases when the two conditions are true, then fully check again with a slow but correct MoveList<LEGAL>(pos).size(). This is able to detect false positives like this one: 8/8/8/Q7/5k1p/5P2/4KP2/8 b - - 0 17 When we have a possible simple pawn push that is not stored in attacks[] array. Because the third condition triggers very rarely, even if it is slow, it does not alters in a measurable way the average speed of the engine. bench: 8678654
This commit is contained in:
@@ -17,10 +17,10 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include "bitcount.h"
|
#include "bitcount.h"
|
||||||
#include "evaluate.h"
|
#include "evaluate.h"
|
||||||
@@ -790,7 +790,8 @@ namespace {
|
|||||||
// Stealmate detection
|
// Stealmate detection
|
||||||
Color stm = pos.side_to_move();
|
Color stm = pos.side_to_move();
|
||||||
if ( (ei.attackedBy[stm][ALL_PIECES] == ei.attackedBy[stm][KING])
|
if ( (ei.attackedBy[stm][ALL_PIECES] == ei.attackedBy[stm][KING])
|
||||||
&& (!(ei.attackedBy[stm][KING] & ~ei.attackedBy[~stm][ALL_PIECES])))
|
&& (!(ei.attackedBy[stm][KING] & ~ei.attackedBy[~stm][ALL_PIECES]))
|
||||||
|
&& !MoveList<LEGAL>(pos).size())
|
||||||
sf = SCALE_FACTOR_DRAW;
|
sf = SCALE_FACTOR_DRAW;
|
||||||
|
|
||||||
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
||||||
|
|||||||
Reference in New Issue
Block a user