mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Sort captures
This patch (partially) sort captures in analogy to quiet moves. All three movepickers are affected, hence `depth` is added as an argument in probcut's. Passed STC: https://tests.stockfishchess.org/tests/view/621a4576da649bba32ef6fd4 LLR: 2.95 (-2.94,2.94) <0.00,2.50> Total: 103848 W: 27884 L: 27473 D: 48491 Ptnml(0-2): 587, 11691, 26974, 12068, 604 Passed LTC: https://tests.stockfishchess.org/tests/view/621aaa5bda649bba32ef7c2d LLR: 2.96 (-2.94,2.94) <0.50,3.00> Total: 212032 W: 56420 L: 55739 D: 99873 Ptnml(0-2): 198, 21310, 62348, 21933, 227 closes https://github.com/official-stockfish/Stockfish/pull/3952 Bench: 6833580
This commit is contained in:
parent
174b038bf3
commit
4ac7d726ec
3 changed files with 8 additions and 7 deletions
|
@ -87,8 +87,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist
|
|||
|
||||
/// MovePicker constructor for ProbCut: we generate captures with SEE greater
|
||||
/// than or equal to the given threshold.
|
||||
MovePicker::MovePicker(const Position& p, Move ttm, Value th, const CapturePieceToHistory* cph)
|
||||
: pos(p), captureHistory(cph), ttMove(ttm), threshold(th)
|
||||
MovePicker::MovePicker(const Position& p, Move ttm, Value th, Depth d, const CapturePieceToHistory* cph)
|
||||
: pos(p), captureHistory(cph), ttMove(ttm), threshold(th), depth(d)
|
||||
{
|
||||
assert(!pos.checkers());
|
||||
|
||||
|
@ -169,11 +169,12 @@ top:
|
|||
endMoves = generate<CAPTURES>(pos, cur);
|
||||
|
||||
score<CAPTURES>();
|
||||
partial_insertion_sort(cur, endMoves, -3000 * depth);
|
||||
++stage;
|
||||
goto top;
|
||||
|
||||
case GOOD_CAPTURE:
|
||||
if (select<Best>([&](){
|
||||
if (select<Next>([&](){
|
||||
return pos.see_ge(*cur, Value(-69 * cur->value / 1024)) ?
|
||||
// Move losing capture to endBadCaptures to be tried later
|
||||
true : (*endBadCaptures++ = *cur, false); }))
|
||||
|
@ -241,10 +242,10 @@ top:
|
|||
return select<Best>([](){ return true; });
|
||||
|
||||
case PROBCUT:
|
||||
return select<Best>([&](){ return pos.see_ge(*cur, threshold); });
|
||||
return select<Next>([&](){ return pos.see_ge(*cur, threshold); });
|
||||
|
||||
case QCAPTURE:
|
||||
if (select<Best>([&](){ return depth > DEPTH_QS_RECAPTURES
|
||||
if (select<Next>([&](){ return depth > DEPTH_QS_RECAPTURES
|
||||
|| to_sq(*cur) == recaptureSquare; }))
|
||||
return *(cur - 1);
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
const CapturePieceToHistory*,
|
||||
const PieceToHistory**,
|
||||
Square);
|
||||
MovePicker(const Position&, Move, Value, const CapturePieceToHistory*);
|
||||
MovePicker(const Position&, Move, Value, Depth, const CapturePieceToHistory*);
|
||||
Move next_move(bool skipQuiets = false);
|
||||
|
||||
private:
|
||||
|
|
|
@ -863,7 +863,7 @@ namespace {
|
|||
{
|
||||
assert(probCutBeta < VALUE_INFINITE);
|
||||
|
||||
MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, &captureHistory);
|
||||
MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, depth - 3, &captureHistory);
|
||||
bool ttPv = ss->ttPv;
|
||||
ss->ttPv = false;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue