def test_data_load_4(self): # arrange a = AsteroidMap() asteroids = [ '.#..#..###', '####.###.#', '....###.#.', '..###.##.#', '##.##.#.#.', '....###..#', '..#.#..#.#', '#..#.#.###', '.##...##.#', '.....#.#..'] a.ReadMap(asteroids) # act c = a.count w = a.width result = a.GetBestLOS() # assert self.assertEqual(c, 50) self.assertEqual(w, 10) self.assertEqual(result, (6,3)) self.assertEqual(a.astDict[result]['sees'], 41)
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)
def test_best_view_1(self): # arrange a = AsteroidMap() asteroids = [ '.#..#', '.....', '#####', '....#', '...##'] a.ReadMap(asteroids) # pprint(a.astDict) # act c = a.count w = a.width result = a.GetBestLOS() a.PrintAsteroids() # assert self.assertEqual(c, 10) self.assertEqual(w, 5) self.assertEqual(result, (3,4))
# 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)