Skip to content

Commit 1d5eaba

Browse files
mbootsectorzamar
authored andcommitted
Retire follow-up move heuristic
STC: http://tests.stockfishchess.org/tests/view/5501d0f30ebc5902160ec0fd LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 34891 W: 6904 L: 6808 D: 21179 LTC: http://tests.stockfishchess.org/tests/view/550328540ebc5902160ec133 LLR: 3.10 (-2.94,2.94) [-3.00,1.00] Total: 182653 W: 29866 L: 29993 D: 122794 Bench: 8396161 Resolves #310
1 parent ac8e6ff commit 1d5eaba

File tree

3 files changed

+12
-30
lines changed

3 files changed

+12
-30
lines changed

src/movepick.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ namespace {
6868
/// ordering is at the current node.
6969

7070
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CounterMovesHistoryStats& cmh,
71-
Move* cm, Move* fm, Search::Stack* s) : pos(p), history(h), counterMovesHistory(cmh), depth(d) {
71+
Move* cm, Search::Stack* s) : pos(p), history(h), counterMovesHistory(cmh), depth(d) {
7272

7373
assert(d > DEPTH_ZERO);
7474

7575
endBadCaptures = moves + MAX_MOVES - 1;
7676
countermoves = cm;
77-
followupmoves = fm;
7877
ss = s;
7978

8079
if (pos.checkers())
@@ -211,23 +210,15 @@ void MovePicker::generate_next_stage() {
211210
killers[0] = ss->killers[0];
212211
killers[1] = ss->killers[1];
213212
killers[2].move = killers[3].move = MOVE_NONE;
214-
killers[4].move = killers[5].move = MOVE_NONE;
215213

216-
// In SMP case countermoves[] and followupmoves[] could have duplicated entries
214+
// In SMP case countermoves[] could have duplicated entries
217215
// in rare cases (less than 1 out of a million). This is harmless.
218216

219217
// Be sure countermoves and followupmoves are different from killers
220218
for (int i = 0; i < 2; ++i)
221219
if ( countermoves[i] != killers[0]
222220
&& countermoves[i] != killers[1])
223221
*endMoves++ = countermoves[i];
224-
225-
for (int i = 0; i < 2; ++i)
226-
if ( followupmoves[i] != killers[0]
227-
&& followupmoves[i] != killers[1]
228-
&& followupmoves[i] != killers[2]
229-
&& followupmoves[i] != killers[3])
230-
*endMoves++ = followupmoves[i];
231222
break;
232223

233224
case QUIETS_1_S1:
@@ -321,9 +312,7 @@ Move MovePicker::next_move<false>() {
321312
&& move != killers[0]
322313
&& move != killers[1]
323314
&& move != killers[2]
324-
&& move != killers[3]
325-
&& move != killers[4]
326-
&& move != killers[5])
315+
&& move != killers[3])
327316
return move;
328317
break;
329318

src/movepick.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class MovePicker {
8888

8989
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Square);
9090
MovePicker(const Position&, Move, const HistoryStats&, const CounterMovesHistoryStats&, PieceType);
91-
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Move*, Move*, Search::Stack*);
91+
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Move*, Search::Stack*);
9292

9393
template<bool SpNode> Move next_move();
9494

@@ -103,10 +103,9 @@ class MovePicker {
103103
const CounterMovesHistoryStats& counterMovesHistory;
104104
Search::Stack* ss;
105105
Move* countermoves;
106-
Move* followupmoves;
107106
Depth depth;
108107
Move ttMove;
109-
ExtMove killers[6];
108+
ExtMove killers[4];
110109
Square recaptureSquare;
111110
Value captureThreshold;
112111
int stage;

src/search.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ namespace {
137137
HistoryStats History;
138138
CounterMovesHistoryStats CounterMovesHistory;
139139
GainsStats Gains;
140-
MovesStats Countermoves, Followupmoves;
140+
MovesStats Countermoves;
141141

142142
template <NodeType NT, bool SpNode>
143143
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode);
@@ -339,8 +339,7 @@ namespace {
339339
CounterMovesHistory.clear();
340340
Gains.clear();
341341
Countermoves.clear();
342-
Followupmoves.clear();
343-
342+
344343
size_t multiPV = Options["MultiPV"];
345344
Skill skill(Options["Skill Level"]);
346345

@@ -595,7 +594,7 @@ namespace {
595594
{
596595
ss->currentMove = ttMove; // Can be MOVE_NONE
597596

598-
// If ttMove is quiet, update killers, history, counter move and followup move on TT hit
597+
// If ttMove is quiet, update killers, history, counter move on TT hit
599598
if (ttValue >= beta && ttMove && !pos.capture_or_promotion(ttMove) && !inCheck)
600599
update_stats(pos, ss, ttMove, depth, nullptr, 0);
601600

@@ -787,11 +786,7 @@ namespace {
787786
Move countermoves[] = { Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].first,
788787
Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].second };
789788

790-
Square prevOwnMoveSq = to_sq((ss-2)->currentMove);
791-
Move followupmoves[] = { Followupmoves[pos.piece_on(prevOwnMoveSq)][prevOwnMoveSq].first,
792-
Followupmoves[pos.piece_on(prevOwnMoveSq)][prevOwnMoveSq].second };
793-
794-
MovePicker mp(pos, ttMove, depth, History, CounterMovesHistory, countermoves, followupmoves, ss);
789+
MovePicker mp(pos, ttMove, depth, History, CounterMovesHistory, countermoves, ss);
795790
CheckInfo ci(pos);
796791
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
797792
improving = ss->staticEval >= (ss-2)->staticEval
@@ -1144,7 +1139,7 @@ namespace {
11441139
bestValue = excludedMove ? alpha
11451140
: inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
11461141

1147-
// Quiet best move: update killers, history, countermoves and followupmoves
1142+
// Quiet best move: update killers, history and countermoves
11481143
else if (bestValue >= beta && !pos.capture_or_promotion(bestMove) && !inCheck)
11491144
update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount - 1);
11501145

@@ -1404,8 +1399,8 @@ namespace {
14041399
*pv = MOVE_NONE;
14051400
}
14061401

1407-
// update_stats() updates killers, history, countermoves and followupmoves
1408-
// stats after a fail-high of a quiet move.
1402+
// update_stats() updates killers, history and countermoves stats after a fail-high
1403+
// of a quiet move.
14091404

14101405
void update_stats(const Position& pos, Stack* ss, Move move, Depth depth, Move* quiets, int quietsCnt) {
14111406

@@ -1440,7 +1435,6 @@ namespace {
14401435
if (is_ok((ss-2)->currentMove) && (ss-1)->currentMove == (ss-1)->ttMove)
14411436
{
14421437
Square prevPrevSq = to_sq((ss-2)->currentMove);
1443-
Followupmoves.update(pos.piece_on(prevPrevSq), prevPrevSq, move);
14441438

14451439
// Extra penalty for TT move in previous ply when it gets refuted
14461440
HistoryStats& ttMoveCmh = CounterMovesHistory[pos.piece_on(prevPrevSq)][prevPrevSq];

0 commit comments

Comments
 (0)