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
/// MovePicker constructor for ProbCut: we generate captures with SEE greater
/// than or equal to the given threshold.
/// 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());
{
assert(!pos.checkers());
endMoves = generate<CAPTURES>(pos, cur);
score<CAPTURES>();
endMoves = generate<CAPTURES>(pos, cur);
score<CAPTURES>();
+ partial_insertion_sort(cur, endMoves, -3000 * depth);
++stage;
goto top;
case GOOD_CAPTURE:
++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); }))
return pos.see_ge(*cur, Value(-69 * cur->value / 1024)) ?
// Move losing capture to endBadCaptures to be tried later
true : (*endBadCaptures++ = *cur, false); }))
return select<Best>([](){ return true; });
case PROBCUT:
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); });
- if (select<Best>([&](){ return depth > DEPTH_QS_RECAPTURES
+ if (select<Next>([&](){ return depth > DEPTH_QS_RECAPTURES
|| to_sq(*cur) == recaptureSquare; }))
return *(cur - 1);
|| to_sq(*cur) == recaptureSquare; }))
return *(cur - 1);
const CapturePieceToHistory*,
const PieceToHistory**,
Square);
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:
Move next_move(bool skipQuiets = false);
private:
{
assert(probCutBeta < VALUE_INFINITE);
{
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;
bool ttPv = ss->ttPv;
ss->ttPv = false;