mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Coding style in TT code
In particular seems more natural to return bool and TTEntry on the same line, actually we should pass and return them as a pair, but due to limitations of C++ and not wanting to use std::pair this can be an acceptable compromise. No functional change. Resolves #157
This commit is contained in:
committed by
Joona Kiiski
parent
0edb6348d2
commit
413b243809
@@ -458,13 +458,12 @@ namespace {
|
||||
Move pv[MAX_PLY+1], quietsSearched[64];
|
||||
StateInfo st;
|
||||
TTEntry* tte;
|
||||
bool ttHit;
|
||||
SplitPoint* splitPoint;
|
||||
Key posKey;
|
||||
Move ttMove, move, excludedMove, bestMove;
|
||||
Depth extension, newDepth, predictedDepth;
|
||||
Value bestValue, value, ttValue, eval, nullValue, futilityValue;
|
||||
bool inCheck, givesCheck, singularExtensionNode, improving;
|
||||
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
|
||||
bool captureOrPromotion, dangerous, doFullDepthSearch;
|
||||
int moveCount, quietCount;
|
||||
|
||||
@@ -568,7 +567,7 @@ namespace {
|
||||
|
||||
tte->save(posKey, value_to_tt(value, ss->ply), BOUND_EXACT,
|
||||
std::min(DEPTH_MAX - ONE_PLY, depth + 6 * ONE_PLY),
|
||||
MOVE_NONE, VALUE_NONE, TT.get_generation());
|
||||
MOVE_NONE, VALUE_NONE, TT.generation());
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -598,7 +597,7 @@ namespace {
|
||||
eval = ss->staticEval =
|
||||
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss-1)->staticEval + 2 * Eval::Tempo;
|
||||
|
||||
tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.get_generation());
|
||||
tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.generation());
|
||||
}
|
||||
|
||||
if (ss->skipEarlyPruning)
|
||||
@@ -1084,7 +1083,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply),
|
||||
bestValue >= beta ? BOUND_LOWER :
|
||||
PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER,
|
||||
depth, bestMove, ss->staticEval, TT.get_generation());
|
||||
depth, bestMove, ss->staticEval, TT.generation());
|
||||
|
||||
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
||||
|
||||
@@ -1110,11 +1109,10 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
Move pv[MAX_PLY+1];
|
||||
StateInfo st;
|
||||
TTEntry* tte;
|
||||
bool ttHit;
|
||||
Key posKey;
|
||||
Move ttMove, move, bestMove;
|
||||
Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha;
|
||||
bool givesCheck, evasionPrunable;
|
||||
bool ttHit, givesCheck, evasionPrunable;
|
||||
Depth ttDepth;
|
||||
|
||||
if (PvNode)
|
||||
@@ -1184,7 +1182,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
{
|
||||
if (!ttHit)
|
||||
tte->save(pos.key(), value_to_tt(bestValue, ss->ply), BOUND_LOWER,
|
||||
DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.get_generation());
|
||||
DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.generation());
|
||||
|
||||
return bestValue;
|
||||
}
|
||||
@@ -1283,7 +1281,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
else // Fail high
|
||||
{
|
||||
tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER,
|
||||
ttDepth, move, ss->staticEval, TT.get_generation());
|
||||
ttDepth, move, ss->staticEval, TT.generation());
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -1298,7 +1296,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
|
||||
tte->save(posKey, value_to_tt(bestValue, ss->ply),
|
||||
PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER,
|
||||
ttDepth, bestMove, ss->staticEval, TT.get_generation());
|
||||
ttDepth, bestMove, ss->staticEval, TT.generation());
|
||||
|
||||
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
||||
|
||||
@@ -1480,7 +1478,7 @@ void RootMove::insert_pv_in_tt(Position& pos) {
|
||||
TTEntry* tte = TT.probe(pos.key(), ttHit);
|
||||
|
||||
if (!ttHit || tte->move() != pv[idx]) // Don't overwrite correct entries
|
||||
tte->save(pos.key(), VALUE_NONE, BOUND_NONE, DEPTH_NONE, pv[idx], VALUE_NONE, TT.get_generation());
|
||||
tte->save(pos.key(), VALUE_NONE, BOUND_NONE, DEPTH_NONE, pv[idx], VALUE_NONE, TT.generation());
|
||||
|
||||
assert(MoveList<LEGAL>(pos).contains(pv[idx]));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user