1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Copy killers in the movepicker

ss->killers can change while the movepicker is active.
The reason ss->killers changes is related to the singular
extension search in the moves loop that calls search<>
recursively with ss instead of ss+1,
effectively using the same stack entry for caller and callee.
By making a copy of the killers,
the movepicker does the right thing nevertheless.

Tested as a bug fix

STC:
http://tests.stockfishchess.org/tests/view/58ff130f0ebc59035df33f37
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 70845 W: 12752 L: 12716 D: 45377

LTC:
http://tests.stockfishchess.org/tests/view/58ff48000ebc59035df33f3d
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 28368 W: 3730 L: 3619 D: 21019

Bench: 6465887

Closes #1085
This commit is contained in:
Joost VandeVondele 2017-04-28 20:27:39 -07:00 committed by Joona Kiiski
parent 49a9d4cf99
commit b1b19343cd
2 changed files with 9 additions and 6 deletions

View file

@ -76,6 +76,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, Search::Stack* s)
Square prevSq = to_sq((ss-1)->currentMove);
countermove = pos.this_thread()->counterMoves[pos.piece_on(prevSq)][prevSq];
killers[0] = ss->killers[0];
killers[1] = ss->killers[1];
stage = pos.checkers() ? EVASION : MAIN_SEARCH;
ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
@ -210,7 +212,7 @@ Move MovePicker::next_move(bool skipQuiets) {
}
++stage;
move = ss->killers[0]; // First killer move
move = killers[0]; // First killer move
if ( move != MOVE_NONE
&& move != ttMove
&& pos.pseudo_legal(move)
@ -219,7 +221,7 @@ Move MovePicker::next_move(bool skipQuiets) {
case KILLERS:
++stage;
move = ss->killers[1]; // Second killer move
move = killers[1]; // Second killer move
if ( move != MOVE_NONE
&& move != ttMove
&& pos.pseudo_legal(move)
@ -231,8 +233,8 @@ Move MovePicker::next_move(bool skipQuiets) {
move = countermove;
if ( move != MOVE_NONE
&& move != ttMove
&& move != ss->killers[0]
&& move != ss->killers[1]
&& move != killers[0]
&& move != killers[1]
&& pos.pseudo_legal(move)
&& !pos.capture(move))
return move;
@ -251,8 +253,8 @@ Move MovePicker::next_move(bool skipQuiets) {
move = *cur++;
if ( move != ttMove
&& move != ss->killers[0]
&& move != ss->killers[1]
&& move != killers[0]
&& move != killers[1]
&& move != countermove)
return move;
}

View file

@ -111,6 +111,7 @@ private:
const Position& pos;
const Search::Stack* ss;
Move killers[2];
Move countermove;
Depth depth;
Move ttMove;