def test_p1_c(self): m = ".#..#..###\n####.###.#\n....###.#.\n..###.##.#\n##.##.#.#.\n....###..#\n..#.#..#.#\n#..#.#.###\n.##...##.#\n.....#.#.." m = parse_map(m) asteroids = get_asteroids(m) a = get_best_asteroid(asteroids) self.assertEqual(6, a.x) self.assertEqual(3, a.y) self.assertEqual(41, a.nb_in_sight)
def test_p1_d(self): m = ".#..##.###...#######\n##.############..##.\n.#.######.########.#\n.###.#######.####.#.\n#####.##.#.##.###.##\n..#####..#.#########\n####################\n#.####....###.#.#.##\n##.#################\n#####.##.###..####..\n..######..##.#######\n####.##.####...##..#\n.#####..#.######.###\n##...#.##########...\n#.##########.#######\n.####.#.###.###.#.##\n....##.##.###..#####\n.#.#.###########.###\n#.#.#.#####.####.###\n###.##.####.##.#..##" m = parse_map(m) asteroids = get_asteroids(m) a = get_best_asteroid(asteroids) self.assertEqual(11, a.x) self.assertEqual(13, a.y) self.assertEqual(210, a.nb_in_sight)
def test_p1_b(self): m = "#.#...#.#.\n.###....#.\n.#....#...\n##.#.#.#.#\n....#.#.#.\n.##..###.#\n..#...##..\n..##....##\n......#...\n.####.###." m = parse_map(m) asteroids = get_asteroids(m) a = get_best_asteroid(asteroids) self.assertEqual(1, a.x) self.assertEqual(2, a.y) self.assertEqual(35, a.nb_in_sight)
def test_p2(self): m = ".#....#####...#..\n##...##.#####..##\n##...#...#.#####.\n..#.....#...###..\n..#.#.....#....##" m = parse_map(m) asteroids = get_asteroids(m) a = get_best_asteroid(asteroids) self.assertEqual(8, a.x) self.assertEqual(3, a.y) params = ( (1, (8, 1)), (9, (15, 1)), (18, (4, 4)), (27, (5, 1)), ) for n, coords in params: tgt = obliterate(a, asteroids, n) self.assertEqual(coords, tgt.coords)