Move the first killer move out of the capture stage, combining treatment
of first and second killer move.
passed STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 55777 W: 12367 L: 12313 D: 31097
http://tests.stockfishchess.org/tests/view/
5a88617e0ebc590297cc8351
Similar to an earlier proposition of Günther Demetz, see pull request #1075.
I think it is more robust and readable than master, why hand-unroll the loop
over the killer array, and duplicate code ?
This version includes review comments from Marco Costalba.
Bench:
5227124
namespace {
enum Stages {
namespace {
enum Stages {
- MAIN_SEARCH, CAPTURES_INIT, GOOD_CAPTURES, KILLERS, COUNTERMOVE, QUIET_INIT, QUIET, BAD_CAPTURES,
+ MAIN_SEARCH, CAPTURES_INIT, GOOD_CAPTURES, KILLER0, KILLER1, COUNTERMOVE, QUIET_INIT, QUIET, BAD_CAPTURES,
EVASION, EVASIONS_INIT, ALL_EVASIONS,
PROBCUT, PROBCUT_CAPTURES_INIT, PROBCUT_CAPTURES,
QSEARCH, QCAPTURES_INIT, QCAPTURES, QCHECKS, QSEARCH_RECAPTURES, QRECAPTURES
EVASION, EVASIONS_INIT, ALL_EVASIONS,
PROBCUT, PROBCUT_CAPTURES_INIT, PROBCUT_CAPTURES,
QSEARCH, QCAPTURES_INIT, QCAPTURES, QCHECKS, QSEARCH_RECAPTURES, QRECAPTURES
*endBadCaptures++ = move;
}
}
*endBadCaptures++ = move;
}
}
- move = killers[0]; // First killer move
- if ( move != MOVE_NONE
- && move != ttMove
- && pos.pseudo_legal(move)
- && !pos.capture(move))
- return move;
- case KILLERS:
- ++stage;
- move = killers[1]; // Second killer move
- if ( move != MOVE_NONE
- && move != ttMove
- && pos.pseudo_legal(move)
- && !pos.capture(move))
- return move;
+ case KILLER0:
+ case KILLER1:
+ do
+ {
+ move = killers[++stage - KILLER1];
+ if ( move != MOVE_NONE
+ && move != ttMove
+ && pos.pseudo_legal(move)
+ && !pos.capture(move))
+ return move;
+ } while (stage <= KILLER1);
/* fallthrough */
case COUNTERMOVE:
/* fallthrough */
case COUNTERMOVE: