mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 08:37:44 +00:00
Fixed a bug that the training data generation crashes if eval_limit is high.
This commit is contained in:
@@ -634,11 +634,19 @@ void MultiThinkGenSfen::thread_worker(size_t thread_id)
|
|||||||
// reach leaf
|
// reach leaf
|
||||||
// cout << pos;
|
// cout << pos;
|
||||||
|
|
||||||
auto v = Eval::evaluate(pos);
|
Value v;
|
||||||
|
if (pos.checkers()) {
|
||||||
|
// HACK: If a king is checkmated, Eval::evalute(pos) crashes with an
|
||||||
|
// assertion. To avoid crashes, return value1 instead.
|
||||||
|
v = value1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
v = Eval::evaluate(pos);
|
||||||
// evaluate() returns the evaluation value on the turn side, so
|
// 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 it's a turn different from root_color, you must invert v and return it.
|
||||||
if (rootColor != pos.side_to_move())
|
if (rootColor != pos.side_to_move())
|
||||||
v = -v;
|
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