Beispiel #1
0
    def testChainUnpruned(self):
        """ test against a maze with outer/inner entraces """
        starts = [True, False]
        ends = [True, False]

        for s in starts:
            for e in ends:
                m = self._create_maze_with_varied_entrances(s, e)
                m.solver = Chain(prune=False)
                m.solve()

                for sol in m.solutions:
                    self.assertTrue(self._one_away(m.start, sol[0]))
                    self.assertTrue(self._one_away(m.end, sol[-1]))
Beispiel #2
0
    def test_chain(self):
        """ test against a maze with outer/inner entraces """
        starts = [True, False]
        ends = [True, False]

        for s in starts:
            for e in ends:
                m = self.create_maze_with_varied_entrances(s, e)
                m.solver = Chain()
                m.solve()

                for sol in m.solutions:
                    self.assertFalse(self.duplicates_in_solution(sol))
                    self.assertTrue(self.one_away(m.start, sol[0]))
                    self.assertTrue(self.one_away(m.end, sol[-1]))
                    self.assertTrue(self.solution_is_sane(sol))