From 8dd6875240e05dbcc1fb6467ffb11ad360aa474c Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sun, 25 Feb 2018 12:49:03 +0100 Subject: [PATCH 1/1] Join all capture init stages in MovePicker Passed STC: LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 16789 W: 3685 L: 3554 D: 9550 http://tests.stockfishchess.org/tests/view/5a91a8bb0ebc590297cc875b Passed LTC: LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 21293 W: 3527 L: 3407 D: 14359 http://tests.stockfishchess.org/tests/view/5a920a730ebc590297cc87ba No functional change --- src/movepick.cpp | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/movepick.cpp b/src/movepick.cpp index b4cae3a0..51d85192 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -27,7 +27,7 @@ namespace { enum Stages { MAIN_SEARCH, CAPTURES_INIT, GOOD_CAPTURES, KILLERS, COUNTERMOVE, QUIET_INIT, QUIET, BAD_CAPTURES, EVASION, EVASIONS_INIT, ALL_EVASIONS, - PROBCUT, PROBCUT_INIT, PROBCUT_CAPTURES, + PROBCUT, PROBCUT_CAPTURES_INIT, PROBCUT_CAPTURES, QSEARCH, QCAPTURES_INIT, QCAPTURES, QCHECKS, QSEARCH_RECAPTURES, QRECAPTURES }; @@ -161,11 +161,16 @@ Move MovePicker::next_move(bool skipQuiets) { return ttMove; case CAPTURES_INIT: + case PROBCUT_CAPTURES_INIT: + case QCAPTURES_INIT: + case QSEARCH_RECAPTURES: endBadCaptures = cur = moves; endMoves = generate(pos, cur); score(); ++stage; - /* fallthrough */ + + // Rebranch at the top of the switch via a recursive call + return next_move(skipQuiets); case GOOD_CAPTURES: while (cur < endMoves) @@ -257,13 +262,6 @@ Move MovePicker::next_move(bool skipQuiets) { } break; - case PROBCUT_INIT: - cur = moves; - endMoves = generate(pos, cur); - score(); - ++stage; - /* fallthrough */ - case PROBCUT_CAPTURES: while (cur < endMoves) { @@ -274,13 +272,6 @@ Move MovePicker::next_move(bool skipQuiets) { } break; - case QCAPTURES_INIT: - cur = moves; - endMoves = generate(pos, cur); - score(); - ++stage; - /* fallthrough */ - case QCAPTURES: while (cur < endMoves) { @@ -304,12 +295,6 @@ Move MovePicker::next_move(bool skipQuiets) { } break; - case QSEARCH_RECAPTURES: - cur = moves; - endMoves = generate(pos, cur); - ++stage; - /* fallthrough */ - case QRECAPTURES: while (cur < endMoves) { -- 2.39.2