]> git.sesse.net Git - stockfish/commitdiff
Remove recaptures stage in qsearch
authorcj5716 <125858804+cj5716@users.noreply.github.com>
Wed, 29 Nov 2023 09:25:01 +0000 (17:25 +0800)
committerDisservin <disservin.social@gmail.com>
Sat, 2 Dec 2023 10:45:38 +0000 (11:45 +0100)
Simplify an old commit
https://github.com/official-stockfish/Stockfish/commit/72760c05c64d1fb2bb71c2ac54acfbeecf513b87.

Search is not stuck on the test position given
r1n1n1b1/1P1P1P1P/1N1N1N2/2RnQrRq/2pKp3/3BNQbQ/k7/4Bq2 w - - 0 1

Passed STC:
https://tests.stockfishchess.org/tests/view/6567050d136acbc573550919
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 236160 W: 59475 L: 59475 D: 117210
Ptnml(0-2): 841, 28266, 59816, 28366, 791

Passed LTC:
https://tests.stockfishchess.org/tests/view/6567d133136acbc573551c78
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 201690 W: 49630 L: 49593 D: 102467
Ptnml(0-2): 128, 23214, 54122, 23255, 126

closes https://github.com/official-stockfish/Stockfish/pull/4896

Bench: 1604361

src/movepick.cpp
src/movepick.h
src/search.cpp
src/types.h

index 798f51ddb6e56d2c5918c6be26ba64d4de8c46ec..0267a8e2e6f0418074bfbc172bf72335651dfb50 100644 (file)
@@ -112,15 +112,13 @@ MovePicker::MovePicker(const Position&              p,
                        const ButterflyHistory*      mh,
                        const CapturePieceToHistory* cph,
                        const PieceToHistory**       ch,
-                       const PawnHistory*           ph,
-                       Square                       rs) :
+                       const PawnHistory*           ph) :
     pos(p),
     mainHistory(mh),
     captureHistory(cph),
     continuationHistory(ch),
     pawnHistory(ph),
     ttMove(ttm),
-    recaptureSquare(rs),
     depth(d) {
     assert(d <= 0);
 
@@ -340,8 +338,7 @@ top:
         return select<Next>([&]() { return pos.see_ge(*cur, threshold); });
 
     case QCAPTURE :
-        if (select<Next>(
-              [&]() { return depth > DEPTH_QS_RECAPTURES || to_sq(*cur) == recaptureSquare; }))
+        if (select<Next>([]() { return true; }))
             return *(cur - 1);
 
         // If we did not find any move and we do not try checks, we have finished
index e032b0c7c79b33e4417b8a0409ba11d0b4861d02..7828fa19d975fb9f5e12f4e8a652d487037e6804 100644 (file)
@@ -152,8 +152,7 @@ class MovePicker {
                const ButterflyHistory*,
                const CapturePieceToHistory*,
                const PieceToHistory**,
-               const PawnHistory*,
-               Square);
+               const PawnHistory*);
     MovePicker(const Position&, Move, Value, const CapturePieceToHistory*);
     Move next_move(bool skipQuiets = false);
 
@@ -173,7 +172,6 @@ class MovePicker {
     Move                         ttMove;
     ExtMove                      refutations[3], *cur, *endMoves, *endBadCaptures;
     int                          stage;
-    Square                       recaptureSquare;
     Value                        threshold;
     Depth                        depth;
     ExtMove                      moves[MAX_MOVES];
index 409a3c1d429aa666c7b67169a10ebb871653fe77..160031384838abdc9ba8b5c882dc754a04bb5cd0 100644 (file)
@@ -1487,7 +1487,7 @@ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
     // will be generated.
     Square     prevSq = is_ok((ss - 1)->currentMove) ? to_sq((ss - 1)->currentMove) : SQ_NONE;
     MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory,
-                  contHist, &thisThread->pawnHistory, prevSq);
+                  contHist, &thisThread->pawnHistory);
 
     int quietCheckEvasions = 0;
 
index 7ac2f84951a8d27ac97a853258da7b586f7a84b8..0575f1d453cd3e371ec4305144f568c93459796f 100644 (file)
@@ -205,9 +205,8 @@ constexpr Value PieceValue[PIECE_NB] = {
 using Depth = int;
 
 enum : int {
-    DEPTH_QS_CHECKS     = 0,
-    DEPTH_QS_NO_CHECKS  = -1,
-    DEPTH_QS_RECAPTURES = -5,
+    DEPTH_QS_CHECKS    = 0,
+    DEPTH_QS_NO_CHECKS = -1,
 
     DEPTH_NONE = -6,