mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Use probe() as name for looking up into an hash table
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
321320b081
commit
1d0159075e
6 changed files with 16 additions and 20 deletions
|
@ -98,7 +98,7 @@ MaterialInfoTable::~MaterialInfoTable() { delete funcs; }
|
||||||
MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) const {
|
MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) const {
|
||||||
|
|
||||||
Key key = pos.get_material_key();
|
Key key = pos.get_material_key();
|
||||||
MaterialInfo* mi = find(key);
|
MaterialInfo* mi = probe(key);
|
||||||
|
|
||||||
// If mi->key matches the position's material hash key, it means that we
|
// If mi->key matches the position's material hash key, it means that we
|
||||||
// have analysed this material configuration before, and we can simply
|
// have analysed this material configuration before, and we can simply
|
||||||
|
|
|
@ -75,7 +75,7 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) const {
|
||||||
assert(pos.is_ok());
|
assert(pos.is_ok());
|
||||||
|
|
||||||
Key key = pos.get_pawn_key();
|
Key key = pos.get_pawn_key();
|
||||||
PawnInfo* pi = find(key);
|
PawnInfo* pi = probe(key);
|
||||||
|
|
||||||
// If pi->key matches the position's pawn hash key, it means that we
|
// If pi->key matches the position's pawn hash key, it means that we
|
||||||
// have analysed this pawn structure before, and we can simply return
|
// have analysed this pawn structure before, and we can simply return
|
||||||
|
|
|
@ -736,7 +736,7 @@ namespace {
|
||||||
excludedMove = ss->excludedMove;
|
excludedMove = ss->excludedMove;
|
||||||
posKey = excludedMove ? pos.get_exclusion_key() : pos.get_key();
|
posKey = excludedMove ? pos.get_exclusion_key() : pos.get_key();
|
||||||
|
|
||||||
tte = TT.retrieve(posKey);
|
tte = TT.probe(posKey);
|
||||||
ttMove = tte ? tte->move() : MOVE_NONE;
|
ttMove = tte ? tte->move() : MOVE_NONE;
|
||||||
|
|
||||||
// At PV nodes we check for exact scores, while at non-PV nodes we check for
|
// At PV nodes we check for exact scores, while at non-PV nodes we check for
|
||||||
|
@ -872,7 +872,7 @@ namespace {
|
||||||
ss->skipNullMove = false;
|
ss->skipNullMove = false;
|
||||||
|
|
||||||
ttMove = ss->bestMove;
|
ttMove = ss->bestMove;
|
||||||
tte = TT.retrieve(posKey);
|
tte = TT.probe(posKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
split_point_start: // At split points actual search starts from here
|
split_point_start: // At split points actual search starts from here
|
||||||
|
@ -1277,7 +1277,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
// Transposition table lookup. At PV nodes, we don't use the TT for
|
// Transposition table lookup. At PV nodes, we don't use the TT for
|
||||||
// pruning, but only for move ordering.
|
// pruning, but only for move ordering.
|
||||||
tte = TT.retrieve(pos.get_key());
|
tte = TT.probe(pos.get_key());
|
||||||
ttMove = (tte ? tte->move() : MOVE_NONE);
|
ttMove = (tte ? tte->move() : MOVE_NONE);
|
||||||
|
|
||||||
if (!PvNode && tte && ok_to_use_TT(tte, ttDepth, beta, ss->ply))
|
if (!PvNode && tte && ok_to_use_TT(tte, ttDepth, beta, ss->ply))
|
||||||
|
@ -1987,7 +1987,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
pos.do_move(pv[0], *st++);
|
pos.do_move(pv[0], *st++);
|
||||||
|
|
||||||
while ( (tte = TT.retrieve(pos.get_key())) != NULL
|
while ( (tte = TT.probe(pos.get_key())) != NULL
|
||||||
&& tte->move() != MOVE_NONE
|
&& tte->move() != MOVE_NONE
|
||||||
&& pos.move_is_legal(tte->move())
|
&& pos.move_is_legal(tte->move())
|
||||||
&& ply < PLY_MAX
|
&& ply < PLY_MAX
|
||||||
|
@ -2017,7 +2017,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
|
|
||||||
do {
|
do {
|
||||||
k = pos.get_key();
|
k = pos.get_key();
|
||||||
tte = TT.retrieve(k);
|
tte = TT.probe(k);
|
||||||
|
|
||||||
// Don't overwrite existing correct entries
|
// Don't overwrite existing correct entries
|
||||||
if (!tte || tte->move() != pv[ply])
|
if (!tte || tte->move() != pv[ply])
|
||||||
|
|
|
@ -117,11 +117,11 @@ void TranspositionTable::store(const Key posKey, Value v, ValueType t, Depth d,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// TranspositionTable::retrieve() looks up the current position in the
|
/// TranspositionTable::probe() looks up the current position in the
|
||||||
/// transposition table. Returns a pointer to the TTEntry or NULL if
|
/// transposition table. Returns a pointer to the TTEntry or NULL if
|
||||||
/// position is not found.
|
/// position is not found.
|
||||||
|
|
||||||
TTEntry* TranspositionTable::retrieve(const Key posKey) const {
|
TTEntry* TranspositionTable::probe(const Key posKey) const {
|
||||||
|
|
||||||
uint32_t posKey32 = posKey >> 32;
|
uint32_t posKey32 = posKey >> 32;
|
||||||
TTEntry* tte = first_entry(posKey);
|
TTEntry* tte = first_entry(posKey);
|
||||||
|
|
6
src/tt.h
6
src/tt.h
|
@ -104,7 +104,7 @@ public:
|
||||||
void set_size(size_t mbSize);
|
void set_size(size_t mbSize);
|
||||||
void clear();
|
void clear();
|
||||||
void store(const Key posKey, Value v, ValueType type, Depth d, Move m, Value statV, Value kingD);
|
void store(const Key posKey, Value v, ValueType type, Depth d, Move m, Value statV, Value kingD);
|
||||||
TTEntry* retrieve(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;
|
||||||
void refresh(const TTEntry* tte) const;
|
void refresh(const TTEntry* tte) const;
|
||||||
|
@ -163,8 +163,8 @@ struct SimpleHash {
|
||||||
|
|
||||||
virtual ~SimpleHash() { delete [] entries; }
|
virtual ~SimpleHash() { delete [] entries; }
|
||||||
|
|
||||||
Entry* find(Key key) const { return entries + ((uint32_t)key & (HashSize - 1)); }
|
Entry* probe(Key key) const { return entries + ((uint32_t)key & (HashSize - 1)); }
|
||||||
void prefetch(Key key) const { ::prefetch((char*)find(key)); }
|
void prefetch(Key key) const { ::prefetch((char*)probe(key)); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Entry* entries;
|
Entry* entries;
|
||||||
|
|
12
src/uci.cpp
12
src/uci.cpp
|
@ -182,8 +182,7 @@ namespace {
|
||||||
|
|
||||||
string token;
|
string token;
|
||||||
SearchLimits limits;
|
SearchLimits limits;
|
||||||
Move searchMoves[MAX_MOVES] = { MOVE_NONE };
|
Move searchMoves[MAX_MOVES], *cur = searchMoves;
|
||||||
Move* cur = searchMoves;
|
|
||||||
int time[] = { 0, 0 }, inc[] = { 0, 0 };
|
int time[] = { 0, 0 }, inc[] = { 0, 0 };
|
||||||
|
|
||||||
while (up >> token)
|
while (up >> token)
|
||||||
|
@ -209,19 +208,16 @@ namespace {
|
||||||
else if (token == "movetime")
|
else if (token == "movetime")
|
||||||
up >> limits.maxTime;
|
up >> limits.maxTime;
|
||||||
else if (token == "searchmoves")
|
else if (token == "searchmoves")
|
||||||
{
|
|
||||||
while (up >> token)
|
while (up >> token)
|
||||||
*cur++ = move_from_uci(pos, token);
|
*cur++ = move_from_uci(pos, token);
|
||||||
|
}
|
||||||
|
|
||||||
*cur = MOVE_NONE;
|
*cur = MOVE_NONE;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(pos.is_ok());
|
|
||||||
|
|
||||||
limits.time = time[pos.side_to_move()];
|
limits.time = time[pos.side_to_move()];
|
||||||
limits.increment = inc[pos.side_to_move()];
|
limits.increment = inc[pos.side_to_move()];
|
||||||
|
|
||||||
|
assert(pos.is_ok());
|
||||||
|
|
||||||
return think(pos, limits, searchMoves);
|
return think(pos, limits, searchMoves);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue