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

Use TT in qsearch

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2008-09-09 07:37:46 +02:00
parent bc4e937f05
commit a10c9632a5

View file

@ -1299,6 +1299,11 @@ namespace {
if (pos.is_draw()) if (pos.is_draw())
return VALUE_DRAW; return VALUE_DRAW;
// Transposition table lookup
const TTEntry* tte = TT.retrieve(pos);
if (tte && ok_to_use_TT(tte, depth, beta, ply))
return value_from_tt(tte->value(), ply);
// Evaluate the position statically: // Evaluate the position statically:
Value staticValue = evaluate(pos, ei, threadID); Value staticValue = evaluate(pos, ei, threadID);
@ -1396,6 +1401,9 @@ namespace {
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
// Update transposition table
TT.store(pos, value_to_tt(bestValue, ply), depth, MOVE_NONE, VALUE_TYPE_EXACT);
return bestValue; return bestValue;
} }