Skip to content

Commit 3dda029

Browse files
SEE pruning.
60s+0.6 Score of tucanoNEW vs tucanoOLD: 594 - 512 - 1263 [0.517] 2369 Elo difference: 12.0 +/- 9.5, LOS: 99.3 %, DrawRatio: 53.3 % SPRT: llr 2.98 (101.1%), lbound -2.94, ubound 2.94 - H1 was accepted
1 parent 203f854 commit 3dda029

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define ENGINE "Tucano"
2222
#define AUTHOR "Alcides Schulz"
23-
#define VERSION "11.28"
23+
#define VERSION "11.29"
2424

2525
void develop_workbench(void);
2626
double bench(int depth, int print);

src/search.c

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -234,42 +234,60 @@ int search(GAME *game, UINT incheck, int alpha, int beta, int depth, MOVE exclud
234234
}
235235

236236
// Pruning or depth reductions
237-
if (!root_node && !extensions && move_count > 1 && move_is_quiet(move)) {
237+
if ( !extensions && move_count > 1) {
238238
if (!is_killer_move(&game->move_order, turn, ply, move)) {
239239
if (!is_counter_move(&game->move_order, flip_color(turn), get_last_move_made(&game->board), move)) {
240240
int move_has_bad_history = get_has_bad_history(&game->move_order, turn, move);
241241
// Move count pruning: prune moves based on move count.
242-
if (!pv_node && move_has_bad_history && depth < 8 && !incheck) {
242+
if (!root_node && !pv_node && move_has_bad_history && depth < 8 && !incheck && move_is_quiet(move)) {
243243
int pruning_threshold = 4 + depth * 2;
244244
if (!improving) pruning_threshold = pruning_threshold - 3;
245-
if (move_count > pruning_threshold) continue;
245+
if (move_count > pruning_threshold) {
246+
continue;
247+
}
246248
}
247249
// Futility pruning: eval + margin below beta. Uses beta cutoff history.
248-
if (depth < 8 && (!pv_node || !incheck) && !is_mate_score(alpha)) {
250+
if (!root_node && depth < 8 && (!pv_node || !incheck) && !is_mate_score(alpha) && move_is_quiet(move)) {
249251
int pruning_margin = depth * (50 + get_pruning_margin(&game->move_order, turn, move));
250252
if (eval_score + pruning_margin < alpha) {
251253
continue;
252254
}
253255
}
254-
// Late move reductions: reduce depth for later moves
255-
reductions += reduction_table[MIN(depth, MAX_DEPTH - 1)][MIN(move_count, MAX_MOVE - 1)];
256-
if (!pv_node) {
257-
if (move_has_bad_history || !improving || (incheck && unpack_piece(move) == KING)) reductions++;
258-
if (trans_move != MOVE_NONE && !move_is_quiet(trans_move)) reductions++;
256+
// Pruning based on SEE heuristic.
257+
if (!root_node && depth <= 8 && !incheck) {
258+
int see_margin = 0;
259+
if (move_is_quiet(move)) {
260+
see_margin = -60 * depth;
261+
}
262+
else {
263+
see_margin = -10 * depth * depth;
264+
}
265+
if (see_move(&game->board, move) < see_margin) {
266+
continue;
267+
}
259268
}
260-
else {
261-
if (reductions > 0 && !move_has_bad_history) reductions--;
262-
if (reductions > 0 && incheck) reductions--;
269+
// Late move reductions: reduce depth for later moves
270+
if (move_is_quiet(move)) {
271+
reductions += reduction_table[MIN(depth, MAX_DEPTH - 1)][MIN(move_count, MAX_MOVE - 1)];
272+
if (!pv_node) {
273+
if (move_has_bad_history || !improving || (incheck && unpack_piece(move) == KING)) reductions++;
274+
if (trans_move != MOVE_NONE && !move_is_quiet(trans_move)) reductions++;
275+
}
276+
else {
277+
if (reductions > 0 && !move_has_bad_history) reductions--;
278+
if (reductions > 0 && incheck) reductions--;
279+
if (reductions > 0 && root_node) reductions--;
280+
}
263281
}
264282
}
265283
}
266284
}
267285

268-
if (!root_node && move_count > 5 && !extensions && !incheck && depth < 5 && !move_is_quiet(move)) {
269-
if (best_score + 100 * depth + see_move(&game->board, move) <= alpha) {
270-
continue;
271-
}
272-
}
286+
//if (!root_node && move_count > 5 && !extensions && !incheck && depth < 5 && !move_is_quiet(move)) {
287+
// if (best_score + 100 * depth + see_move(&game->board, move) <= alpha) {
288+
// continue;
289+
// }
290+
//}
273291

274292
// Make move and search new position.
275293
make_move(&game->board, move);

0 commit comments

Comments
 (0)