1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Combine killer moves

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
This commit is contained in:
Joost VandeVondele 2018-02-25 22:33:40 +01:00 committed by Stéphane Nicolet
parent 2ec36f8ae8
commit ebb3e7df65

View file

@ -25,7 +25,7 @@
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
@ -185,24 +185,20 @@ Move MovePicker::next_move(bool skipQuiets) {
*endBadCaptures++ = move;
}
}
++stage;
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 = 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: