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


Python Board._pieces方法代码示例

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


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

示例1: test_check_small

# 需要导入模块: from chess.board import Board [as 别名]
# 或者: from chess.board.Board import _pieces [as 别名]
def test_check_small():
  board = Board()
  king = King(BLACK, 0, 0)
  rook = Rook(WHITE, 2, 2)
  board._pieces = {king, rook}
  assert not board.checked(BLACK)
  board.move(rook, 2, 0)
  assert board.checked(BLACK)
开发者ID:adamchalmers,项目名称:pychess,代码行数:10,代码来源:test_others.py

示例2: test_copy

# 需要导入模块: from chess.board import Board [as 别名]
# 或者: from chess.board.Board import _pieces [as 别名]
def test_copy():
  board = Board()
  king = King(BLACK, 0, 0)
  rook = Rook(WHITE, 2, 2)
  board._pieces = {king, rook}
  clone = board.copy()
  assert len(clone._pieces) == len(board._pieces)
  for piece in clone._pieces:
    assert piece not in board._pieces
开发者ID:adamchalmers,项目名称:pychess,代码行数:11,代码来源:test_others.py

示例3: test_check_medium

# 需要导入模块: from chess.board import Board [as 别名]
# 或者: from chess.board.Board import _pieces [as 别名]
def test_check_medium():
  board = Board()
  king = King(BLACK, 0, 0)
  rook = Rook(WHITE, 2, 2)
  pawn = Pawn(WHITE, 7, 3)
  bishop = Bishop(WHITE, 1, 3)
  enemy_king = King(WHITE, 6, 6)
  board._pieces = {king, rook, pawn, bishop, enemy_king}
  assert not board.checked(BLACK)
  board.move(rook, 2, 0)
  assert board.checked(BLACK)
  assert not board.checked(WHITE)
开发者ID:adamchalmers,项目名称:pychess,代码行数:14,代码来源:test_others.py

示例4: test_moves_tiny

# 需要导入模块: from chess.board import Board [as 别名]
# 或者: from chess.board.Board import _pieces [as 别名]
def test_moves_tiny():
  board = Board()
  king = King(BLACK, 0, 0)
  r = Rook(WHITE, 4, 0)
  board._pieces = {king, r}
  assert_equals(board.moves_open(BLACK), True)
开发者ID:adamchalmers,项目名称:pychess,代码行数:8,代码来源:test_others.py


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