mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Save futilityMargin for both colors
It will be needed by future patches. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
06a695d5b8
commit
35ada63174
3 changed files with 7 additions and 10 deletions
|
@ -860,11 +860,8 @@ namespace {
|
||||||
// capturing a single attacking piece can therefore result in a score
|
// capturing a single attacking piece can therefore result in a score
|
||||||
// change far bigger than the value of the captured piece.
|
// change far bigger than the value of the captured piece.
|
||||||
Score v = apply_weight(make_score(SafetyTable[attackUnits], 0), WeightKingSafety[Us]);
|
Score v = apply_weight(make_score(SafetyTable[attackUnits], 0), WeightKingSafety[Us]);
|
||||||
|
|
||||||
ei.value -= Sign[Us] * v;
|
ei.value -= Sign[Us] * v;
|
||||||
|
ei.futilityMargin[Us] += mg_value(v);
|
||||||
if (Us == pos.side_to_move())
|
|
||||||
ei.futilityMargin += mg_value(v);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Position;
|
||||||
|
|
||||||
struct EvalInfo {
|
struct EvalInfo {
|
||||||
|
|
||||||
EvalInfo() : futilityMargin(Value(0)) {}
|
EvalInfo() { futilityMargin[0] = futilityMargin[1] = Value(0); }
|
||||||
|
|
||||||
// Middle game and endgame evaluations
|
// Middle game and endgame evaluations
|
||||||
Score value;
|
Score value;
|
||||||
|
@ -96,8 +96,8 @@ struct EvalInfo {
|
||||||
Score mobility;
|
Score mobility;
|
||||||
|
|
||||||
// Extra futility margin. This is added to the standard futility margin
|
// Extra futility margin. This is added to the standard futility margin
|
||||||
// in the quiescence search.
|
// in the quiescence search. One for each color.
|
||||||
Value futilityMargin;
|
Value futilityMargin[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1821,7 +1821,7 @@ namespace {
|
||||||
if (bestValue >= beta)
|
if (bestValue >= beta)
|
||||||
{
|
{
|
||||||
// Store the score to avoid a future costly evaluation() call
|
// Store the score to avoid a future costly evaluation() call
|
||||||
if (!isCheck && !tte && ei.futilityMargin == 0)
|
if (!isCheck && !tte && ei.futilityMargin[pos.side_to_move()] == 0)
|
||||||
TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EV_LO, Depth(-127*OnePly), MOVE_NONE);
|
TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EV_LO, Depth(-127*OnePly), MOVE_NONE);
|
||||||
|
|
||||||
return bestValue;
|
return bestValue;
|
||||||
|
@ -1840,7 +1840,7 @@ namespace {
|
||||||
MovePicker mp = MovePicker(pos, ttMove, deepChecks ? Depth(0) : depth, H);
|
MovePicker mp = MovePicker(pos, ttMove, deepChecks ? Depth(0) : depth, H);
|
||||||
CheckInfo ci(pos);
|
CheckInfo ci(pos);
|
||||||
enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
|
enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
|
||||||
futilityBase = staticValue + FutilityMarginQS + ei.futilityMargin;
|
futilityBase = staticValue + FutilityMarginQS + ei.futilityMargin[pos.side_to_move()];
|
||||||
|
|
||||||
// Loop through the moves until no moves remain or a beta cutoff
|
// Loop through the moves until no moves remain or a beta cutoff
|
||||||
// occurs.
|
// occurs.
|
||||||
|
@ -1920,7 +1920,7 @@ namespace {
|
||||||
{
|
{
|
||||||
// If bestValue isn't changed it means it is still the static evaluation
|
// If bestValue isn't changed it means it is still the static evaluation
|
||||||
// of the node, so keep this info to avoid a future evaluation() call.
|
// of the node, so keep this info to avoid a future evaluation() call.
|
||||||
ValueType type = (bestValue == staticValue && !ei.futilityMargin ? VALUE_TYPE_EV_UP : VALUE_TYPE_UPPER);
|
ValueType type = (bestValue == staticValue && !ei.futilityMargin[pos.side_to_move()] ? VALUE_TYPE_EV_UP : VALUE_TYPE_UPPER);
|
||||||
TT.store(pos.get_key(), value_to_tt(bestValue, ply), type, d, MOVE_NONE);
|
TT.store(pos.get_key(), value_to_tt(bestValue, ply), type, d, MOVE_NONE);
|
||||||
}
|
}
|
||||||
else if (bestValue >= beta)
|
else if (bestValue >= beta)
|
||||||
|
|
Loading…
Add table
Reference in a new issue