mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 10:57:43 +00: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:
+15
-7
@@ -639,13 +639,21 @@ void MultiThinkGenSfen::thread_worker(size_t thread_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reach leaf
|
// reach leaf
|
||||||
// cout << pos;
|
Value v;
|
||||||
|
if (pos.checkers()) {
|
||||||
auto v = Eval::evaluate(pos);
|
// Sometime a king is checked. An example is a case that a checkmate is
|
||||||
// evaluate() returns the evaluation value on the turn side, so
|
// found in the search. If Eval::evaluate() is called whne a king is
|
||||||
// If it's a turn different from root_color, you must invert v and return it.
|
// checked, classic eval crashes by an assertion. To avoid crashes, return
|
||||||
if (rootColor != pos.side_to_move())
|
// value1 instead of the score of the PV leaf.
|
||||||
v = -v;
|
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.
|
// Rewind.
|
||||||
// Is it C++x14, and isn't there even foreach to turn in reverse?
|
// Is it C++x14, and isn't there even foreach to turn in reverse?
|
||||||
|
|||||||
Reference in New Issue
Block a user