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


Python Board.possible_moves方法代码示例

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


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

示例1: test_moves_in_a_new_game

# 需要导入模块: from cython.importer import Board [as 别名]
# 或者: from cython.importer.Board import possible_moves [as 别名]
 def test_moves_in_a_new_game(self):
     board = Board(True)
     expected_moves_white = set([
         ((0, 1), (0, 2)), ((0, 1), (0, 3)),
         ((1, 1), (1, 2)), ((1, 1), (1, 3)),
         ((2, 1), (2, 2)), ((2, 1), (2, 3)),
         ((3, 1), (3, 2)), ((3, 1), (3, 3)),
         ((4, 1), (4, 2)), ((4, 1), (4, 3)),
         ((5, 1), (5, 2)), ((5, 1), (5, 3)),
         ((6, 1), (6, 2)), ((6, 1), (6, 3)),
         ((7, 1), (7, 2)), ((7, 1), (7, 3)),
         ((1, 0), (0, 2)), ((1, 0), (2, 2)),
         ((6, 0), (5, 2)), ((6, 0), (7, 2)),
     ])
     expected_moves_black = set([
         ((0, 6), (0, 5)), ((0, 6), (0, 4)),
         ((1, 6), (1, 5)), ((1, 6), (1, 4)),
         ((2, 6), (2, 5)), ((2, 6), (2, 4)),
         ((3, 6), (3, 5)), ((3, 6), (3, 4)),
         ((4, 6), (4, 5)), ((4, 6), (4, 4)),
         ((5, 6), (5, 5)), ((5, 6), (5, 4)),
         ((6, 6), (6, 5)), ((6, 6), (6, 4)),
         ((7, 6), (7, 5)), ((7, 6), (7, 4)),
         ((1, 7), (0, 5)), ((1, 7), (2, 5)),
         ((6, 7), (5, 5)), ((6, 7), (7, 5)),
     ])
     self.assertEqual(tuples(board.possible_moves(WHITE)),
                      expected_moves_white)
     self.assertEqual(tuples(board.possible_moves(BLACK)),
                      expected_moves_black)
开发者ID:GRUPO-ES2-GJLRT,项目名称:XADREZ_ES2,代码行数:32,代码来源:test_board.py

示例2: test_moves_that_keeps_check_are_not_allowed

# 需要导入模块: from cython.importer import Board [as 别名]
# 或者: from cython.importer.Board import possible_moves [as 别名]
 def test_moves_that_keeps_check_are_not_allowed(self):
     board = Board(False)
     board.load_fen("8/8/8/8/8/8/4P3/r3K3 w kQkq - 0 1")
     expected_moves_white = set([
         ((4, 0), (3, 1)),
         ((4, 0), (5, 1)),
     ])
     self.assertEqual(tuples(board.possible_moves(WHITE)),
                      expected_moves_white)
开发者ID:GRUPO-ES2-GJLRT,项目名称:XADREZ_ES2,代码行数:11,代码来源:test_board.py

示例3: test_moves_in_a_board_with_just_a_knight

# 需要导入模块: from cython.importer import Board [as 别名]
# 或者: from cython.importer.Board import possible_moves [as 别名]
 def test_moves_in_a_board_with_just_a_knight(self):
     board = Board(False)
     board.load_fen("8/8/8/4N3/8/8/8/8 w kQkq - 0 1")
     expected_moves_white = set([
         ((4, 4), (3, 2)),
         ((4, 4), (5, 2)),
         ((4, 4), (6, 3)),
         ((4, 4), (6, 5)),
         ((4, 4), (5, 6)),
         ((4, 4), (3, 6)),
         ((4, 4), (2, 5)),
         ((4, 4), (2, 3)),
     ])
     expected_moves_black = set()
     self.assertEqual(tuples(board.possible_moves(WHITE)),
                      expected_moves_white)
     self.assertEqual(tuples(board.possible_moves(BLACK)),
                      expected_moves_black)
开发者ID:GRUPO-ES2-GJLRT,项目名称:XADREZ_ES2,代码行数:20,代码来源:test_board.py

示例4: test_moves_that_allows_check_are_not_allowed

# 需要导入模块: from cython.importer import Board [as 别名]
# 或者: from cython.importer.Board import possible_moves [as 别名]
    def test_moves_that_allows_check_are_not_allowed(self):
        board = Board(False)
        board.load_fen("8/8/8/8/7b/8/5P2/4K3 w - - 0 1")
        expected_moves_white = set([
            ((4, 0), (3, 0)),
            ((4, 0), (3, 1)),
            ((4, 0), (5, 0)),
            ((4, 0), (4, 1)),

        ])
        self.assertEqual(tuples(board.possible_moves(WHITE)),
                         expected_moves_white)
开发者ID:GRUPO-ES2-GJLRT,项目名称:XADREZ_ES2,代码行数:14,代码来源:test_board.py


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