Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions python/_2019/q01.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ def part_two(self, input: utils.Input) -> str | int:
return fuel


puzzle = Puzzle(
year=2019,
day=1,
test_answers=("33583", "50346"),
test_input="""100756""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=1,
test_answers=("33583", "50346"),
test_input="""100756""",
)
runner.cli()
puzzle.cli()
15 changes: 8 additions & 7 deletions python/_2019/q02.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ def part_two(self, input: utils.Input) -> str | int:
return -1


puzzle = Puzzle(
year=2019,
day=2,
test_answers=("30", "no-answer"),
test_input="""1,1,1,4,99,5,6,0,99""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=2,
test_answers=("30", "no-answer"),
test_input="""1,1,1,4,99,5,6,0,99""",
)
runner.cli()
puzzle.cli()
17 changes: 9 additions & 8 deletions python/_2019/q03.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ def part_two(self, input: utils.Input) -> str | int:
return min(steps1 + p2.get(pp, int(1e9)) for pp, steps1 in p1.items())


if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=3,
test_answers=("159", "610"),
test_input="""R75,D30,R83,U83,L12,D49,R71,U7,L72
puzzle = Puzzle(
year=2019,
day=3,
test_answers=("159", "610"),
test_input="""R75,D30,R83,U83,L12,D49,R71,U7,L72
U62,R66,U55,R34,D71,R55,D58,R83""",
)
runner.cli()
)

if __name__ == "__main__":
puzzle.cli()
15 changes: 8 additions & 7 deletions python/_2019/q04.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ def valid(n: int) -> bool:
return sum(valid(check) for check in range(start, end + 1))


puzzle = Puzzle(
year=2019,
day=4,
test_answers=("no-answer", "no-answer"),
test_input="""""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=4,
test_answers=("no-answer", "no-answer"),
test_input="""""",
)
runner.cli()
puzzle.cli()
5 changes: 3 additions & 2 deletions python/_2019/q05.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def part_two(self, input: utils.Input) -> str | int:
return int(program.run()[-1])


puzzle = Puzzle(year=2019, day=5, no_tests=True)

if __name__ == "__main__":
runner = Puzzle(year=2019, day=5, no_tests=True)
runner.cli()
puzzle.cli()
17 changes: 9 additions & 8 deletions python/_2019/q06.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ def part_two(self, input: utils.Input) -> str | int:
return min_san + min_you


if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=6,
test_answers=("54", "4"),
test_input="""COM)B
puzzle = Puzzle(
year=2019,
day=6,
test_answers=("54", "4"),
test_input="""COM)B
B)C
C)D
D)E
Expand All @@ -62,5 +61,7 @@ def part_two(self, input: utils.Input) -> str | int:
K)L
K)YOU
I)SAN""",
)
runner.cli()
)

if __name__ == "__main__":
puzzle.cli()
17 changes: 9 additions & 8 deletions python/_2019/q07.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ def part_two(self, input: utils.Input) -> str | int:
return best


puzzle = Puzzle(
year=2019,
day=7,
test_answers=("43210", "139629729"),
test_input="""3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0""",
test_input_2="""3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=7,
test_answers=("43210", "139629729"),
test_input="""3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0""",
test_input_2="""3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5""",
)
runner.cli()
puzzle.cli()
15 changes: 8 additions & 7 deletions python/_2019/q08.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ def part_two(self, input: utils.Input) -> str | int:
return message


puzzle = Puzzle(
year=2019,
day=8,
test_answers=("1", ""),
test_input="""123456789012""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=8,
test_answers=("1", ""),
test_input="""123456789012""",
)
runner.cli()
puzzle.cli()
15 changes: 8 additions & 7 deletions python/_2019/q09.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ def part_two(self, input: utils.Input) -> str | int:
return int(interpreter.run()[-1])


puzzle = Puzzle(
year=2019,
day=9,
test_answers=("99", "99"),
test_input="""109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=9,
test_answers=("99", "99"),
test_input="""109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99""",
)
runner.cli()
puzzle.cli()
19 changes: 10 additions & 9 deletions python/_2019/q10.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ def both_parts(self, input: utils.Input) -> tuple[str | int, str | int]:
return best_view, a_200th[1] * 100 + a_200th[0]


if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=10,
both=True,
test_answers=("8", "no-answer"),
test_input=""".#..#
puzzle = Puzzle(
year=2019,
day=10,
both=True,
test_answers=("8", "no-answer"),
test_input=""".#..#
.....
#####
....#
...##""",
)
runner.cli()
)

if __name__ == "__main__":
puzzle.cli()
19 changes: 10 additions & 9 deletions python/_2019/q11.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ def both_parts(self, input: utils.Input) -> tuple[int | str, int | str]:
return lengths[0], "".join(message)


puzzle = Puzzle(
year=2019,
day=11,
both=True,
no_tests=True,
test_answers=("", ""),
test_input="""""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=11,
both=True,
no_tests=True,
test_answers=("", ""),
test_input="""""",
)
runner.cli()
puzzle.cli()
17 changes: 9 additions & 8 deletions python/_2019/q12.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ def part_two(self, input: utils.Input) -> str | int:
return reduce(math.lcm, cycles)


if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=12,
test_answers=("1940", "4686774924"),
test_input="""<x=-8, y=-10, z=0>
puzzle = Puzzle(
year=2019,
day=12,
test_answers=("1940", "4686774924"),
test_input="""<x=-8, y=-10, z=0>
<x=5, y=5, z=10>
<x=2, y=-7, z=3>
<x=9, y=-8, z=-3>""",
)
runner.cli()
)

if __name__ == "__main__":
puzzle.cli()
19 changes: 10 additions & 9 deletions python/_2019/q13.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ def both_parts(self, input: utils.Input) -> tuple[str | int, str | int]:
return num_blocks, score


puzzle = Puzzle(
year=2019,
day=13,
both=True,
no_tests=True,
test_answers=("", ""),
test_input="""""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=13,
both=True,
no_tests=True,
test_answers=("", ""),
test_input="""""",
)
runner.cli()
puzzle.cli()
19 changes: 10 additions & 9 deletions python/_2019/q14.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ def both_parts(self, input: utils.Input) -> tuple[int | str, int | str]:
return ore_1_fuel, max_fuel


if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=14,
both=True,
test_answers=("13312", "82892753"),
test_input="""157 ORE => 5 NZVS
puzzle = Puzzle(
year=2019,
day=14,
both=True,
test_answers=("13312", "82892753"),
test_input="""157 ORE => 5 NZVS
165 ORE => 6 DCFZ
44 XJWVT, 5 KHKGT, 1 QDVJ, 29 NZVS, 9 GPVTF, 48 HKGWZ => 1 FUEL
12 HKGWZ, 1 GPVTF, 8 PSHF => 9 QDVJ
Expand All @@ -74,5 +73,7 @@ def both_parts(self, input: utils.Input) -> tuple[int | str, int | str]:
7 DCFZ, 7 PSHF => 2 XJWVT
165 ORE => 2 GPVTF
3 DCFZ, 7 NZVS, 5 HKGWZ, 10 PSHF => 8 KHKGT""",
)
runner.cli()
)

if __name__ == "__main__":
puzzle.cli()
15 changes: 8 additions & 7 deletions python/_2019/q15.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ def both_parts(self, input: utils.Input) -> tuple[str | int, str | int]:
return steps_to_oxygen, time_to_fill


puzzle = Puzzle(
year=2019,
day=15,
both=True,
no_tests=True,
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=15,
both=True,
no_tests=True,
)
runner.cli()
puzzle.cli()
15 changes: 8 additions & 7 deletions python/_2019/q16.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ def part_two(self, input: utils.Input) -> str | int:
return "".join(str(ix) for ix in in_signal[offset : offset + 8])


puzzle = Puzzle(
year=2019,
day=16,
test_answers=("24176176", ""),
test_input="""80871224585914546619083218645595""",
)

if __name__ == "__main__":
runner = Puzzle(
year=2019,
day=16,
test_answers=("24176176", ""),
test_input="""80871224585914546619083218645595""",
)
runner.cli()
puzzle.cli()
Loading
Loading