mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
removed second killer move
STC with movepicker rewrite: LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 46656 W: 12208 L: 11995 D: 22453 Ptnml(0-2): 203, 5461, 11777, 5694, 193 https://tests.stockfishchess.org/tests/view/668d98a15034141ae5999e68 Earlier version passed STC: LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 468896 W: 120999 L: 120054 D: 227843 Ptnml(0-2): 1207, 55209, 120639, 56218, 1175 https://tests.stockfishchess.org/tests/view/668b17d2cf91c430fca58630 Earlier version passed LTC: LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 550524 W: 139553 L: 139877 D: 271094 Ptnml(0-2): 333, 61646, 151616, 61346, 321 https://tests.stockfishchess.org/tests/view/668b2e04cf91c430fca586b1 closes https://github.com/official-stockfish/Stockfish/pull/5472 bench 1234309 Co-authored-by: rn5f107s2 <clemens.lerchl@gmail.com>
This commit is contained in:
parent
6135a0e2f8
commit
8d1e41458e
4 changed files with 25 additions and 33 deletions
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iterator>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "bitboard.h"
|
#include "bitboard.h"
|
||||||
|
@ -35,7 +34,7 @@ enum Stages {
|
||||||
MAIN_TT,
|
MAIN_TT,
|
||||||
CAPTURE_INIT,
|
CAPTURE_INIT,
|
||||||
GOOD_CAPTURE,
|
GOOD_CAPTURE,
|
||||||
REFUTATION,
|
KILLER,
|
||||||
QUIET_INIT,
|
QUIET_INIT,
|
||||||
GOOD_QUIET,
|
GOOD_QUIET,
|
||||||
BAD_CAPTURE,
|
BAD_CAPTURE,
|
||||||
|
@ -91,14 +90,14 @@ MovePicker::MovePicker(const Position& p,
|
||||||
const CapturePieceToHistory* cph,
|
const CapturePieceToHistory* cph,
|
||||||
const PieceToHistory** ch,
|
const PieceToHistory** ch,
|
||||||
const PawnHistory* ph,
|
const PawnHistory* ph,
|
||||||
const Move* killers) :
|
Move km) :
|
||||||
pos(p),
|
pos(p),
|
||||||
mainHistory(mh),
|
mainHistory(mh),
|
||||||
captureHistory(cph),
|
captureHistory(cph),
|
||||||
continuationHistory(ch),
|
continuationHistory(ch),
|
||||||
pawnHistory(ph),
|
pawnHistory(ph),
|
||||||
ttMove(ttm),
|
ttMove(ttm),
|
||||||
refutations{{killers[0], 0}, {killers[1], 0}},
|
killer{km, 0},
|
||||||
depth(d) {
|
depth(d) {
|
||||||
assert(d > 0);
|
assert(d > 0);
|
||||||
|
|
||||||
|
@ -268,19 +267,17 @@ top:
|
||||||
}))
|
}))
|
||||||
return *(cur - 1);
|
return *(cur - 1);
|
||||||
|
|
||||||
// Prepare the pointers to loop over the refutations array
|
|
||||||
cur = std::begin(refutations);
|
|
||||||
endMoves = std::end(refutations);
|
|
||||||
|
|
||||||
++stage;
|
++stage;
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
case REFUTATION :
|
case KILLER :
|
||||||
if (select<Next>([&]() {
|
// increment it before so if we aren't stuck here indefinitely
|
||||||
return *cur != Move::none() && !pos.capture_stage(*cur) && pos.pseudo_legal(*cur);
|
|
||||||
}))
|
|
||||||
return *(cur - 1);
|
|
||||||
++stage;
|
++stage;
|
||||||
|
|
||||||
|
if (killer != ttMove && killer != Move::none() && !pos.capture_stage(killer)
|
||||||
|
&& pos.pseudo_legal(killer))
|
||||||
|
return killer;
|
||||||
|
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
case QUIET_INIT :
|
case QUIET_INIT :
|
||||||
|
@ -297,8 +294,7 @@ top:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
case GOOD_QUIET :
|
case GOOD_QUIET :
|
||||||
if (!skipQuiets
|
if (!skipQuiets && select<Next>([&]() { return *cur != killer; }))
|
||||||
&& select<Next>([&]() { return *cur != refutations[0] && *cur != refutations[1]; }))
|
|
||||||
{
|
{
|
||||||
if ((cur - 1)->value > -7998 || (cur - 1)->value <= quiet_threshold(depth))
|
if ((cur - 1)->value > -7998 || (cur - 1)->value <= quiet_threshold(depth))
|
||||||
return *(cur - 1);
|
return *(cur - 1);
|
||||||
|
@ -327,7 +323,7 @@ top:
|
||||||
|
|
||||||
case BAD_QUIET :
|
case BAD_QUIET :
|
||||||
if (!skipQuiets)
|
if (!skipQuiets)
|
||||||
return select<Next>([&]() { return *cur != refutations[0] && *cur != refutations[1]; });
|
return select<Next>([&]() { return *cur != killer; });
|
||||||
|
|
||||||
return Move::none();
|
return Move::none();
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ class MovePicker {
|
||||||
const CapturePieceToHistory*,
|
const CapturePieceToHistory*,
|
||||||
const PieceToHistory**,
|
const PieceToHistory**,
|
||||||
const PawnHistory*,
|
const PawnHistory*,
|
||||||
const Move*);
|
Move);
|
||||||
MovePicker(const Position&,
|
MovePicker(const Position&,
|
||||||
Move,
|
Move,
|
||||||
Depth,
|
Depth,
|
||||||
|
@ -185,7 +185,7 @@ class MovePicker {
|
||||||
const PieceToHistory** continuationHistory;
|
const PieceToHistory** continuationHistory;
|
||||||
const PawnHistory* pawnHistory;
|
const PawnHistory* pawnHistory;
|
||||||
Move ttMove;
|
Move ttMove;
|
||||||
ExtMove refutations[2], *cur, *endMoves, *endBadCaptures, *beginBadQuiets, *endBadQuiets;
|
ExtMove killer, *cur, *endMoves, *endBadCaptures, *beginBadQuiets, *endBadQuiets;
|
||||||
int stage;
|
int stage;
|
||||||
int threshold;
|
int threshold;
|
||||||
Depth depth;
|
Depth depth;
|
||||||
|
|
|
@ -123,7 +123,7 @@ Value value_to_tt(Value v, int ply);
|
||||||
Value value_from_tt(Value v, int ply, int r50c);
|
Value value_from_tt(Value v, int ply, int r50c);
|
||||||
void update_pv(Move* pv, Move move, const Move* childPv);
|
void update_pv(Move* pv, Move move, const Move* childPv);
|
||||||
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus);
|
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus);
|
||||||
void update_refutations(Stack* ss, Move move);
|
void update_killer(Stack* ss, Move move);
|
||||||
void update_quiet_histories(
|
void update_quiet_histories(
|
||||||
const Position& pos, Stack* ss, Search::Worker& workerThread, Move move, int bonus);
|
const Position& pos, Stack* ss, Search::Worker& workerThread, Move move, int bonus);
|
||||||
void update_quiet_stats(
|
void update_quiet_stats(
|
||||||
|
@ -609,7 +609,7 @@ Value Search::Worker::search(
|
||||||
assert(0 <= ss->ply && ss->ply < MAX_PLY);
|
assert(0 <= ss->ply && ss->ply < MAX_PLY);
|
||||||
|
|
||||||
bestMove = Move::none();
|
bestMove = Move::none();
|
||||||
(ss + 2)->killers[0] = (ss + 2)->killers[1] = Move::none();
|
(ss + 1)->killer = Move::none();
|
||||||
(ss + 2)->cutoffCnt = 0;
|
(ss + 2)->cutoffCnt = 0;
|
||||||
Square prevSq = ((ss - 1)->currentMove).is_ok() ? ((ss - 1)->currentMove).to_sq() : SQ_NONE;
|
Square prevSq = ((ss - 1)->currentMove).is_ok() ? ((ss - 1)->currentMove).to_sq() : SQ_NONE;
|
||||||
ss->statScore = 0;
|
ss->statScore = 0;
|
||||||
|
@ -934,7 +934,7 @@ moves_loop: // When in check, search starts here
|
||||||
|
|
||||||
|
|
||||||
MovePicker mp(pos, ttData.move, depth, &thisThread->mainHistory, &thisThread->captureHistory,
|
MovePicker mp(pos, ttData.move, depth, &thisThread->mainHistory, &thisThread->captureHistory,
|
||||||
contHist, &thisThread->pawnHistory, ss->killers);
|
contHist, &thisThread->pawnHistory, ss->killer);
|
||||||
|
|
||||||
value = bestValue;
|
value = bestValue;
|
||||||
moveCountPruning = false;
|
moveCountPruning = false;
|
||||||
|
@ -1157,7 +1157,7 @@ moves_loop: // When in check, search starts here
|
||||||
// Increase reduction for cut nodes (~4 Elo)
|
// Increase reduction for cut nodes (~4 Elo)
|
||||||
if (cutNode)
|
if (cutNode)
|
||||||
r += 2 - (ttData.depth >= depth && ss->ttPv)
|
r += 2 - (ttData.depth >= depth && ss->ttPv)
|
||||||
+ (!ss->ttPv && move != ttData.move && move != ss->killers[0]);
|
+ (!ss->ttPv && move != ttData.move && move != ss->killer);
|
||||||
|
|
||||||
// Increase reduction if ttMove is a capture (~3 Elo)
|
// Increase reduction if ttMove is a capture (~3 Elo)
|
||||||
if (ttCapture)
|
if (ttCapture)
|
||||||
|
@ -1801,7 +1801,7 @@ void update_all_stats(const Position& pos,
|
||||||
// main killer move in previous ply when it gets refuted.
|
// main killer move in previous ply when it gets refuted.
|
||||||
if (prevSq != SQ_NONE
|
if (prevSq != SQ_NONE
|
||||||
&& ((ss - 1)->moveCount == 1 + (ss - 1)->ttHit
|
&& ((ss - 1)->moveCount == 1 + (ss - 1)->ttHit
|
||||||
|| ((ss - 1)->currentMove == (ss - 1)->killers[0]))
|
|| ((ss - 1)->currentMove == (ss - 1)->killer))
|
||||||
&& !pos.captured_piece())
|
&& !pos.captured_piece())
|
||||||
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -quietMoveMalus);
|
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -quietMoveMalus);
|
||||||
|
|
||||||
|
@ -1832,14 +1832,10 @@ void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates move sorting heuristics
|
// Updates move sorting heuristics
|
||||||
void update_refutations(Stack* ss, Move move) {
|
void update_killer(Stack* ss, Move move) {
|
||||||
|
|
||||||
// Update killers
|
// Update killers
|
||||||
if (ss->killers[0] != move)
|
ss->killer = move;
|
||||||
{
|
|
||||||
ss->killers[1] = ss->killers[0];
|
|
||||||
ss->killers[0] = move;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_quiet_histories(
|
void update_quiet_histories(
|
||||||
|
@ -1858,7 +1854,7 @@ void update_quiet_histories(
|
||||||
void update_quiet_stats(
|
void update_quiet_stats(
|
||||||
const Position& pos, Stack* ss, Search::Worker& workerThread, Move move, int bonus) {
|
const Position& pos, Stack* ss, Search::Worker& workerThread, Move move, int bonus) {
|
||||||
|
|
||||||
update_refutations(ss, move);
|
update_killer(ss, move);
|
||||||
update_quiet_histories(pos, ss, workerThread, move, bonus);
|
update_quiet_histories(pos, ss, workerThread, move, bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct Stack {
|
||||||
int ply;
|
int ply;
|
||||||
Move currentMove;
|
Move currentMove;
|
||||||
Move excludedMove;
|
Move excludedMove;
|
||||||
Move killers[2];
|
Move killer;
|
||||||
Value staticEval;
|
Value staticEval;
|
||||||
int statScore;
|
int statScore;
|
||||||
int moveCount;
|
int moveCount;
|
||||||
|
|
Loading…
Add table
Reference in a new issue