Expand description
This is my solution for Advent of Code - Day 11: Plutonian Pebbles
parse_input
turns the text into numbers.
count_after_blinks
solves both parts, calling count_for_stone
recursively. This is cached as there are a
lot of repeat small numbers at each depth. blink
handles a single blink.
StaticsΒ§
- COUNT_
FOR_ πSTONE Cached static for thecount_for_stone
function.
FunctionsΒ§
- blink πThis was originally written to work on the whole array of stones, but that wasnβt convenient for caching. It is left as is for convenience of using existing tests.
- count_
after_ πblinks Solves both parts. Delegates tocount_for_stone
for each stone in the list. - count_
for_ πstone Recursive function to calculate the expansion of a single stone. There are many repeats, especially for small numbers, so this is cached to allow the program to run quickly. - Origin of the cached function
count_for_stone
. - Primes the cached function
count_for_stone
. Recursive function to calculate the expansion of a single stone. There are many repeats, especially for small numbers, so this is cached to allow the program to run quickly. - parse_
input πTurn the space separated number strings intou64
s - The entry point for running the solutions with the βrealβ puzzle input.