1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

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
This commit is contained in:
mbootsector 2015-03-28 22:09:48 +00:00 committed by Joona Kiiski
parent ac8e6ff000
commit 1d5eaba573
3 changed files with 12 additions and 30 deletions

View file

@ -68,13 +68,12 @@ namespace {
/// ordering is at the current node. /// ordering is at the current node.
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CounterMovesHistoryStats& cmh, MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CounterMovesHistoryStats& cmh,
Move* cm, Move* fm, Search::Stack* s) : pos(p), history(h), counterMovesHistory(cmh), depth(d) { Move* cm, Search::Stack* s) : pos(p), history(h), counterMovesHistory(cmh), depth(d) {
assert(d > DEPTH_ZERO); assert(d > DEPTH_ZERO);
endBadCaptures = moves + MAX_MOVES - 1; endBadCaptures = moves + MAX_MOVES - 1;
countermoves = cm; countermoves = cm;
followupmoves = fm;
ss = s; ss = s;
if (pos.checkers()) if (pos.checkers())
@ -211,9 +210,8 @@ void MovePicker::generate_next_stage() {
killers[0] = ss->killers[0]; killers[0] = ss->killers[0];
killers[1] = ss->killers[1]; killers[1] = ss->killers[1];
killers[2].move = killers[3].move = MOVE_NONE; killers[2].move = killers[3].move = MOVE_NONE;
killers[4].move = killers[5].move = MOVE_NONE;
// In SMP case countermoves[] and followupmoves[] could have duplicated entries // In SMP case countermoves[] could have duplicated entries
// in rare cases (less than 1 out of a million). This is harmless. // in rare cases (less than 1 out of a million). This is harmless.
// Be sure countermoves and followupmoves are different from killers // Be sure countermoves and followupmoves are different from killers
@ -221,13 +219,6 @@ void MovePicker::generate_next_stage() {
if ( countermoves[i] != killers[0] if ( countermoves[i] != killers[0]
&& countermoves[i] != killers[1]) && countermoves[i] != killers[1])
*endMoves++ = countermoves[i]; *endMoves++ = countermoves[i];
for (int i = 0; i < 2; ++i)
if ( followupmoves[i] != killers[0]
&& followupmoves[i] != killers[1]
&& followupmoves[i] != killers[2]
&& followupmoves[i] != killers[3])
*endMoves++ = followupmoves[i];
break; break;
case QUIETS_1_S1: case QUIETS_1_S1:
@ -321,9 +312,7 @@ Move MovePicker::next_move<false>() {
&& move != killers[0] && move != killers[0]
&& move != killers[1] && move != killers[1]
&& move != killers[2] && move != killers[2]
&& move != killers[3] && move != killers[3])
&& move != killers[4]
&& move != killers[5])
return move; return move;
break; break;

View file

@ -88,7 +88,7 @@ public:
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Square); MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Square);
MovePicker(const Position&, Move, const HistoryStats&, const CounterMovesHistoryStats&, PieceType); MovePicker(const Position&, Move, const HistoryStats&, const CounterMovesHistoryStats&, PieceType);
MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Move*, Move*, Search::Stack*); MovePicker(const Position&, Move, Depth, const HistoryStats&, const CounterMovesHistoryStats&, Move*, Search::Stack*);
template<bool SpNode> Move next_move(); template<bool SpNode> Move next_move();
@ -103,10 +103,9 @@ private:
const CounterMovesHistoryStats& counterMovesHistory; const CounterMovesHistoryStats& counterMovesHistory;
Search::Stack* ss; Search::Stack* ss;
Move* countermoves; Move* countermoves;
Move* followupmoves;
Depth depth; Depth depth;
Move ttMove; Move ttMove;
ExtMove killers[6]; ExtMove killers[4];
Square recaptureSquare; Square recaptureSquare;
Value captureThreshold; Value captureThreshold;
int stage; int stage;

View file

@ -137,7 +137,7 @@ namespace {
HistoryStats History; HistoryStats History;
CounterMovesHistoryStats CounterMovesHistory; CounterMovesHistoryStats CounterMovesHistory;
GainsStats Gains; GainsStats Gains;
MovesStats Countermoves, Followupmoves; MovesStats Countermoves;
template <NodeType NT, bool SpNode> template <NodeType NT, bool SpNode>
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode); Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode);
@ -339,7 +339,6 @@ namespace {
CounterMovesHistory.clear(); CounterMovesHistory.clear();
Gains.clear(); Gains.clear();
Countermoves.clear(); Countermoves.clear();
Followupmoves.clear();
size_t multiPV = Options["MultiPV"]; size_t multiPV = Options["MultiPV"];
Skill skill(Options["Skill Level"]); Skill skill(Options["Skill Level"]);
@ -595,7 +594,7 @@ namespace {
{ {
ss->currentMove = ttMove; // Can be MOVE_NONE ss->currentMove = ttMove; // Can be MOVE_NONE
// If ttMove is quiet, update killers, history, counter move and followup move on TT hit // If ttMove is quiet, update killers, history, counter move on TT hit
if (ttValue >= beta && ttMove && !pos.capture_or_promotion(ttMove) && !inCheck) if (ttValue >= beta && ttMove && !pos.capture_or_promotion(ttMove) && !inCheck)
update_stats(pos, ss, ttMove, depth, nullptr, 0); update_stats(pos, ss, ttMove, depth, nullptr, 0);
@ -787,11 +786,7 @@ moves_loop: // When in check and at SpNode search starts from here
Move countermoves[] = { Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].first, Move countermoves[] = { Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].first,
Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].second }; Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].second };
Square prevOwnMoveSq = to_sq((ss-2)->currentMove); MovePicker mp(pos, ttMove, depth, History, CounterMovesHistory, countermoves, ss);
Move followupmoves[] = { Followupmoves[pos.piece_on(prevOwnMoveSq)][prevOwnMoveSq].first,
Followupmoves[pos.piece_on(prevOwnMoveSq)][prevOwnMoveSq].second };
MovePicker mp(pos, ttMove, depth, History, CounterMovesHistory, countermoves, followupmoves, ss);
CheckInfo ci(pos); CheckInfo ci(pos);
value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc
improving = ss->staticEval >= (ss-2)->staticEval improving = ss->staticEval >= (ss-2)->staticEval
@ -1144,7 +1139,7 @@ moves_loop: // When in check and at SpNode search starts from here
bestValue = excludedMove ? alpha bestValue = excludedMove ? alpha
: inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()]; : inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
// Quiet best move: update killers, history, countermoves and followupmoves // Quiet best move: update killers, history and countermoves
else if (bestValue >= beta && !pos.capture_or_promotion(bestMove) && !inCheck) else if (bestValue >= beta && !pos.capture_or_promotion(bestMove) && !inCheck)
update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount - 1); update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount - 1);
@ -1404,8 +1399,8 @@ moves_loop: // When in check and at SpNode search starts from here
*pv = MOVE_NONE; *pv = MOVE_NONE;
} }
// update_stats() updates killers, history, countermoves and followupmoves // update_stats() updates killers, history and countermoves stats after a fail-high
// stats after a fail-high of a quiet move. // of a quiet move.
void update_stats(const Position& pos, Stack* ss, Move move, Depth depth, Move* quiets, int quietsCnt) { void update_stats(const Position& pos, Stack* ss, Move move, Depth depth, Move* quiets, int quietsCnt) {
@ -1440,7 +1435,6 @@ moves_loop: // When in check and at SpNode search starts from here
if (is_ok((ss-2)->currentMove) && (ss-1)->currentMove == (ss-1)->ttMove) if (is_ok((ss-2)->currentMove) && (ss-1)->currentMove == (ss-1)->ttMove)
{ {
Square prevPrevSq = to_sq((ss-2)->currentMove); Square prevPrevSq = to_sq((ss-2)->currentMove);
Followupmoves.update(pos.piece_on(prevPrevSq), prevPrevSq, move);
// Extra penalty for TT move in previous ply when it gets refuted // Extra penalty for TT move in previous ply when it gets refuted
HistoryStats& ttMoveCmh = CounterMovesHistory[pos.piece_on(prevPrevSq)][prevPrevSq]; HistoryStats& ttMoveCmh = CounterMovesHistory[pos.piece_on(prevPrevSq)][prevPrevSq];