mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 13:17:44 +00:00
Fixes a Chess960 bug when playing with more than one search thread.
The init_eval() function corrupted the static array castleRightsMask[] in the Position class, resulting in instant crashes in most Chess960 games. Fixed by repairing the damage directly after the function is called. Also modified the Position::to_fen() function to display castle rights correctly for Chess960 positions, and added sanity checks for uncastled rook files in Position::is_ok().
This commit is contained in:
@@ -442,6 +442,10 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
|
||||
{
|
||||
ActiveThreads = newActiveThreads;
|
||||
init_eval(ActiveThreads);
|
||||
// HACK: init_eval() destroys the static castleRightsMask[] array in the
|
||||
// Position class. The below line repairs the damage.
|
||||
Position p(pos.to_fen());
|
||||
assert(pos.is_ok());
|
||||
}
|
||||
|
||||
// Wake up sleeping threads
|
||||
|
||||
Reference in New Issue
Block a user