Skip to content

Commit

Permalink
razor-yet-again (#194)
Browse files Browse the repository at this point in the history
Elo   | 3.02 +- 2.17 (95%)
SPRT  | 8.0+0.08s Threads=1 Hash=32MB
LLR   | 2.96 (-2.94, 2.94) [0.00, 3.00]
Games | N: 29826 W: 7539 L: 7280 D: 15007
Penta | [214, 3517, 7196, 3768, 218]
http://chess.grantnet.us/test/37981/
Elo   | 4.15 +- 2.57 (95%)
SPRT  | 40.0+0.40s Threads=1 Hash=64MB
LLR   | 2.95 (-2.94, 2.94) [0.00, 3.00]
Games | N: 17248 W: 4316 L: 4110 D: 8822
Penta | [26, 1903, 4570, 2089, 36]
http://chess.grantnet.us/test/37987/
bench: 3697998
  • Loading branch information
connormcmonigle authored Aug 27, 2024
1 parent fb6c428 commit bb4ebcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/search/search_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ using see_type = std::int32_t;

inline constexpr std::size_t nodes_per_update = 512;

struct fixed_search_constants {
struct fixed_search_constants final {
static constexpr bool tuning = false;
static constexpr depth_type lmr_tbl_dim = 64;
std::size_t thread_count_;
Expand Down Expand Up @@ -151,6 +151,9 @@ struct fixed_search_constants {
[[nodiscard]] constexpr depth_type probcut_search_depth(const depth_type& depth) const noexcept { return depth - 3; }
[[nodiscard]] constexpr score_type probcut_beta(const score_type& beta) const noexcept { return beta + 315; }

[[nodiscard]] constexpr depth_type razor_depth() const noexcept { return 3; }
[[nodiscard]] constexpr score_type razor_margin(const depth_type& depth) const noexcept { return 896 * depth; }

[[maybe_unused]] fixed_search_constants& update_(const std::size_t& thread_count) noexcept {
thread_count_ = thread_count;
for (depth_type depth{1}; depth < lmr_tbl_dim; ++depth) {
Expand Down
8 changes: 8 additions & 0 deletions src/search/search_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ pv_search_result_t<is_root> search_worker::pv_search(
const bool improving = !is_check && ss.improving();
const chess::square_set threatened = bd.them_threat_mask();

const bool try_razor = !is_pv && !is_check && !ss.has_excluded() && depth <= external.constants->razor_depth() &&
value + external.constants->razor_margin(depth) <= alpha;

if (try_razor) {
const score_type razor_score = q_search<false>(ss, eval_node, bd, alpha, alpha + 1, 0);
if (razor_score <= alpha) { return make_result(razor_score, chess::move::null()); }
}

// step 7. static null move pruning
const bool snm_prune = !is_pv && !ss.has_excluded() && !is_check && depth <= external.constants->snmp_depth() &&
value > beta + external.constants->snmp_margin(improving, threatened.any(), depth) && value > ss.loss_score();
Expand Down

0 comments on commit bb4ebcf

Please sign in to comment.