Skip to content

Commit 40d52a5

Browse files
Change quiesce to use separate depth for positions in check.
10s+0.1 Score of tucanoNEW vs tucanoOLD: 519 - 435 - 1024 [0.521] 1978 Elo difference: 14.8 +/- 10.6, LOS: 99.7 %, DrawRatio: 51.8 % SPRT: llr 2.95 (100.3%), lbound -2.94, ubound 2.94 - H1 was accepted 60s+0.6 Score of tucanoNEW vs tucanoOLD: 831 - 754 - 2037 [0.511] 3622 Elo difference: 7.4 +/- 7.5, LOS: 97.3 %, DrawRatio: 56.2 % SPRT: llr 2.98 (101.2%), lbound -2.94, ubound 2.94 - H1 was accepted
1 parent 0d82834 commit 40d52a5

File tree

4 files changed

+36
-18
lines changed

4 files changed

+36
-18
lines changed

src/main.c

Lines changed: 4 additions & 4 deletions
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.30"
23+
#define VERSION "11.31"
2424

2525
void develop_workbench(void);
2626
double bench(int depth, int print);
@@ -626,9 +626,9 @@ void generate_plain_files(char *pgn_file_list);
626626

627627
void develop_workbench(void)
628628
{
629-
//generate_replay("D:/Projetos/YoutubeChanels/TucanoTestGames/GamesDone/game0013_ExposedKing.pgn",
630-
// "D:/Projetos/YoutubeChanels/TucanoTestGames/GamesDone/replay0013.txt");
631-
tnn_generate_menu();
629+
//generate_replay("D:/Projetos/YoutubeChanels/TucanoGamesChannel/GamesDone/game0014_Sacrifices.pgn",
630+
// "D:/Projetos/YoutubeChanels/TucanoGamesChannel/GamesDone/replay0014.txt");
631+
//tnn_generate_menu();
632632
//extract_good_games("d:/temp/a.pgn");
633633
}
634634

src/search.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ int search(GAME *game, UINT incheck, int alpha, int beta, int depth, MOVE exclud
6666
tt_read(game->board.key, &tt_record);
6767
if (!pv_node && tt_record.data && tt_record.info.depth >= depth && exclude_move == MOVE_NONE) {
6868
int score = score_from_tt(tt_record.info.score, ply);
69-
if (tt_record.info.flag == TT_EXACT) return score;
70-
if (score >= beta && tt_record.info.flag == TT_LOWER) return score;
71-
if (score <= alpha && tt_record.info.flag == TT_UPPER) return score;
69+
if (tt_record.info.flag == TT_EXACT) {
70+
return score;
71+
}
72+
if (score >= beta && tt_record.info.flag == TT_LOWER) {
73+
return score;
74+
}
75+
if (score <= alpha && tt_record.info.flag == TT_UPPER) {
76+
return score;
77+
}
7278
}
7379
MOVE trans_move = tt_record.info.move;
7480

src/search_quiesce.c

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int quiesce(GAME *game, UINT incheck, int alpha, int beta, int depth)
3333
int ply = get_ply(&game->board);
3434
int gives_check;
3535
MOVE best_move = MOVE_NONE;
36-
36+
3737
assert(alpha <= beta);
3838

3939
check_time(game);
@@ -52,21 +52,33 @@ int quiesce(GAME *game, UINT incheck, int alpha, int beta, int depth)
5252
beta = MIN(MATE_VALUE - ply, beta);
5353
if (alpha >= beta) return alpha;
5454

55+
S8 quiesce_depth = incheck || depth >= 0 ? 0 : -1;
56+
5557
// transposition table score or move hint
5658
TT_RECORD tt_record;
5759
tt_read(game->board.key, &tt_record);
58-
if (tt_record.data) {
60+
if (tt_record.data && tt_record.info.depth >= quiesce_depth) {
5961
score = score_from_tt(tt_record.info.score, game->board.ply);
60-
if (tt_record.info.flag == TT_EXACT) return score;
61-
if (score >= beta && tt_record.info.flag == TT_LOWER) return score;
62-
if (score <= alpha && tt_record.info.flag == TT_UPPER) return score;
62+
if (tt_record.info.flag == TT_EXACT) {
63+
return score;
64+
}
65+
if (score >= beta && tt_record.info.flag == TT_LOWER) {
66+
return score;
67+
}
68+
if (score <= alpha && tt_record.info.flag == TT_UPPER) {
69+
return score;
70+
}
6371
}
6472
MOVE trans_move = tt_record.info.move;
6573

6674
if (!incheck) {
6775
best_score = evaluate(game);
68-
if (best_score >= beta) return best_score;
69-
if (best_score > alpha) alpha = best_score;
76+
if (best_score >= beta) {
77+
return best_score;
78+
}
79+
if (best_score > alpha) {
80+
alpha = best_score;
81+
}
7082
}
7183

7284
select_init(&ml, game, incheck, trans_move, TRUE);
@@ -112,7 +124,7 @@ int quiesce(GAME *game, UINT incheck, int alpha, int beta, int depth)
112124
update_pv(&game->pv_line, ply, move);
113125
if (score >= beta) {
114126
tt_record.info.move = move;
115-
tt_record.info.depth = 0;
127+
tt_record.info.depth = quiesce_depth;
116128
tt_record.info.flag = TT_LOWER;
117129
tt_record.info.score = score_to_tt(score, ply);
118130
tt_save(game->board.key, &tt_record);
@@ -132,13 +144,13 @@ int quiesce(GAME *game, UINT incheck, int alpha, int beta, int depth)
132144

133145
if (best_move != MOVE_NONE) {
134146
tt_record.info.move = best_move;
135-
tt_record.info.depth = 0;
147+
tt_record.info.depth = quiesce_depth;
136148
tt_record.info.flag = TT_EXACT;
137149
tt_record.info.score = score_to_tt(best_score, ply);
138150
}
139151
else {
140152
tt_record.info.move = MOVE_NONE;
141-
tt_record.info.depth = 0;
153+
tt_record.info.depth = quiesce_depth;
142154
tt_record.info.flag = TT_UPPER;
143155
tt_record.info.score = score_to_tt(best_score, ply);
144156
}

src/utils_pgn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ void generate_replay(char *input_pgn, char *output_pgn)
588588
}
589589

590590
if (!pgn_open(&pgn_file, input_pgn)) {
591-
fprintf(stderr, "cannot open file: %s\n", input_pgn);
591+
fprintf(stderr, "cannot open file: '%s'\n", input_pgn);
592592
return;
593593
}
594594

0 commit comments

Comments
 (0)