def start_game(self):
builtins.cfg = \
chess_config.Config(self.config_name.lower(), self.crazy_mode)
self.game._reset()
agent1_module = __import__(self.agent1 + "_ChessPlayer")
white_opponent_class = getattr(agent1_module,
self.agent1 + "_ChessPlayer")
self.white_opponent = white_opponent_class(self.game.board,'white')
agent2_module = __import__(self.agent2 + "_ChessPlayer")
black_opponent_class = getattr(agent2_module,
self.agent2 + "_ChessPlayer")
self.black_opponent = black_opponent_class(self.game.board,'black')
self.game.white_player = self.agent1
self.game.black_player = self.agent2
self.player_time = {'white':0.0,'black':0.0}
self.timer = time.perf_counter()
move = self.take_player_turn()
self.attempt_to_make_move(self.game.board[move[0]], *move)
while self.game.started:
move = self.switch_player_turn()
self.attempt_to_make_move(self.game.board[move[0]], *move)
评论列表
文章目录