Skip to content

Commit

Permalink
Cutoff history
Browse files Browse the repository at this point in the history
Bench: 7618264
  • Loading branch information
SzilBalazs committed Aug 31, 2023
1 parent 7e3ff03 commit 8b85fce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/search/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace search {

public:
chess::Move killer_moves[MAX_PLY + 10][2];
Score cutoffs[MAX_PLY + 10];
chess::Move counter_moves[64][64];
Score butterfly[64][64];

Expand Down
3 changes: 3 additions & 0 deletions src/search/search_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ namespace search {
}

history.killer_moves[ss->ply + 1][0] = history.killer_moves[ss->ply + 1][1] = chess::NULL_MOVE;
history.cutoffs[ss->ply + 1] = 0;

chess::Move quiet_moves[200];
chess::Move *next_quiet_move = quiet_moves;
Expand Down Expand Up @@ -406,6 +407,7 @@ namespace search {

R -= pv_node;
R += !improving;
R += history.cutoffs[ss->ply + 1] > 4;
R -= std::clamp(history.butterfly[move.get_from()][move.get_to()] / 4096, -2, 2);

Depth D = std::clamp(new_depth - R, 1, depth - 1);
Expand Down Expand Up @@ -436,6 +438,7 @@ namespace search {
}

if (score >= beta) {
history.cutoffs[ss->ply]++;

if (move.is_quiet()) {
history.add_cutoff(move, last_move, depth, ss->ply);
Expand Down

0 comments on commit 8b85fce

Please sign in to comment.