reduce number of map lookups
This commit is contained in:
parent
3dafee21dd
commit
9af42a43a4
1 changed files with 6 additions and 2 deletions
|
@ -1034,8 +1034,10 @@ namespace Hanabi
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifndef GAME_STATE_NO_TABLEBASE_LOOKUP
|
#ifndef GAME_STATE_NO_TABLEBASE_LOOKUP
|
||||||
if (_position_tablebase.count(id_of_state) == 1) {
|
auto lookup_it = _position_tablebase.find(id_of_state);
|
||||||
return _position_tablebase[id_of_state];
|
if (lookup_it != _position_tablebase.end())
|
||||||
|
{
|
||||||
|
return lookup_it->second;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1401,10 +1403,12 @@ namespace Hanabi
|
||||||
std::cout << "\n" << std::endl;
|
std::cout << "\n" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NDEBUG
|
||||||
if (_position_tablebase.count(id) == 1)
|
if (_position_tablebase.count(id) == 1)
|
||||||
{
|
{
|
||||||
ASSERT(_position_tablebase[id] == probability);
|
ASSERT(_position_tablebase[id] == probability);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (save_state_to_map())
|
if (save_state_to_map())
|
||||||
{
|
{
|
||||||
_position_tablebase[id] = probability;
|
_position_tablebase[id] = probability;
|
||||||
|
|
Loading…
Reference in a new issue