Пример #1
0
 def __init__(self, master=None, height=0, width=0):
     tkinter.Canvas.__init__(self, master, height=height, width=width)
     self.step_record_chess_board = Record.Step_Record_Chess_Board()
     # 初始化記步器
     self.init_chess_board_points()  # 畫點
     self.init_chess_board_canvas()  # 畫棋盤
     self.board = MCTS.Board()
     self.AI = MCTS.MonteCarlo(self.board, 2)
     self.clicked = 0
Пример #2
0
 def __init__(self, master=None, height=0, width=0):
     Tkinter.Canvas.__init__(self, master, height=height, width=width)
     self.step_record_chess_board = Record.Step_Record_Chess_Board()
     # 初始化記步器
     self.height = 15
     self.width = 15
     self.init_chess_board_points()  # 畫點
     self.init_chess_board_canvas()  # 畫棋盤
     self.board = MCTS.Board()
     self.n_in_row = 5
     self.n_playout = 400  # num of simulations for each move
     self.c_puct = 5
     """
     Important 1: Python is pass by reference
     So the self.board will be modified by other operations
     """
     self.AI = MCTS.MonteCarlo(self.board, 1)
     self.AI_1 = MCTS.MonteCarlo(self.board, 0)
     self.clicked = 1
     self.init = True  # first place is given by user (later need to be replaced as a random selection)
     self.train_or_play = True  # True - train, False - play
     self.step = 0
     self.text_id = None