Exemplo n.º 1
0
 def test_size_of_fifth_example_map(self):
     self.assertEqual(
         31,
         scan_input(
             3,
             "^WSSEESWWWNW(S|NENNEEEENN(ESSSSW(NWSW|SSEN)|WSWWN(E|WWS(E|SS))))$"
         ).size(Location(3, 3)))
Exemplo n.º 2
0
 def test_two_paths_EiNSoW(self):
     self.assertEqual(
         str(scan_input(1, "^E(N|S)W$")), """
         #######
         #.#.|.#
         #####-#
         #.#X|.#
         #####-#
         #.#.|.#
         #######
         """.strip().replace(" ", ""))
Exemplo n.º 3
0
 def test_single_step_N(self):
     self.assertEqual(
         str(scan_input(1, "^N$")), """
         #######
         #.#.#.#
         ###-###
         #.#X#.#
         #######
         #.#.#.#
         #######
         """.strip().replace(" ", ""))
Exemplo n.º 4
0
 def test_full_circle_steps(self):
     self.assertEqual(
         str(scan_input(1, "^NESSWWNNE$")), """
         #######
         #.|.|.#
         #-#-#-#
         #.#X#.#
         #-###-#
         #.|.|.#
         #######
         """.strip().replace(" ", ""))
Exemplo n.º 5
0
 def test_two_steps_NE(self):
     self.assertEqual(
         str(scan_input(1, "^NE$")), """
         #######
         #.#.|.#
         ###-###
         #.#X#.#
         #######
         #.#.#.#
         #######
         """.strip().replace(" ", ""))
Exemplo n.º 6
0
 def test_triple_path(self):
     self.assertEqual(
         str(scan_input(1, "^(|W|E)S$")), """
         #######
         #.#.#.#
         #######
         #.|X|.#
         #-#-#-#
         #.#.#.#
         #######
         """.strip().replace(" ", ""))
Exemplo n.º 7
0
 def test_two_consecutive_branches(self):
     self.assertEqual(
         str(scan_input(2, "^E(N|S)W(N|W)W$")), """
         ###########
         #.#.|.#.#.#
         #####-#####
         #.|.|.|.#.#
         #######-###
         #.#.|X|.#.#
         #####-#-###
         #.|.|.|.#.#
         ###########
         #.#.#.#.#.#
         ###########
         """.strip().replace(" ", ""))
Exemplo n.º 8
0
 def test_nested_branches(self):
     self.assertEqual(
         str(scan_input(2, "^E(N|(S|))E$")), """
         ###########
         #.#.#.#.#.#
         ###########
         #.#.#.#.|.#
         #######-###
         #.#.#X|.|.#
         #######-###
         #.#.#.#.|.#
         ###########
         #.#.#.#.#.#
         ###########
         """.strip().replace(" ", ""))
Exemplo n.º 9
0
 def test_example_in_assignment(self):
     self.assertEqual(
         str(scan_input(2, "^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$")),
         """
         ###########
         #.|.#.|.#.#
         #-###-#-#-#
         #.|.|.#.#.#
         #-#####-#-#
         #.#.#X|.#.#
         #-#-#####-#
         #.#.|.|.|.#
         #-###-###-#
         #.|.|.#.|.#
         ###########
         """.strip().replace(" ", ""))
Exemplo n.º 10
0
 def test_size_of_fourth_example_map(self):
     self.assertEqual(
         23,
         scan_input(
             3, "^ESSWWN(E|NNENN(EESS(WNSE|)SSS|WWWSSSSE(SW|NNNE)))$").size(
                 Location(3, 3)))
Exemplo n.º 11
0
 def test_size_of_third_example_map(self):
     self.assertEqual(
         18,
         scan_input(2, "^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$").size(
             Location(2, 2)))
Exemplo n.º 12
0
 def test_size_of_second_example_map(self):
     self.assertEqual(
         10,
         scan_input(2, "^ENWWW(NEEE|SSE(EE|N))$").size(Location(2, 2)))
Exemplo n.º 13
0
 def test_size_of_small_map(self):
     self.assertEqual(3, scan_input(1, "^WNE$").size(Location(1, 1)))