Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider improving for LMP #124

Merged
merged 3 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@

int lmr_reductions_array[64][64]{0};

std::atomic_bool SEARCH_ABORT = ATOMIC_VAR_INIT(false);
int lmp_margin[64][2]{0};
int quiet_lmp_margin[64]{0};

constexpr int see_pruning_margins[5] {
constexpr int see_pruning_margins[5]
{
0, -100, -100, -300, -325
};

Expand Down Expand Up @@ -168,6 +170,9 @@ namespace
}

int eval = tthit ? entry.seval : eval_position(position);
search.eval[search.stats.ply] = eval;

bool improving = eval > search.eval[std::max(0, search.stats.ply - 2)];

if (!at_root && !in_check && depth < 6 && (eval - depth * 170) >= beta)
return eval;
Expand All @@ -192,10 +197,10 @@ namespace

for (Move move; picker.next(move);)
{
if (move_num > 3 + depth * depth)
if (move_num > lmp_margin[depth][improving])
picker.skip_quiets = true;

if (picker.stage >= MovePicker::Stage::GiveQuiet && move_num > depth * depth + 2)
if (picker.stage >= MovePicker::Stage::GiveQuiet && move_num > quiet_lmp_margin[depth])
break;

if (depth < 5 && move_is_capture(position, move) && move.score < see_pruning_margins[depth])
Expand Down Expand Up @@ -343,6 +348,10 @@ namespace Search
{
lmr_reductions_array[i][j] = log(i) * log(j);
}

lmp_margin[i][1] = 3 + 2 * i * i;
lmp_margin[i][0] = 3 + i * i / 1.5;
quiet_lmp_margin[i] = 2 + i * i;
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ namespace Search
HistoryTable history = {0};
HistoryTable capture_history = {0};

int eval[64] = {0};

void update();
};

void init();
uint64_t bestmove(Info&, bool log);
}

extern std::atomic_bool SEARCH_ABORT;
inline std::atomic_bool SEARCH_ABORT = ATOMIC_VAR_INIT(false);
2 changes: 1 addition & 1 deletion src/uci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "polyglot.h"
#include <cstring>

const char *version = "7.41";
const char *version = "7.42";

namespace
{
Expand Down