chess_headless.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:cpsc415 作者: WheezePuppet 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号