/** Selects random move among the empty cells on the board. */ HexPoint MoHexPlayoutPolicy::GenerateRandomMove(const StoneBoard& brd) { HexPoint ret = INVALID_POINT; while (true) { BenzeneAssert(!m_moves.empty()); ret = m_moves.back(); m_moves.pop_back(); if (brd.IsEmpty(ret)) break; } return ret; }
HexPoint MoHexPlayoutPolicy::GenerateResponseMove(HexColor toPlay, HexPoint lastMove, const StoneBoard& brd) { std::size_t num = m_response[toPlay][lastMove].size(); if (num > m_shared->Config().responseThreshold) { HexPoint move = m_response[toPlay][lastMove][m_random.Int(num)]; if (brd.IsEmpty(move)) return move; } return INVALID_POINT; }