Пример #1
0
 def simulate(self, board, move, toplay, table):
     cboard = board.copy()
     cboard.play_move(move, toplay)
     opp = GoBoardUtil.opponent(toplay)
     return PatternUtil.playGame(cboard,
                                 opp,
                                 limit=self.limit,
                                 random_simulation=self.random_simulation,
                                 use_pattern=self.use_pattern,
                                 table=table)
Пример #2
0
 def simulate(self, board, move, toplay):
     """
         Run a simulate game for a given move.
         """
     cboard = board.copy()
     cboard.play_move(move, toplay)
     opp = GoBoardUtil.opponent(toplay)
     return PatternUtil.playGame(cboard,
                                 opp,
                                 komi=self.komi,
                                 limit=self.limit,
                                 random_simulation=self.random_simulation,
                                 use_pattern=self.use_pattern)
Пример #3
0
def simulate(board, move, toplay):
    """
    Run a simulate game for a given move.
    """
    cboard = board.copy()
    cboard.play_move(move, toplay)
    opp = GoBoardUtil.opponent(toplay)
    return PatternUtil.playGame(cboard,
                                opp,
                                komi=0,
                                limit=100,
                                random_simulation = True,      #implement a way to change this accordingly
                                use_pattern = False,           #implement a way to change this accordingly
                                check_selfatari = False)       #implement a way to change this accordingly
Пример #4
0
 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 = PatternUtil.playGame(board,
                                   toplay,
                                   komi=self.komi,
                                   limit=self.limit,
                                   random_simulation=self.simulation_policy,
                                   use_pattern=self.use_pattern,
                                   check_selfatari=self.check_selfatari)
     if winner == BLACK:
         return 1
     else:
         return 0