From: Joost VandeVondele Date: Sun, 25 Feb 2018 21:33:40 +0000 (+0100) Subject: Combine killer moves X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=ebb3e7df65b48b8c66c9853983865aefa02e6b59;hp=2ec36f8ae8089bf1d687951c1d26c3a6a9e9eb01 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 --- diff --git a/src/movepick.cpp b/src/movepick.cpp index 51d85192..35f9d25e 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -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: