mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39:36 +00:00
Implement calculate_reduction function
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
2360c8aa2f
commit
548bae80bd
1 changed files with 15 additions and 0 deletions
|
@ -286,6 +286,7 @@ namespace {
|
||||||
bool ok_to_prune(const Position& pos, Move m, Move threat);
|
bool ok_to_prune(const Position& pos, Move m, Move threat);
|
||||||
bool ok_to_use_TT(const TTEntry* tte, Depth depth, Value beta, int ply);
|
bool ok_to_use_TT(const TTEntry* tte, Depth depth, Value beta, int ply);
|
||||||
Value refine_eval(const TTEntry* tte, Value defaultEval, int ply);
|
Value refine_eval(const TTEntry* tte, Value defaultEval, int ply);
|
||||||
|
Depth calculate_reduction(double baseReduction, int moveCount, Depth depth, double reductionInhibitor);
|
||||||
void update_history(const Position& pos, Move move, Depth depth, Move movesSearched[], int moveCount);
|
void update_history(const Position& pos, Move move, Depth depth, Move movesSearched[], int moveCount);
|
||||||
void update_killers(Move m, SearchStack& ss);
|
void update_killers(Move m, SearchStack& ss);
|
||||||
void update_gains(const Position& pos, Move move, Value before, Value after);
|
void update_gains(const Position& pos, Move move, Value before, Value after);
|
||||||
|
@ -2679,6 +2680,20 @@ namespace {
|
||||||
return defaultEval;
|
return defaultEval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate_reduction() returns reduction in plies based on
|
||||||
|
// moveCount and depth. Reduction is always at least one ply.
|
||||||
|
|
||||||
|
Depth calculate_reduction(double baseReduction, int moveCount, Depth depth, double reductionInhibitor) {
|
||||||
|
|
||||||
|
double red = baseReduction + ln(moveCount) * ln(depth / 2) / reductionInhibitor;
|
||||||
|
|
||||||
|
if (red >= 1.0)
|
||||||
|
return Depth(int(floor(red * int(OnePly))));
|
||||||
|
else
|
||||||
|
return Depth(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// update_history() registers a good move that produced a beta-cutoff
|
// update_history() registers a good move that produced a beta-cutoff
|
||||||
// in history and marks as failures all the other moves of that ply.
|
// in history and marks as failures all the other moves of that ply.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue