コード例 #1
0
 def test_part_two_base_case_00(self):
     pf = PathFinderBFS(self.test_cave,
                        TEST_TARGET_X,
                        TEST_TARGET_Y,
                        initial_x=10,
                        initial_y=10)
     self.assertEqual(pf.find_quickest_path(), 0)
コード例 #2
0
 def test_part_two_base_case_06(self):
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=6,
         initial_y=12,
         initial_equip=Equipment.CLIMB,
     )
     self.assertEqual(pf.find_quickest_path(), 13)
コード例 #3
0
 def test_part_two_final(self):  # 10m 8s with culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=0,
         initial_y=0,
         initial_equip=Equipment.TORCH,
     )
     self.assertEqual(pf.find_quickest_path(), 45)
コード例 #4
0
 def test_part_two_base_case_22(self):  # 6m 30s with culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=1,
         initial_y=1,
         initial_equip=Equipment.NO,
     )
     self.assertEqual(pf.find_quickest_path(), 36)
コード例 #5
0
 def test_part_two_base_case_22_plus_switch(self):  # 7m 15s with culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=1,
         initial_y=1,
         initial_equip=Equipment.TORCH,
     )
     self.assertEqual(pf.find_quickest_path(), 43)
コード例 #6
0
 def test_part_two_base_case_14(self):  # 3m 22s vs 5s culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=4,
         initial_y=6,
         initial_equip=Equipment.CLIMB,
     )
     self.assertEqual(pf.find_quickest_path(), 21)
コード例 #7
0
 def test_part_two_base_case_19_plus_switch(self):  # 1m 49s culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=4,
         initial_y=1,
         initial_equip=Equipment.NO,
     )
     self.assertEqual(pf.find_quickest_path(), 33)
コード例 #8
0
 def test_part_two_base_case_16(
         self):  # 17m 26s...quite the big jump vs 18s with culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=4,
         initial_y=4,
         initial_equip=Equipment.CLIMB,
     )
     self.assertEqual(pf.find_quickest_path(), 23)
コード例 #9
0
 def test_part_two_base_case_15(self):
     # 8m 9s vs 9s culling here we go with the jumps...I wonder what happens at this case?
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=4,
         initial_y=5,
         initial_equip=Equipment.CLIMB,
     )
     self.assertEqual(pf.find_quickest_path(), 22)
コード例 #10
0
 def test_part_two_base_case_13(
         self):  # 2m 27s vs 2m 8s counting ticks vs 4s with culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=4,
         initial_y=7,
         initial_equip=Equipment.CLIMB,
     )
     self.assertEqual(pf.find_quickest_path(), 20)
コード例 #11
0
 def test_part_two_base_case_12(
         self):  # 1m 47s vs 1m 27s counting ticks vs 3s with culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=4,
         initial_y=8,
         initial_equip=Equipment.CLIMB,
     )
     self.assertEqual(pf.find_quickest_path(), 19)
コード例 #12
0
 def test_part_two_base_case_23(
     self
 ):  # 9m 3s with culling (one more tick added almost two minutes :sadface:)
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=0,
         initial_y=1,
         initial_equip=Equipment.TORCH,
     )
     self.assertEqual(pf.find_quickest_path(), 44)
コード例 #13
0
 def test_part_two_base_case_19(
         self
 ):  # takes over 20 minutes in exhaustive BFS? ... 60s with culling
     pf = PathFinderBFS(
         self.test_cave,
         TEST_TARGET_X,
         TEST_TARGET_Y,
         initial_x=4,
         initial_y=1,
         initial_equip=Equipment.CLIMB,
     )
     self.assertEqual(pf.find_quickest_path(), 26)