Skip to content

Commit ae753b6

Browse files
committed
Removed branching for late move pruning and see pruning
1 parent e5719ea commit ae753b6

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/search.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ std::atomic<bool> exit_thread_flag;
1010
TimeManager tm;
1111
bool nullMoveTree;
1212

13+
int seePruningMargin[4] = {0, 0, -350, -500};
14+
int lateMoveMargin[2][4] = {{0, 5, 8, 13}, {0, 7, 10, 17}};
15+
16+
1317
extern int pieceValues[6];
1418
extern MovePick *movePick;
1519
extern MoveGen *moveGen;
@@ -252,28 +256,15 @@ int pvSearch(Bitboard &b, int depth, int alpha, int beta, bool canNullMove, int
252256
}
253257

254258
// Late move pruning
255-
if (depth == 1 && quietsSearched > (improving? 7 : 5)) {
256-
continue;
257-
}
258-
else if (depth == 2 && quietsSearched > (improving? 10 : 8)) {
259-
continue;
260-
}
261-
else if (depth == 3 && quietsSearched > (improving? 17 : 13)) {
259+
if (depth <= 3 && quietsSearched > lateMoveMargin[improving][depth]) {
262260
continue;
263261
}
262+
264263
}
265264

266265
// SEE pruning
267-
if (depth <= 3 && numMoves > 0 && (move & PROMOTION_FLAG) == 0) {
268-
if (depth == 1 && b.seeCapture(move) < 0) {
269-
continue;
270-
}
271-
else if (depth == 2 && b.seeCapture(move) < -350) {
272-
continue;
273-
}
274-
else if (depth == 3 && b.seeCapture(move) < -500) {
275-
continue;
276-
}
266+
if (depth <= 3 && numMoves > 0 && (move & PROMOTION_FLAG) == 0 && b.seeCapture(move) < seePruningMargin[depth]) {
267+
continue;
277268
}
278269
}
279270

0 commit comments

Comments
 (0)