6 #include <unordered_map> 11 typedef std::unordered_map<osl::HashKey,list_t,std::hash<osl::HashKey>>
map_t;
78 const Table::iterator p=
table->find(new_key);
79 if (p ==
table->end())
81 (*table)[new_key].push_front(
order());
86 l.push_front(
order());
94 const bool is_check = state.
inCheck();
111 key = key.newHashWithMove(move);
127 const Player last_turn =
alt(last_key.turn());
131 const Table::iterator p=
table->find(last_key);
132 assert(p !=
table->end());
135 const list_t::iterator q = p->second.begin();
136 assert(q != p->second.end());
137 assert(*q ==
order());
139 p->second.pop_front();
140 if (p->second.empty())
147 const Table::const_iterator p=
table->find(key);
148 if (p ==
table->end())
150 return p->second.front();
155 const Table::const_iterator p=
table->find(key);
156 if (p ==
table->end())
158 list_t::const_iterator q = p->second.begin();
159 assert(q != p->second.end());
161 while (q != p->second.end())
171 const Table::const_iterator p=
table->find(key);
172 if (p ==
table->end())
176 if (p->second.size() < 3)
184 const Table::const_iterator p=
table->find(key);
185 if (p ==
table->end())
193 const Table::const_iterator p=
table->find(key);
194 if (p ==
table->end())
196 return p->second.size();
202 Table::const_iterator p=
table->find(key);
203 if (p ==
table->end())
212 Table::const_iterator p=
table->find(key);
213 if (p ==
table->end())
215 for (
int q: p->second) {
216 std::cerr << q <<
" ";
227 while (history.
empty())
233 assert(! continuous_check[last_turn].empty());
234 continuous_check[last_turn].pop_back();
236 const Table::iterator p=table.find(last_key);
237 if (p == table.end())
239 std::cerr <<
"oops, " <<
this <<
"\n";
242 assert(p != table.end());
245 const list_t::iterator q = p->second.begin();
246 assert(q != p->second.end());
247 assert(*q ==
order());
249 p->second.pop_front();
250 if (p->second.empty())
258 #if ! (__GNUC__ >= 4 && __GNUC_MINOR__ >=3) int getLastMove(const HashKey &key) const
key の手を最後に登録した指手番号.
std::unique_ptr< Table > table
osl::RepetitionCounter::list_t list_t
HashKeyStack hash_history
constexpr Player alt(Player player)
void printMatches(const HashKey &key) const
void push(const HashKey &new_key, bool is_check)
const Sennichite isAlmostSennichite(const HashKey &key) const
このまま同形を繰り返したらどの結果になるかを返す
bool isValidOrPass() const
const HashKeyStack & history() const
int checkCount(Player attack) const
const HashKey & top(size_t n=0) const
const list_t getRepetitions(const HashKey &) const
void push(const HashKey &)
unsigned int countRepetition(const HashKey &) const
const std::pair< Sennichite, int > distanceToSennichite(const HashKey &key) const
const Sennichite isSennichite(const NumEffectState &state, Move move) const
std::unordered_map< osl::HashKey, list_t, std::hash< osl::HashKey > > map_t
bool isConsistent() const
bool inCheck(Player P) const
Pの玉が王手状態
CArray< std::vector< int >, 2 > continuous_check
const HashKey newHashWithMove(Move move) const
bool isCheck(Move move) const
static Sennichite NORMAL()
int getFirstMove(const HashKey &key) const
key の手を最初に登録した指手番号.
static bool maybeEqual(const RepetitionCounter &l, const RepetitionCounter &r)
static const int initial_capacity