Skip to content

Commit 15d47a2

Browse files
cj5716Disservin
authored andcommitted
Remove recaptures stage in qsearch
Simplify an old commit 72760c0. 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 #4896 Bench: 1604361
1 parent 85403a8 commit 15d47a2

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

src/movepick.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,13 @@ MovePicker::MovePicker(const Position& p,
112112
const ButterflyHistory* mh,
113113
const CapturePieceToHistory* cph,
114114
const PieceToHistory** ch,
115-
const PawnHistory* ph,
116-
Square rs) :
115+
const PawnHistory* ph) :
117116
pos(p),
118117
mainHistory(mh),
119118
captureHistory(cph),
120119
continuationHistory(ch),
121120
pawnHistory(ph),
122121
ttMove(ttm),
123-
recaptureSquare(rs),
124122
depth(d) {
125123
assert(d <= 0);
126124

@@ -340,8 +338,7 @@ Move MovePicker::next_move(bool skipQuiets) {
340338
return select<Next>([&]() { return pos.see_ge(*cur, threshold); });
341339

342340
case QCAPTURE :
343-
if (select<Next>(
344-
[&]() { return depth > DEPTH_QS_RECAPTURES || to_sq(*cur) == recaptureSquare; }))
341+
if (select<Next>([]() { return true; }))
345342
return *(cur - 1);
346343

347344
// If we did not find any move and we do not try checks, we have finished

src/movepick.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ class MovePicker {
152152
const ButterflyHistory*,
153153
const CapturePieceToHistory*,
154154
const PieceToHistory**,
155-
const PawnHistory*,
156-
Square);
155+
const PawnHistory*);
157156
MovePicker(const Position&, Move, Value, const CapturePieceToHistory*);
158157
Move next_move(bool skipQuiets = false);
159158

@@ -173,7 +172,6 @@ class MovePicker {
173172
Move ttMove;
174173
ExtMove refutations[3], *cur, *endMoves, *endBadCaptures;
175174
int stage;
176-
Square recaptureSquare;
177175
Value threshold;
178176
Depth depth;
179177
ExtMove moves[MAX_MOVES];

src/search.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
14871487
// will be generated.
14881488
Square prevSq = is_ok((ss - 1)->currentMove) ? to_sq((ss - 1)->currentMove) : SQ_NONE;
14891489
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory,
1490-
contHist, &thisThread->pawnHistory, prevSq);
1490+
contHist, &thisThread->pawnHistory);
14911491

14921492
int quietCheckEvasions = 0;
14931493

src/types.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ constexpr Value PieceValue[PIECE_NB] = {
205205
using Depth = int;
206206

207207
enum : int {
208-
DEPTH_QS_CHECKS = 0,
209-
DEPTH_QS_NO_CHECKS = -1,
210-
DEPTH_QS_RECAPTURES = -5,
208+
DEPTH_QS_CHECKS = 0,
209+
DEPTH_QS_NO_CHECKS = -1,
211210

212211
DEPTH_NONE = -6,
213212

0 commit comments

Comments
 (0)