board.py 文件源码

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

项目:jcchess 作者: johncheetham 项目源码 文件源码
def get_game(self):

        # if the movelist is positioned part way through the game then
        # we must redo all moves to get the full game
        redo_count = len(gv.jcchess.get_redolist())
        for i in range(0, redo_count):
            gv.jcchess.redo_move()

        game = chess.pgn.Game.from_board(self.chessboard)

        # if we did any redo moves then undo them now to get things back
        # the way they were
        for i in range(0, redo_count):
            gv.jcchess.undo_move()

        game.headers["Event"] = "Computer Chess Game"
        game.headers["Site"] = socket.gethostname()
        game.headers["Date"] = datetime.strftime(datetime.now(), '%Y.%m.%d')  
        game.headers["Round"] = "-"
        game.headers["White"] = gv.jcchess.get_player(WHITE)
        game.headers["Black"] = gv.jcchess.get_player(BLACK)
        return game
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号