예제 #1
0
 def test_get_path_options_simple(self):
     cave_map = load_map(get_test_file_path("samples/d12/small_map.txt"))
     self.assertListEqual(get_path_options(cave_map, ["start", "b"]),
                          ["A", "d", "end"])
     self.assertListEqual(get_path_options(cave_map, ["start", "A"]),
                          ["c", "b", "end"])
     self.assertListEqual(get_path_options(cave_map, ["start", "b"], 2),
                          ["A", "d", "end"])
     self.assertListEqual(get_path_options(cave_map, ["start", "A"], 2),
                          ["c", "b", "end"])
예제 #2
0
    def test_get_path_options_revisit_small_once(self):
        cave_map = load_map(get_test_file_path("samples/d12/small_map.txt"))
        # No change to rules on revisiting large caves
        self.assertListEqual(
            get_path_options(cave_map, ["start", "A", "b"], 2),
            ["A", "d", "end"])

        # May revisit a singel small cave
        self.assertListEqual(
            get_path_options(cave_map, ["start", "b", "A"], 2),
            ["c", "b", "end"])

        # But may not re-visit for a third time
        self.assertListEqual(
            get_path_options(cave_map, ["start", "b", "A", "b", "A"], 2),
            ["c", "end"])
예제 #3
0
 def test_get_path_options_revisit_single_small_once(self):
     cave_map = load_map(get_test_file_path("samples/d12/small_map.txt"))
     # May only visit *one* small cave twice
     self.assertListEqual(
         get_path_options(cave_map, ["start", "b", "A", "b", "A", "c", "A"],
                          2), ["end"])