24 const int depth_threshold = 60, visit_threshold = 4, scale = 16;
26 if (depth > depth_threshold || table.find(key) != table.end()
27 || visit < visit_threshold)
29 const std::vector<book::WMove>& moves = book.
moves(index);
31 for (
WMove move: moves)
34 const int cv = readRecursive(child, move.stateIndex(), book, depth+1, visit);
35 if (cv < visit_threshold || cv*scale < visit || move.weight == 0)
37 children.
push_back(std::make_pair(cv, move.move));
41 std::sort(children.
begin(), children.
end());
42 std::reverse(children.
begin(), children.
end());
43 if (! children.
empty()) {
46 for (
size_t i=0; i<children.
size(); ++i) {
47 store[i] = children[i].second;
48 if (i+1 == store.
size())
61 readRecursive(
HashKey(state), index, book, 0, 0);
67 table_t::const_iterator p = table.find(key);
70 for (
Move move: p->second)
79 static std::map<std::string,std::shared_ptr<BookInMemory> > table;
80 std::shared_ptr<BookInMemory> &book = table[filename];
void push_back(const T &e)
WMoveContainer moves(int stateIndex, const bool zero_include=true)
Return moves from the state of the stateIndex.
const HashKey newMakeMove(Move) const
void find(const HashKey &key, MoveVector &out) const
bool isNormal() const
INVALID でも PASS でもない.
int readRecursive(const HashKey &key, int index, WeightedBook &book, int, int)
BookInMemory(const std::string &filename)
int whiteWinCount(int stateIndex)
void fill(const T_simple &value=T_simple())
static const BookInMemory & instance(const std::string &filename="")
int blackWinCount(int stateIndex)
void readAll(const std::string &filename)