mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Fix a crash when reaching PLY_MAX in a check position
In this case we call evaluate() being in check and this is not allowed. Bug found testing with reduced PLY_MAX value as suggested by Miguel A. Ballicora on talkchess. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -1048,7 +1048,7 @@ namespace {
|
||||
EvalInfo ei;
|
||||
|
||||
if (ply >= PLY_MAX - 1)
|
||||
return evaluate(pos, ei, threadID);
|
||||
return pos.is_check() ? quick_evaluate(pos) : evaluate(pos, ei, threadID);
|
||||
|
||||
// Mate distance pruning
|
||||
Value oldAlpha = alpha;
|
||||
@@ -1238,7 +1238,7 @@ namespace {
|
||||
EvalInfo ei;
|
||||
|
||||
if (ply >= PLY_MAX - 1)
|
||||
return evaluate(pos, ei, threadID);
|
||||
return pos.is_check() ? quick_evaluate(pos) : evaluate(pos, ei, threadID);
|
||||
|
||||
// Mate distance pruning
|
||||
if (value_mated_in(ply) >= beta)
|
||||
@@ -1529,8 +1529,8 @@ namespace {
|
||||
else
|
||||
staticValue = evaluate(pos, ei, threadID);
|
||||
|
||||
if (ply == PLY_MAX - 1)
|
||||
return evaluate(pos, ei, threadID);
|
||||
if (ply >= PLY_MAX - 1)
|
||||
return pos.is_check() ? quick_evaluate(pos) : evaluate(pos, ei, threadID);
|
||||
|
||||
// Initialize "stand pat score", and return it immediately if it is
|
||||
// at least beta.
|
||||
|
||||
Reference in New Issue
Block a user