mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39:36 +00:00
Don't save eval score in TT
This patch completes the removal of eval info in TT table. No functional change.
This commit is contained in:
parent
2a585b63b8
commit
98cd8239cc
3 changed files with 12 additions and 28 deletions
|
@ -1037,8 +1037,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
if (bestValue >= beta) // Failed high
|
if (bestValue >= beta) // Failed high
|
||||||
{
|
{
|
||||||
TT.store(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER, depth,
|
TT.store(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER, depth, bestMove);
|
||||||
bestMove, ss->staticEval, ss->evalMargin);
|
|
||||||
|
|
||||||
if (!pos.is_capture_or_promotion(bestMove) && !inCheck)
|
if (!pos.is_capture_or_promotion(bestMove) && !inCheck)
|
||||||
{
|
{
|
||||||
|
@ -1063,7 +1062,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
else // Failed low or PV search
|
else // Failed low or PV search
|
||||||
TT.store(posKey, value_to_tt(bestValue, ss->ply),
|
TT.store(posKey, value_to_tt(bestValue, ss->ply),
|
||||||
PvNode && bestMove != MOVE_NONE ? BOUND_EXACT : BOUND_UPPER,
|
PvNode && bestMove != MOVE_NONE ? BOUND_EXACT : BOUND_UPPER,
|
||||||
depth, bestMove, ss->staticEval, ss->evalMargin);
|
depth, bestMove);
|
||||||
|
|
||||||
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
||||||
|
|
||||||
|
@ -1143,8 +1142,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
if (bestValue >= beta)
|
if (bestValue >= beta)
|
||||||
{
|
{
|
||||||
if (!tte)
|
if (!tte)
|
||||||
TT.store(pos.key(), value_to_tt(bestValue, ss->ply), BOUND_LOWER,
|
TT.store(pos.key(), value_to_tt(bestValue, ss->ply), BOUND_LOWER, DEPTH_NONE, MOVE_NONE);
|
||||||
DEPTH_NONE, MOVE_NONE, ss->staticEval, ss->evalMargin);
|
|
||||||
|
|
||||||
return bestValue;
|
return bestValue;
|
||||||
}
|
}
|
||||||
|
@ -1252,9 +1250,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
}
|
}
|
||||||
else // Fail high
|
else // Fail high
|
||||||
{
|
{
|
||||||
TT.store(posKey, value_to_tt(value, ss->ply), BOUND_LOWER,
|
TT.store(posKey, value_to_tt(value, ss->ply), BOUND_LOWER, ttDepth, move);
|
||||||
ttDepth, move, ss->staticEval, ss->evalMargin);
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1268,7 +1264,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
TT.store(posKey, value_to_tt(bestValue, ss->ply),
|
TT.store(posKey, value_to_tt(bestValue, ss->ply),
|
||||||
PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER,
|
PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER,
|
||||||
ttDepth, bestMove, ss->staticEval, ss->evalMargin);
|
ttDepth, bestMove);
|
||||||
|
|
||||||
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
||||||
|
|
||||||
|
@ -1559,20 +1555,12 @@ void RootMove::insert_pv_in_tt(Position& pos) {
|
||||||
StateInfo state[MAX_PLY_PLUS_2], *st = state;
|
StateInfo state[MAX_PLY_PLUS_2], *st = state;
|
||||||
TTEntry* tte;
|
TTEntry* tte;
|
||||||
int ply = 0;
|
int ply = 0;
|
||||||
Value v, m;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
tte = TT.probe(pos.key());
|
tte = TT.probe(pos.key());
|
||||||
|
|
||||||
if (!tte || tte->move() != pv[ply]) // Don't overwrite correct entries
|
if (!tte || tte->move() != pv[ply]) // Don't overwrite correct entries
|
||||||
{
|
TT.store(pos.key(), VALUE_NONE, BOUND_NONE, DEPTH_NONE, pv[ply]);
|
||||||
if (pos.in_check())
|
|
||||||
v = m = VALUE_NONE;
|
|
||||||
else
|
|
||||||
v = evaluate(pos, m);
|
|
||||||
|
|
||||||
TT.store(pos.key(), VALUE_NONE, BOUND_NONE, DEPTH_NONE, pv[ply], v, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(pos.move_is_legal(pv[ply]));
|
assert(pos.move_is_legal(pv[ply]));
|
||||||
pos.do_move(pv[ply++], *st++);
|
pos.do_move(pv[ply++], *st++);
|
||||||
|
|
|
@ -82,7 +82,7 @@ void TranspositionTable::clear() {
|
||||||
/// more valuable than a TTEntry t2 if t1 is from the current search and t2 is from
|
/// more valuable than a TTEntry t2 if t1 is from the current search and t2 is from
|
||||||
/// a previous search, or if the depth of t1 is bigger than the depth of t2.
|
/// a previous search, or if the depth of t1 is bigger than the depth of t2.
|
||||||
|
|
||||||
void TranspositionTable::store(const Key posKey, Value v, Bound t, Depth d, Move m, Value statV, Value kingD) {
|
void TranspositionTable::store(const Key posKey, Value v, Bound t, Depth d, Move m) {
|
||||||
|
|
||||||
int c1, c2, c3;
|
int c1, c2, c3;
|
||||||
TTEntry *tte, *replace;
|
TTEntry *tte, *replace;
|
||||||
|
@ -98,7 +98,7 @@ void TranspositionTable::store(const Key posKey, Value v, Bound t, Depth d, Move
|
||||||
if (m == MOVE_NONE)
|
if (m == MOVE_NONE)
|
||||||
m = tte->move();
|
m = tte->move();
|
||||||
|
|
||||||
tte->save(posKey32, v, t, d, m, generation, statV, kingD);
|
tte->save(posKey32, v, t, d, m, generation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void TranspositionTable::store(const Key posKey, Value v, Bound t, Depth d, Move
|
||||||
if (c1 + c2 + c3 > 0)
|
if (c1 + c2 + c3 > 0)
|
||||||
replace = tte;
|
replace = tte;
|
||||||
}
|
}
|
||||||
replace->save(posKey32, v, t, d, m, generation, statV, kingD);
|
replace->save(posKey32, v, t, d, m, generation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
10
src/tt.h
10
src/tt.h
|
@ -44,7 +44,7 @@
|
||||||
class TTEntry {
|
class TTEntry {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void save(uint32_t k, Value v, Bound b, Depth d, Move m, int g, Value statV, Value statM) {
|
void save(uint32_t k, Value v, Bound b, Depth d, Move m, int g) {
|
||||||
|
|
||||||
key32 = (uint32_t)k;
|
key32 = (uint32_t)k;
|
||||||
move16 = (uint16_t)m;
|
move16 = (uint16_t)m;
|
||||||
|
@ -52,8 +52,6 @@ public:
|
||||||
generation8 = (uint8_t)g;
|
generation8 = (uint8_t)g;
|
||||||
value16 = (int16_t)v;
|
value16 = (int16_t)v;
|
||||||
depth16 = (int16_t)d;
|
depth16 = (int16_t)d;
|
||||||
staticValue = (int16_t)statV;
|
|
||||||
staticMargin = (int16_t)statM;
|
|
||||||
}
|
}
|
||||||
void set_generation(int g) { generation8 = (uint8_t)g; }
|
void set_generation(int g) { generation8 = (uint8_t)g; }
|
||||||
|
|
||||||
|
@ -63,14 +61,12 @@ public:
|
||||||
Value value() const { return (Value)value16; }
|
Value value() const { return (Value)value16; }
|
||||||
Bound type() const { return (Bound)bound; }
|
Bound type() const { return (Bound)bound; }
|
||||||
int generation() const { return (int)generation8; }
|
int generation() const { return (int)generation8; }
|
||||||
Value static_value() const { return (Value)staticValue; }
|
|
||||||
Value static_value_margin() const { return (Value)staticMargin; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t key32;
|
uint32_t key32;
|
||||||
uint16_t move16;
|
uint16_t move16;
|
||||||
uint8_t bound, generation8;
|
uint8_t bound, generation8;
|
||||||
int16_t value16, depth16, staticValue, staticMargin;
|
int16_t value16, depth16;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +96,7 @@ public:
|
||||||
~TranspositionTable();
|
~TranspositionTable();
|
||||||
void set_size(size_t mbSize);
|
void set_size(size_t mbSize);
|
||||||
void clear();
|
void clear();
|
||||||
void store(const Key posKey, Value v, Bound type, Depth d, Move m, Value statV, Value kingD);
|
void store(const Key posKey, Value v, Bound type, Depth d, Move m);
|
||||||
TTEntry* probe(const Key posKey) const;
|
TTEntry* probe(const Key posKey) const;
|
||||||
void new_search();
|
void new_search();
|
||||||
TTEntry* first_entry(const Key posKey) const;
|
TTEntry* first_entry(const Key posKey) const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue