def testDungeonRoomsRooms(self): m = Maze() m.generator = DungeonRooms(4, 4, rooms=[[(1,1), (3,3)]]) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid))
def testDungeonRoomsRooms(self): m = Maze() m.generator = DungeonRooms(4, 4, rooms=[[(1, 1), (3, 3)]]) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid))
def testCellularAutomaton(self): m = Maze() m.generator = CellularAutomaton(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid))
def test_cellular_automaton(self): m = Maze() m.generator = CellularAutomaton(4, 5) m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid))
def testWilsons(self): m = Maze() m.generator = Wilsons(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def testHuntAndKill(self): m = Maze() m.generator = HuntAndKill(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def testCellularAutomaton(self): m = Maze() m.generator = CellularAutomaton(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def test_binary_tree(self): m = Maze() m.generator = BinaryTree(4, 5) m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_division(self): m = Maze() m.generator = Division(4, 5) m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def testBacktrackingGenerator(self): m = Maze() m.generator = BacktrackingGenerator(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def test_hunt_and_kill_serpentine_order(self): m = Maze() m.generator = HuntAndKill(4, 5, 'serpentine') m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def testDivision(self): m = Maze() m.generator = Division(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def test_wilsons_serpentine_order(self): m = Maze() m.generator = Wilsons(4, 5, hunt_order='serpentine') m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_sidewinder(self): m = Maze() m.generator = Sidewinder(4, 5) m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_aldous_broder(self): m = Maze() m.generator = AldousBroder(4, 5) m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_backtracking_generator(self): m = Maze() m.generator = BacktrackingGenerator(4, 5) m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_cellular_automaton(self): """ test the Cellulator Automaton method generates a reasonably sane maze """ m = Maze() m.generator = CellularAutomaton(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid)
def testAldousBroder(self): m = Maze() m.generator = AldousBroder(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def testGrowingTree(self): m = Maze() m.generator = GrowingTree(4, 5) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def test_binary_tree(self): """ test the Binary Tree method generates a reasonably sane maze """ m = Maze() m.generator = BinaryTree(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_backtracking_generator(self): """ test the Backtracking method generates a reasonably sane maze """ m = Maze() m.generator = BacktrackingGenerator(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_aldous_broder(self): """ test the AlgousBroder method generates a reasonably sane maze """ m = Maze() m.generator = AldousBroder(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_wilsons_serpentine_order(self): """ test the Wilson method generates a reasonably sane maze, using the serpentine pathway """ m = Maze() m.generator = Wilsons(4, 5, hunt_order='serpentine') m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_sidewinder(self): """ test the Sidewinder method generates a reasonably sane maze """ m = Maze() m.generator = Sidewinder(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_kruskal(self): """ test the Kruskal method generates a reasonably sane maze """ m = Maze() m.generator = Kruskal(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_division(self): """ test the Division method generates a reasonably sane maze """ m = Maze() m.generator = Division(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_hunt_and_kill_serpentine_order(self): """ test the Hunt and Kill method generates a reasonably sane maze, using the serpentine pathway """ m = Maze() m.generator = HuntAndKill(4, 5, 'serpentine') m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid)
def test_trivial_maze_spiral(self): m = Maze() m.generator = TrivialMaze(4, 5) m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_trivial_maze_spiral(self): """ test that the trivial/spiral maze is reasonably sane """ m = Maze() m.generator = TrivialMaze(4, 5) m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid) assert all_corners_complete(m.grid) assert all_corners_complete(m.grid)
def test_trivial_maze_serpentine(self): # run this test enough times to trip the different skewness parameters for _ in range(10): m = Maze() m.generator = TrivialMaze(4, 5, 'serpentine') m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_dungeon_rooms_serpentine_rooms(self): m = Maze() m.generator = DungeonRooms(4, 4, rooms=[[(1, 1), (3, 3)]], hunt_order='serpentine') m.generate() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid))
def testInnerEntrances(self): h = 4 w = 5 m = Maze() m.generator = Prims(h, w) m.generate() m.generate_entrances(False, False) self.assertFalse(self._on_edge(m.grid, m.start)) self.assertFalse(self._on_edge(m.grid, m.end))
def testOuterEntrances(self): h = 4 w = 5 m = Maze() m.generator = Prims(h, w) m.generate() m.generate_entrances() self.assertTrue(self._on_edge(m.grid, m.start)) self.assertTrue(self._on_edge(m.grid, m.end))
def test_dungeon_rooms_serpentine_rooms(self): """ test DungeonRooms mazes are reasonably when generating some random rooms in a serpentine fashion """ m = Maze() m.generator = DungeonRooms(4, 4, rooms=[[(1, 1), (3, 3)]], hunt_order='serpentine') m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid)
def test_perturbation(self): m = Maze() m.generator = TrivialMaze(4, 5) m.generate() m.transmuters = [Perturbation()] m.transmute() self.assertTrue(boundary_is_solid(m.grid)) self.assertTrue(all_passages_open(m.grid)) self.assertTrue(all_corners_complete(m.grid))
def test_dungeon_rooms_random_rooms(self): """ test Dungeon Rooms maze-creation mazes a reasonably sane maze when generating some random rooms """ m = Maze() m.generator = DungeonRooms(4, 4, rooms=[[(1, 1), (3, 3)]], hunt_order='random') m.generate() assert boundary_is_solid(m.grid) assert all_passages_open(m.grid)
def testGridSize(self): h = 4 w = 5 H = 2 * h + 1 W = 2 * w + 1 m = Maze() m.generator = Prims(h, w) m.generate() self.assertEqual(m.grid.shape[0], H) self.assertEqual(m.grid.shape[1], W)
def testGridSize(self): h = 4 w = 5 H = 2 * h + 1 W = 2 * w + 1 m = Maze() m.generator = Prims(h, w) m.generate() self.assertEqual(m.grid.height, H) self.assertEqual(m.grid.width, W)
def testPerturbation(self): m1 = Maze() m1.generator = TrivialMaze(4, 5) m1.generate() m = Maze() m.generator = Perturbation(m1.grid) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid)) self.assertTrue(self.all_corners_complete(m.grid))
def testGeneratorWipe(self): h = 4 w = 5 m = Maze() m.generator = Prims(h, w) m.generate() m.generate_entrances() m.generate() self.assertTrue(m.start is None) self.assertTrue(m.end is None) self.assertTrue(m.solutions is None)
def testDungeonRoomsGrid(self): g = np.ones((7, 7), dtype=np.int8) g[1] = [1,1,1,1,1,1,1] g[2] = [1,1,1,1,1,1,1] g[3] = [1,1,0,0,0,1,1] g[4] = [1,1,0,0,0,1,1] g[5] = [1,1,0,0,0,1,1] m = Maze() m.generator = DungeonRooms(4, 4, grid=g) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid))
def testDungeonRoomsGrid(self): g = MazeArray(7, 7) g[1] = array('b', [1,1,1,1,1,1,1]) g[2] = array('b', [1,1,1,1,1,1,1]) g[3] = array('b', [1,1,0,0,0,1,1]) g[4] = array('b', [1,1,0,0,0,1,1]) g[5] = array('b', [1,1,0,0,0,1,1]) m = Maze() m.generator = DungeonRooms(4, 4, grid=g) m.generate() self.assertTrue(self.boundary_is_solid(m.grid)) self.assertTrue(self.all_passages_open(m.grid))
def _create_maze_with_varied_entrances(self, start_outer=True, end_outer=True): """create a maze with entrances inside/outside""" m = Maze() m.generator = Prims(4, 5) m.generate() if start_outer and end_outer: m.generate_entrances() elif not start_outer and not end_outer: m.generate_entrances(False, False) elif start_outer: m.generate_entrances(True, False) else: m.generate_entrances(False, True) return m