1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Cleanup code that stores score in TT

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-06-26 10:43:59 +01:00
parent 3c3b129e7b
commit eb48c54687

View file

@ -1443,22 +1443,20 @@ namespace {
if (AbortSearch || TM.thread_should_stop(threadID)) if (AbortSearch || TM.thread_should_stop(threadID))
return bestValue; return bestValue;
if (bestValue <= oldAlpha) ValueType f = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
TT.store(posKey, value_to_tt(bestValue, ply), VALUE_TYPE_UPPER, depth, MOVE_NONE, ss->eval, ei.kingDanger[pos.side_to_move()]); move = (bestValue <= oldAlpha ? MOVE_NONE : ss->pv[0]);
TT.store(posKey, value_to_tt(bestValue, ply), f, depth, move, ss->eval, ei.kingDanger[pos.side_to_move()]);
else if (bestValue >= beta) // Update killers and history only for non capture moves that fails high
if (bestValue >= beta)
{ {
TM.incrementBetaCounter(pos.side_to_move(), depth, threadID); TM.incrementBetaCounter(pos.side_to_move(), depth, threadID);
move = ss->pv[0];
TT.store(posKey, value_to_tt(bestValue, ply), VALUE_TYPE_LOWER, depth, move, ss->eval, ei.kingDanger[pos.side_to_move()]);
if (!pos.move_is_capture_or_promotion(move)) if (!pos.move_is_capture_or_promotion(move))
{ {
update_history(pos, move, depth, movesSearched, moveCount); update_history(pos, move, depth, movesSearched, moveCount);
update_killers(move, ss); update_killers(move, ss);
} }
} }
else
TT.store(posKey, value_to_tt(bestValue, ply), VALUE_TYPE_EXACT, depth, ss->pv[0], ss->eval, ei.kingDanger[pos.side_to_move()]);
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
@ -1628,19 +1626,13 @@ namespace {
// Update transposition table // Update transposition table
Depth d = (depth == Depth(0) ? Depth(0) : Depth(-1)); Depth d = (depth == Depth(0) ? Depth(0) : Depth(-1));
if (bestValue <= oldAlpha) ValueType f = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_UPPER, d, MOVE_NONE, ss->eval, ei.kingDanger[pos.side_to_move()]); TT.store(pos.get_key(), value_to_tt(bestValue, ply), f, d, ss->pv[0], ss->eval, ei.kingDanger[pos.side_to_move()]);
else if (bestValue >= beta)
{
move = ss->pv[0];
TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_LOWER, d, move, ss->eval, ei.kingDanger[pos.side_to_move()]);
// Update killers only for good checking moves // Update killers only for checking moves that fails high
if (!pos.move_is_capture_or_promotion(move)) if ( bestValue >= beta
update_killers(move, ss); && !pos.move_is_capture_or_promotion(ss->pv[0]))
} update_killers(ss->pv[0], ss);
else
TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EXACT, d, ss->pv[0], ss->eval, ei.kingDanger[pos.side_to_move()]);
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
@ -1949,7 +1941,7 @@ namespace {
if (*dangerous) if (*dangerous)
{ {
if (moveIsCheck && pos.see_sign(m)>= 0) if (moveIsCheck && pos.see_sign(m) >= 0)
result += CheckExtension[PvNode]; result += CheckExtension[PvNode];
if (singleEvasion) if (singleEvasion)