def solve(components): def part1(data): data = parse(data) print(data) recursively_solve(data) print(data) def part2(data): pass class Test(unittest.TestCase): examples = [ "1 + 1", "1 * 2", "2 * 3 + (4 * 5)", "5 + (8 * 3 + 9 + 3 * 4 * 3)", "5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))", "((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2", ] def test1_part1_example1(self): self.assertEqual(2, part1(self.examples[0])) # self.assertEqual(26, part1(self.examples[2])) if __name__ == "__main__": # unittest.main() data = puzzle_input.from_arg_file()
spoken[number].append(turn) return number class Solution(Solution): def part1(self, input): input = parse_input(input) return van_eck_sequence(input, 2020) def part2(self, input): input = parse_input(input) return van_eck_sequence(input, 30000000) class Test(TimedTestCase): examples = puzzle_input.from_examples(__file__) # list of stripped str def test1_part1_example1(self): self.assertEqual(436, Solution().part1("0,3,6")) def test2_part2_example1(self): self.assertEqual(175594, Solution().part2("0,3,6")) if __name__ == "__main__": # unittest.main() input = puzzle_input.from_arg_file() print("Part 1:", Solution().part1(input)) print("Part 2:", Solution().part2(input))