def test_can_parse_string_map(): input = """..#.......... ..#.......... #######...### #.#...#...#.# ############# ..#...#...#.. ..#####...^..""" m = str_to_map(input) s = print_map(m) bounds = find_bounds(m) intersections = find_intersections(m) c = calibrate(intersections) v = find_vaccumm_robots(m) p = find_path(v[0], m) assert s == input assert m[(2, 2)] == "#" assert bounds == (0, 12, 0, 6) assert intersections == [(2, 2), (2, 4), (6, 4), (10, 4)] assert c == 76 assert v[0] == ((10, 6), "^") assert p == [ "4", "R", "2", "R", "2", "R", "12", "R", "2", "R", "6", "R", "4", "R", "4", "R", "6" ]
def test_infinity_after_10min(): input = """....# #..#. #..## ..#.. #....""" m = parse_map(input) r = infinity_map_run(m, 10) output = print_map(r) assert output == """.#...
def test_can_step_state_1m(): input = """....# #..#. #..## ..#.. #....""" m = parse_map(input) r = step_bugs(m) output = print_map(r) print(output) assert output == """#..#.
def test_can_find_pattern(): input = """....# #..#. #..## ..#.. #....""" m = parse_map(input) r = find_repeated_pattern(m) rating = biodiversity_rating(r) output = print_map(r) print(output) assert output == """..... ..... ..... #.... .#...""" assert rating == 2129920
def select_party(): html = main.print_map(request.get_json()['party-name'], party_dict, grid) return html