mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 19:16:49 +08:00
Chagned to use the search value instead of the value of the PV leaf to avoid crash by assertion.
This commit is contained in:
@@ -639,13 +639,21 @@ void MultiThinkGenSfen::thread_worker(size_t thread_id)
|
||||
}
|
||||
|
||||
// reach leaf
|
||||
// cout << pos;
|
||||
|
||||
auto v = Eval::evaluate(pos);
|
||||
// evaluate() returns the evaluation value on the turn side, so
|
||||
// If it's a turn different from root_color, you must invert v and return it.
|
||||
if (rootColor != pos.side_to_move())
|
||||
v = -v;
|
||||
Value v;
|
||||
if (pos.checkers()) {
|
||||
// Sometime a king is checked. An example is a case that a checkmate is
|
||||
// found in the search. If Eval::evaluate() is called whne a king is
|
||||
// checked, classic eval crashes by an assertion. To avoid crashes, return
|
||||
// value1 instead of the score of the PV leaf.
|
||||
v = value1;
|
||||
}
|
||||
else {
|
||||
v = Eval::evaluate(pos);
|
||||
// evaluate() returns the evaluation value on the turn side, so
|
||||
// If it's a turn different from root_color, you must invert v and return it.
|
||||
if (rootColor != pos.side_to_move())
|
||||
v = -v;
|
||||
}
|
||||
|
||||
// Rewind.
|
||||
// Is it C++x14, and isn't there even foreach to turn in reverse?
|
||||
|
||||
Reference in New Issue
Block a user