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


Python Board.findOuterWalls方法代码示例

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


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

示例1: testOuterShapeConcav

# 需要导入模块: from galaxySolver import Board [as 别名]
# 或者: from galaxySolver.Board import findOuterWalls [as 别名]
    def testOuterShapeConcav(self):
        b = Board(4, 4)
        cells = set()
        cells.add((1, 1))
        cells.add((1, 3))
        cells.add((1, 5))
        cells.add((1, 7))

        cells.add((3, 1))
        cells.add((3, 7))

        cells.add((5, 1))
        cells.add((5, 7))

        cells.add((7, 1))
        cells.add((7, 3))
        cells.add((7, 5))
        cells.add((7, 7))

        b.addWall(2, 3)
        b.addWall(2, 5)
        b.addWall(3, 2)
        b.addWall(3, 6)
        b.addWall(5, 2)
        b.addWall(5, 6)
        b.addWall(6, 3)
        b.addWall(6, 5)


        walls = set()
        walls.add((2, 3))
        walls.add((2, 5))
        walls.add((3, 2))
        walls.add((3, 6))
        walls.add((5, 2))
        walls.add((5, 6))
        walls.add((6, 3))
        walls.add((6, 5))

        walls.add((0, 1))
        walls.add((0, 3))
        walls.add((0, 5))
        walls.add((0, 7))

        walls.add((1, 0))
        walls.add((1, 8))
        walls.add((3, 0))
        walls.add((3, 8))
        walls.add((5, 0))
        walls.add((5, 8))
        walls.add((7, 0))
        walls.add((7, 8))

        walls.add((8, 1))
        walls.add((8, 3))
        walls.add((8, 5))
        walls.add((8, 7))

        resultWalls = b.findOuterWalls(cells)
        self.assertEquals(walls, resultWalls)
开发者ID:tuxella,项目名称:Galaxies-Solver,代码行数:62,代码来源:tests.py

示例2: testOuterShapeSimple

# 需要导入模块: from galaxySolver import Board [as 别名]
# 或者: from galaxySolver.Board import findOuterWalls [as 别名]
    def testOuterShapeSimple(self):
        b = Board(4, 4)
        cells = set()
        cells.add((3, 3))
        cells.add((3, 5))
        cells.add((5, 3))
        cells.add((5, 5))


        b.addWall(2, 3)
        b.addWall(2, 5)
        b.addWall(3, 2)
        b.addWall(3, 6)
        b.addWall(5, 2)
        b.addWall(5, 6)
        b.addWall(6, 3)
        b.addWall(6, 5)


        walls = set()
        walls.add((2, 3))
        walls.add((2, 5))
        walls.add((3, 2))
        walls.add((3, 6))
        walls.add((5, 2))
        walls.add((5, 6))
        walls.add((6, 3))
        walls.add((6, 5))

        resultWalls = b.findOuterWalls(cells)
        self.assertEquals(walls, resultWalls)
开发者ID:tuxella,项目名称:Galaxies-Solver,代码行数:33,代码来源:tests.py

示例3: testOuterShapeSingleCell

# 需要导入模块: from galaxySolver import Board [as 别名]
# 或者: from galaxySolver.Board import findOuterWalls [as 别名]
    def testOuterShapeSingleCell(self):
        b = Board(4, 4)
        cells = set()
        cells.add((3, 3))

        b.addWall(2, 3)
        b.addWall(3, 2)
        b.addWall(3, 4)
        b.addWall(4, 3)

        walls = set()
        walls.add((2, 3))
        walls.add((3, 2))
        walls.add((3, 4))
        walls.add((4, 3))

        resultWalls = b.findOuterWalls(cells)
        self.assertEquals(walls, resultWalls)
开发者ID:tuxella,项目名称:Galaxies-Solver,代码行数:20,代码来源:tests.py

示例4: testOuterShapeEmptyBoard

# 需要导入模块: from galaxySolver import Board [as 别名]
# 或者: from galaxySolver.Board import findOuterWalls [as 别名]
    def testOuterShapeEmptyBoard(self):
        b = Board(2, 2)
        cells = set()
        cells.add((1, 1))
        cells.add((1, 3))
        cells.add((3, 1))
        cells.add((3, 3))

        walls = set()
        walls.add((0, 1))
        walls.add((0, 3))
        walls.add((1, 0))
        walls.add((1, 4))
        walls.add((3, 0))
        walls.add((3, 4))
        walls.add((4, 1))
        walls.add((4, 3))

        resultWalls = b.findOuterWalls(cells)
        self.assertEquals(walls, resultWalls)
开发者ID:tuxella,项目名称:Galaxies-Solver,代码行数:22,代码来源:tests.py

示例5: testOuterShapeEmptyBoardDumbWall

# 需要导入模块: from galaxySolver import Board [as 别名]
# 或者: from galaxySolver.Board import findOuterWalls [as 别名]
    def testOuterShapeEmptyBoardDumbWall(self):
        b = Board(2, 2)
        cells = set()
        cells.add((1, 1))
        cells.add((1, 3))
        cells.add((3, 1))
        cells.add((3, 3))

        b.addWall(1, 2) # A wall that doesn't frontier the shape

        walls = set()
        walls.add((0, 1))
        walls.add((0, 3))
        walls.add((1, 0))
        walls.add((1, 4))
        walls.add((3, 0))
        walls.add((3, 4))
        walls.add((4, 1))
        walls.add((4, 3))

        resultWalls = b.findOuterWalls(cells)
        self.assertEquals(walls, resultWalls)
开发者ID:tuxella,项目名称:Galaxies-Solver,代码行数:24,代码来源:tests.py

示例6: testOuterShapeEmptyBoardFrontieringShape

# 需要导入模块: from galaxySolver import Board [as 别名]
# 或者: from galaxySolver.Board import findOuterWalls [as 别名]
    def testOuterShapeEmptyBoardFrontieringShape(self):
        b = Board(2, 2)
        cells = set()
        cells.add((1, 1))
        cells.add((1, 3))
        cells.add((3, 1))
        cells.add((3, 3))

        b.addWall(1, 2) # 2 walls that make another shape near the first one
        b.addWall(2, 3)

        walls = set()
        walls.add((0, 1))
        walls.add((0, 3))
        walls.add((1, 0))
        walls.add((1, 4))
        walls.add((3, 0))
        walls.add((3, 4))
        walls.add((4, 1))
        walls.add((4, 3))

        resultWalls = b.findOuterWalls(cells)
        self.assertEquals(walls, resultWalls)
开发者ID:tuxella,项目名称:Galaxies-Solver,代码行数:25,代码来源:tests.py


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