7 #include <boost/foreach.hpp>
8 #include <boost/scoped_ptr.hpp>
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 vector<record::opening::WMove>&
moves = book.
getMoves(index);
30 FixedCapacityVector<std::pair<int, Move>, 40> children;
31 BOOST_FOREACH(
WMove move, moves)
33 const HashKey child = key.newMakeMove(move.
getMove());
35 if (cv < visit_threshold || cv*scale < visit || move.
getWeight() == 0)
37 children.push_back(std::make_pair(cv, move.
getMove()));
38 if (children.size() == children.capacity())
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())
60 const NumEffectState state;
61 readRecursive(HashKey(state), index, book, 0, 0);
67 table_t::const_iterator p = table.find(key);
70 BOOST_FOREACH(
Move move, p->second)
79 static std::map<std::string,boost::shared_ptr<BookInMemory> > table;
80 boost::shared_ptr<BookInMemory> &
book = table[filename];