Esempio n. 1
0
    def test_solve(self):
        instructions = FileHelper.read_file(
            Path("../../Input/2018/Day16_1.txt"))
        chronal = Day16ChronalClassification()
        high_matches, op_code_correlations = chronal.solve_1(instructions)
        self.assertEqual(493, high_matches)

        instructions = FileHelper.read_file(
            Path("../../Input/2018/Day16_2.txt"))
        result = chronal.solve_2(instructions, op_code_correlations)
        self.assertEquals(1, result)
 def test_solve_2(self):
     init_state = \
         "#.#.#..##.#....#.#.##..##.##..#..#...##....###..#......###.#..#.....#.###.#...#####.####...#####.#.#"
     subterranean = Day12SubterraneanSustainability(50000000000)
     spread_table = FileHelper.read_file(Path("../../Input/2018/Day12.txt"))
     plant_containing_pots = subterranean.solve(initial_state=init_state,
                                                spread_table=spread_table)
     self.assertEqual(1250000000991, plant_containing_pots)
 def test_preparation_1(self) -> None:
     bingo_data = FileHelper.read_file(Path("../../Input/2021/Day04_1.txt"))
     self.assertEqual(
         4512,
         GiantSquid(bingo_data).solve(bingo_data[0].split(",")))
 def test_part_1(self):
     puzzle_input = FileHelper.read_file(Path("../../Input/2018/Day1.txt"))
     chronal_calibration = Day1ChronalCalibration()
     self.assertEquals(454, chronal_calibration.solve1(puzzle_input))
 def test_part_2(self):
     ids = FileHelper.read_file(Path("../../Input/2018/Day2.txt"))
     inventory_management_system = Day2InventoryManagementSystem()
     common_id_letters = inventory_management_system.solve2(ids)
     self.assertEqual("prtkqyluiusocwvaezjmhmfgx", common_id_letters)
 def test_solve_2(self) -> None:
     bingo_data = FileHelper.read_file(Path("../../Input/2021/Day04_2.txt"))
     self.assertEqual(
         16168,
         GiantSquid(bingo_data, True).solve(bingo_data[0].split(",")))
 def test_solve_b(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day03.txt"))
     result = BinaryDiagnostic().determine_life_supply(data)
     self.assertEqual(4996233, result)
 def test_1(self):
     corruption_checksum = Day2CorruptionChecksum()
     puzzle_input = FileHelper.read_file(Path("../../Input/2017/Day2.txt"))
     result = corruption_checksum.solve_a(puzzle_input)
     self.assertEquals(42299, result)
Esempio n. 9
0
 def test_solve_b(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day02.txt"))
     result = Dive(True).solve(data)
     self.assertEqual(1840311528, result)
Esempio n. 10
0
 def test_part_2(self):
     steps = FileHelper.read_file(Path("../../Input/2018/Day7.txt"))
     step_order = Day7TheSumOfItsParts(5, 60).solve2(steps)
     self.assertEqual(892, step_order)
 def test_part_2(self):
     guard_records = FileHelper.read_file(Path("../../Input/2018/Day4.txt"))
     _, predictable_sleep = Day4ReposeRecord().solve(guard_records)
     self.assertEqual(106850, predictable_sleep)
Esempio n. 12
0
 def test_part_2(self):
     test = FileHelper.read_file(Path("../../Input/2018/Day5.txt"))
     output_len = Day5AlchemicalReduction().solve2(test[0])
     self.assertEqual(6942, output_len)
 def test_part_1(self):
     guard_records = FileHelper.read_file(Path("../../Input/2018/Day4.txt"))
     max_sleep, _ = Day4ReposeRecord().solve(guard_records)
     self.assertEqual(71748, max_sleep)
Esempio n. 14
0
 def test_solve_2(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day06.txt"))
     result = Lanternfish().solve(data[0], 256)
     self.assertEqual(1743335992042, result)
Esempio n. 15
0
 def test_solve_1(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day06.txt"))
     result = Lanternfish().solve(data[0], 80)
     self.assertEqual(389726, result)
 def test_part_2(self):
     coordinates = FileHelper.read_file(Path("../../Input/2018/Day6.txt"))
     largest_area = Day6ChronalCoordinates(coordinates, 10000).solve2()
     self.assertEqual(36216, largest_area)
 def test_part_1(self):
     coordinates = FileHelper.read_file(Path("../../Input/2018/Day6.txt"))
     largest_area = Day6ChronalCoordinates(coordinates).solve1()
     self.assertEqual(5532, largest_area)
Esempio n. 18
0
 def test_solve_a(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day02.txt"))
     result = Dive(False).solve(data)
     self.assertEqual(2073315, result)
 def test_part_2(self):
     license_input = FileHelper.read_file(Path("../../Input/2018/Day8.txt"))
     step_order = Day8MemoryManeuver(True).solve(license_input[0])
     self.assertEqual(40292, step_order)
Esempio n. 20
0
 def test_part_1(self):
     steps = FileHelper.read_file(Path("../../Input/2018/Day7.txt"))
     step_order = Day7TheSumOfItsParts().solve1(steps)
     self.assertEqual("CHILFNMORYKGAQXUVBZPSJWDET", step_order)
Esempio n. 21
0
 def test_solve_2(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day07.txt"))
     result = TheTreacheryOfWhales().solve(data[0], True)
     self.assertEqual(96592275, result)
 def test_solve_a(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day03.txt"))
     result = BinaryDiagnostic().determine_power_consumption(data)
     #
     self.assertEqual(3912944, result)
Esempio n. 23
0
 def test_solve_2(self) -> None:
     data = FileHelper.read_file(Path("../../Input/2021/Day05.txt"))
     result = HydrothermalVenture(True).solve(data)
     self.assertEqual(21101, result)
 def test_part_2(self):
     claims = FileHelper.read_file(Path("../../Input/2018/Day3.txt"))
     claim_overlap = Day3NoMatterHowYouSliceIt(1000).solve2(claims)
     self.assertEqual(116, claim_overlap)
Esempio n. 25
0
 def test_part_2(self):
     marble_input = FileHelper.read_file(Path("../../Input/2018/Day9.txt"))
     step_order = Day9MarbleMania(marble_input[0], 100).solve()
     self.assertEqual(3085518618, step_order)
Esempio n. 26
0
 def test_solve_2(self):
     acres = FileHelper.read_file(Path("../../Input/2018/Day18.txt"))
     north_pole_acres = Day18SettlersOfTheNorthPole(1000000000)
     resources = north_pole_acres.solve(acres)
     self.assertEqual(233058, resources)
 def test_part_1(self):
     ids = FileHelper.read_file(Path("../../Input/2018/Day2.txt"))
     inventory_management_system = Day2InventoryManagementSystem()
     checksum = inventory_management_system.solve1(ids)
     self.assertEqual(6723, checksum)