def simulate(self, board, cboard, move, toplay): GoBoardUtilGo4.copyb2b(board, cboard) assert cboard.board.all() == board.board.all() cboard.move(move, toplay) opp = GoBoardUtilGo4.opponent(toplay) return GoBoardUtilGo4.playGame(cboard, opp, komi=self.komi, limit=self.limit, simulation_policy=simulations, use_pattern=self.use_pattern, check_selfatari=self.check_selfatari)
def _evaluate_rollout(self, board, toplay): """ Use the rollout policy to play until the end of the game, returning +1 if the current player wins, -1 if the opponent wins, and 0 if it is a tie. """ winner = GoBoardUtilGo4.playGame(board, toplay, komi=self.komi, limit=self.limit, simulation_policy=self.simulation_policy, use_pattern = self.use_pattern, check_selfatari= self.check_selfatari) if winner == BLACK: return 1 else: return 0