Exemplo n.º 1
0
    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))
Exemplo n.º 2
0
    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))
Exemplo n.º 3
0
    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))
Exemplo n.º 4
0
    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))
Exemplo n.º 5
0
    def test_outer_entrances(self):
        """ Test that the entrances can be correctly generated on the edges of the map """
        h = 4
        w = 5

        m = Maze()
        m.generator = Prims(h, w)
        m.generate()
        m.generate_entrances()

        assert self._on_edge(m.grid, m.start)
        assert self._on_edge(m.grid, m.end)
Exemplo n.º 6
0
    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)
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    def test_generator_wipe(self):
        """ Test that the running the master generate() method twice correctly wipes the entrances and solutions """
        h = 4
        w = 5

        m = Maze()
        m.generator = Prims(h, w)
        m.generate()
        m.generate_entrances()
        m.generate()

        assert m.start is None
        assert m.end is None
        assert m.solutions is None
Exemplo n.º 9
0
    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
Exemplo n.º 10
0
    def create_maze_with_varied_entrances(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
Exemplo n.º 11
0
    def create_maze_with_varied_entrances(start_outer=True, end_outer=True):
        """ create a maze with entrances inside/outside

        Args:
            start_outer (bool): should the start of the maze puzzle be on the boundary of the maze?
            end_outer (bool): should the end of the maze puzzle be on the boundary of the maze?
        Returns:
            Maze: a small, test maze grid with entrance and exit initialized
        """
        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