Skip to content

Commit

Permalink
[2024/11] add --num_blinks script arg
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlitGhost committed Dec 11, 2024
1 parent 31bb945 commit a997dd8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 2024/11/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
from collections import Counter, defaultdict


aoc.argparser.add_argument("-n", "--num_blinks", default=0, type=int,
help="number of times to blink")


@cache
def num_digits(value: int) -> int:
return int(math.log10(value)) + 1
Expand Down Expand Up @@ -48,6 +52,11 @@ def main():
if aoc.args.verbose:
print(start_stones)

if aoc.args.num_blinks > 0:
stones = blink_n_times(start_stones, aoc.args.num_blinks)
print(f"{aoc.args.num_blinks} blinks: {sum(stones.values())}")
exit(0)

stones = blink_n_times(start_stones, 25)
print(f"p1: {sum(stones.values())}")

Expand Down

0 comments on commit a997dd8

Please sign in to comment.