本文整理汇总了Python中chess.board.Board.pieces_quantity方法的典型用法代码示例。如果您正苦于以下问题:Python Board.pieces_quantity方法的具体用法?Python Board.pieces_quantity怎么用?Python Board.pieces_quantity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chess.board.Board
的用法示例。
在下文中一共展示了Board.pieces_quantity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pieces_can_capture_opponent_pieces
# 需要导入模块: from chess.board import Board [as 别名]
# 或者: from chess.board.Board import pieces_quantity [as 别名]
def test_pieces_can_capture_opponent_pieces():
board = Board(initial_pieces={'a8': King('black'), 'e5': Pawn('black'), 'f3': Knight('white')})
assert board.pieces_quantity() == 3
knight = board.get_piece('f3')
board.move('f3', 'e5')
assert board.get_piece('e5') is knight
assert board.pieces_quantity() == 2
示例2: test_board_has_32_pieces
# 需要导入模块: from chess.board import Board [as 别名]
# 或者: from chess.board.Board import pieces_quantity [as 别名]
def test_board_has_32_pieces():
board = Board()
assert board.pieces_quantity() == 32
示例3: test_board_can_be_instatiated_with_any_set_of_pieces
# 需要导入模块: from chess.board import Board [as 别名]
# 或者: from chess.board.Board import pieces_quantity [as 别名]
def test_board_can_be_instatiated_with_any_set_of_pieces():
board = Board(initial_pieces={'a2': Pawn('white'), 'a6': Pawn('black')})
assert board.pieces_quantity() == 2