mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Penalty for a quiet ttMove that fails low
Also the penalty/bonus function is misleading, we should simply change it to stat_bonus(depth) for bonus and -stat_bonus(depth+ ONE_PLY) for extra penalty. STC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 11656 W: 2183 L: 2008 D: 7465 LTC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 11152 W: 1531 L: 1377 D: 8244 Bench: 6101931
This commit is contained in:
parent
471f7a1b5c
commit
5254a6040c
1 changed files with 26 additions and 13 deletions
|
@ -75,6 +75,12 @@ namespace {
|
||||||
return Reductions[PvNode][i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] * ONE_PLY;
|
return Reductions[PvNode][i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] * ONE_PLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// History and stats update bonus, based on depth
|
||||||
|
Value stat_bonus(Depth depth) {
|
||||||
|
int d = depth / ONE_PLY ;
|
||||||
|
return Value(d * d + 2 * d - 2);
|
||||||
|
}
|
||||||
|
|
||||||
// Skill structure is used to implement strength limit
|
// Skill structure is used to implement strength limit
|
||||||
struct Skill {
|
struct Skill {
|
||||||
Skill(int l) : level(l) {}
|
Skill(int l) : level(l) {}
|
||||||
|
@ -155,9 +161,6 @@ namespace {
|
||||||
|
|
||||||
const size_t HalfDensitySize = std::extent<decltype(HalfDensity)>::value;
|
const size_t HalfDensitySize = std::extent<decltype(HalfDensity)>::value;
|
||||||
|
|
||||||
Value bonus(Depth depth) { int d = depth / ONE_PLY ; return Value(d * d + 2 * d - 2); }
|
|
||||||
Value penalty(Depth depth) { int d = depth / ONE_PLY ; return -Value(d * d + 4 * d + 1); }
|
|
||||||
|
|
||||||
EasyMoveManager EasyMove;
|
EasyMoveManager EasyMove;
|
||||||
Value DrawValue[COLOR_NB];
|
Value DrawValue[COLOR_NB];
|
||||||
|
|
||||||
|
@ -642,14 +645,24 @@ namespace {
|
||||||
: (tte->bound() & BOUND_UPPER)))
|
: (tte->bound() & BOUND_UPPER)))
|
||||||
{
|
{
|
||||||
// If ttMove is quiet, update move sorting heuristics on TT hit
|
// If ttMove is quiet, update move sorting heuristics on TT hit
|
||||||
if (ttValue >= beta && ttMove)
|
if (ttMove)
|
||||||
{
|
{
|
||||||
if (!pos.capture_or_promotion(ttMove))
|
if (ttValue >= beta)
|
||||||
update_stats(pos, ss, ttMove, nullptr, 0, bonus(depth));
|
{
|
||||||
|
if (!pos.capture_or_promotion(ttMove))
|
||||||
|
update_stats(pos, ss, ttMove, nullptr, 0, stat_bonus(depth));
|
||||||
|
|
||||||
// Extra penalty for a quiet TT move in previous ply when it gets refuted
|
// Extra penalty for a quiet TT move in previous ply when it gets refuted
|
||||||
if ((ss-1)->moveCount == 1 && !pos.captured_piece())
|
if ((ss-1)->moveCount == 1 && !pos.captured_piece())
|
||||||
update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, penalty(depth));
|
update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, -stat_bonus(depth + ONE_PLY));
|
||||||
|
}
|
||||||
|
// Penalty for a quiet ttMove that fails low
|
||||||
|
else if (ttValue < alpha && !pos.capture_or_promotion(ttMove))
|
||||||
|
{
|
||||||
|
Value penalty = -stat_bonus(depth + ONE_PLY);
|
||||||
|
thisThread->history.update(pos.side_to_move(), ttMove, penalty);
|
||||||
|
update_cm_stats(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ttValue;
|
return ttValue;
|
||||||
}
|
}
|
||||||
|
@ -988,7 +1001,7 @@ moves_loop: // When in check search starts from here
|
||||||
+ (fmh ? (*fmh )[moved_piece][to_sq(move)] : VALUE_ZERO)
|
+ (fmh ? (*fmh )[moved_piece][to_sq(move)] : VALUE_ZERO)
|
||||||
+ (fmh2 ? (*fmh2)[moved_piece][to_sq(move)] : VALUE_ZERO)
|
+ (fmh2 ? (*fmh2)[moved_piece][to_sq(move)] : VALUE_ZERO)
|
||||||
+ thisThread->history.get(~pos.side_to_move(), move)
|
+ thisThread->history.get(~pos.side_to_move(), move)
|
||||||
- 8000; // Correction factor
|
- 4000; // Correction factor
|
||||||
|
|
||||||
// Decrease/increase reduction by comparing opponent's stat score
|
// Decrease/increase reduction by comparing opponent's stat score
|
||||||
if (ss->history > VALUE_ZERO && (ss-1)->history < VALUE_ZERO)
|
if (ss->history > VALUE_ZERO && (ss-1)->history < VALUE_ZERO)
|
||||||
|
@ -1120,17 +1133,17 @@ moves_loop: // When in check search starts from here
|
||||||
|
|
||||||
// Quiet best move: update move sorting heuristics
|
// Quiet best move: update move sorting heuristics
|
||||||
if (!pos.capture_or_promotion(bestMove))
|
if (!pos.capture_or_promotion(bestMove))
|
||||||
update_stats(pos, ss, bestMove, quietsSearched, quietCount, bonus(depth));
|
update_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth));
|
||||||
|
|
||||||
// Extra penalty for a quiet TT move in previous ply when it gets refuted
|
// Extra penalty for a quiet TT move in previous ply when it gets refuted
|
||||||
if ((ss-1)->moveCount == 1 && !pos.captured_piece())
|
if ((ss-1)->moveCount == 1 && !pos.captured_piece())
|
||||||
update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, penalty(depth));
|
update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, -stat_bonus(depth + ONE_PLY));
|
||||||
}
|
}
|
||||||
// Bonus for prior countermove that caused the fail low
|
// Bonus for prior countermove that caused the fail low
|
||||||
else if ( depth >= 3 * ONE_PLY
|
else if ( depth >= 3 * ONE_PLY
|
||||||
&& !pos.captured_piece()
|
&& !pos.captured_piece()
|
||||||
&& is_ok((ss-1)->currentMove))
|
&& is_ok((ss-1)->currentMove))
|
||||||
update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, bonus(depth));
|
update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth));
|
||||||
|
|
||||||
tte->save(posKey, value_to_tt(bestValue, ss->ply),
|
tte->save(posKey, value_to_tt(bestValue, ss->ply),
|
||||||
bestValue >= beta ? BOUND_LOWER :
|
bestValue >= beta ? BOUND_LOWER :
|
||||||
|
|
Loading…
Add table
Reference in a new issue