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;
endMoves = generate<CAPTURES>(pos, cur);
score<CAPTURES>();
++stage;
+ /* fallthrough */
case GOOD_CAPTURES:
while (cur < endMoves)
}
++stage;
- move = ss->killers[0]; // First killer move
+ move = killers[0]; // First killer move
if ( move != MOVE_NONE
&& move != ttMove
&& pos.pseudo_legal(move)
&& !pos.capture(move))
return move;
+ /* fallthrough */
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)
&& !pos.capture(move))
return move;
+ /* fallthrough */
case COUNTERMOVE:
++stage;
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;
+ /* fallthrough */
case QUIET_INIT:
cur = endBadCaptures;
score<QUIETS>();
partial_insertion_sort(cur, endMoves, -4000 * depth / ONE_PLY);
++stage;
+ /* fallthrough */
case QUIET:
while ( cur < endMoves
move = *cur++;
if ( move != ttMove
- && move != ss->killers[0]
- && move != ss->killers[1]
+ && move != killers[0]
+ && move != killers[1]
&& move != countermove)
return move;
}
++stage;
cur = moves; // Point to beginning of bad captures
+ /* fallthrough */
case BAD_CAPTURES:
if (cur < endBadCaptures)
endMoves = generate<EVASIONS>(pos, cur);
score<EVASIONS>();
++stage;
+ /* fallthrough */
case ALL_EVASIONS:
while (cur < endMoves)
endMoves = generate<CAPTURES>(pos, cur);
score<CAPTURES>();
++stage;
+ /* fallthrough */
case PROBCUT_CAPTURES:
while (cur < endMoves)
endMoves = generate<CAPTURES>(pos, cur);
score<CAPTURES>();
++stage;
+ /* fallthrough */
case QCAPTURES_1: case QCAPTURES_2:
while (cur < endMoves)
cur = moves;
endMoves = generate<QUIET_CHECKS>(pos, cur);
++stage;
+ /* fallthrough */
case QCHECKS:
while (cur < endMoves)
endMoves = generate<CAPTURES>(pos, cur);
score<CAPTURES>();
++stage;
+ /* fallthrough */
case QRECAPTURES:
while (cur < endMoves)