def test_data_load_5(self): # arrange a = AsteroidMap() asteroids = [ '.#..##.###...#######', '##.############..##.', '.#.######.########.#', '.###.#######.####.#.', '#####.##.#.##.###.##', '..#####..#.#########', '####################', '#.####....###.#.#.##', '##.#################', '#####.##.###..####..', '..######..##.#######', '####.##.####...##..#', '.#####..#.######.###', '##...#.##########...', '#.##########.#######', '.####.#.###.###.#.##', '....##.##.###..#####', '.#.#.###########.###', '#.#.#.#####.####.###', '###.##.####.##.#..##'] a.ReadMap(asteroids) # act c = a.count w = a.width result = a.GetBestLOS() # a.PrintAsteroids() a.PlotAsteroids() # assert self.assertEqual(c, 300) self.assertEqual(w, 20) self.assertEqual(result, (11,13)) self.assertEqual(a.astDict[result]['sees'], 210)
# Advent of Code 2019: https://adventofcode.com/2019/day/10 # # from AoC10_classes import AsteroidMap infile = open('data/input_10.txt', 'r') inputData1 = infile.readlines() # Part 1 w = AsteroidMap() w.ReadMap(inputData1) result = w.GetBestLOS() w.PlotAsteroids() print("Part 1: ", result, w.astDict[result]['sees']) # Part 2 result = w.RunAgain() print("Part 2: ", result)