本文整理汇总了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)
示例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]
示例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)
示例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
示例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