当前位置: 首页>>代码示例>>Python>>正文


Python Board.from_notation方法代码示例

本文整理汇总了Python中chess.Board.from_notation方法的典型用法代码示例。如果您正苦于以下问题:Python Board.from_notation方法的具体用法?Python Board.from_notation怎么用?Python Board.from_notation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chess.Board的用法示例。


在下文中一共展示了Board.from_notation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import from_notation [as 别名]
 def setUp(self):
     self.notation = [["WR", "WN", "WB", "WQ", "WK", "WB", "WN", "WR"],
                      ["WP", "WP", "WP", "WP",   "", "WP", "WP", "WP"], 
                      [  "",   "",   "",   "",   "",   "",   "",   ""],
                      [  "",   "",   "",   "", "WP",   "",   "",   ""],
                      [  "",   "",   "",   "", "BP",   "",   "",   ""],
                      [  "",   "",   "",   "",   "",   "",   "",   ""],
                      ["BP", "BP", "BP", "BP",   "", "BP", "BP", "BP"], 
                      ["BR", "BN", "BB", "BQ", "BK", "BB", "BN", "BR"]]
     self.flat_notation = list(itertools.chain(*self.notation))
     self.num_pieces = len([square for square in self.flat_notation if square != ""])
     self.empty_board = Board()
     self.board = Board.from_notation(self.notation)
开发者ID:kbuzsaki,项目名称:restchess,代码行数:15,代码来源:board_test.py

示例2: setUp

# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import from_notation [as 别名]
 def setUp(self):
     self.board = Board.from_notation([[  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "", "WR",   "",   "",   "",   "",   "",   ""], 
                                       [  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "", "WR",   "", "BR",   "", "WR",   "",   ""],
                                       [  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "",   "",   "",   "",   "",   "",   "", "BR"], 
                                       [  "",   "",   "",   "",   "",   "",   "",   ""]])
     self.upper_rook = self.board[1][1]
     self.left_rook = self.board[4][1]
     self.right_rook = self.board[4][5]
     self.middle_rook = self.board[4][3]
     self.lower_rook = self.board[6][7]
开发者ID:kbuzsaki,项目名称:restchess,代码行数:16,代码来源:rook_test.py

示例3: setUp

# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import from_notation [as 别名]
 def setUp(self):
     self.board = Board.from_notation(chess.STARTING_NOTATION)
开发者ID:kbuzsaki,项目名称:restchess,代码行数:4,代码来源:piece_test.py

示例4: _reset

# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import from_notation [as 别名]
 def _reset(self):
     self._board = Board.from_notation(chess.STARTING_NOTATION)
     self.turn_count = 1
     self.cur_player = Color.white
开发者ID:kbuzsaki,项目名称:restchess,代码行数:6,代码来源:client.py

示例5: _load_from_response

# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import from_notation [as 别名]
 def _load_from_response(self, resp):
     next_turn = {"turn": resp["turn"], "current_player": resp["current_player"]}
     self._cached_board = Board.from_notation(resp["board"])
     return next_turn
开发者ID:kbuzsaki,项目名称:restchess,代码行数:6,代码来源:client.py


注:本文中的chess.Board.from_notation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。