def setUp(self): example = """.#.#.# ...##. #....# ..#... #.#..# ####..""" self.grid = convert_string_to_grid(example)
def test_convert_example_string(self): example = """.#.#.# ...##. #....# ..#... #.#..# ####..""" grid = convert_string_to_grid(example) self.assertEqual(example, str(grid))
def test_example_2(self): grid = convert_string_to_grid( """##.#.# ...##. #....# ..#... #.#..# ####.#""" ) expect = """##.### .##..# .##... .##... #.#... ##...#""" print grid for _ in range(5): grid.step_with_stuck_lights() print print grid self.assertEqual(expect, str(grid))
def test_puzzle_2(self): grid = convert_string_to_grid(INPUT_STRING) for _ in range(100): grid.step_with_stuck_lights() print grid.get_num_lights()