|
| 1 | +## \--- Day 11: Plutonian Pebbles --- |
| 2 | + |
| 3 | +The ancient civilization on [Pluto](https://adventofcode.com/2019/day/20) was known for its ability to manipulate spacetime, and while The Historians explore their infinite corridors, you've noticed a strange set of physics-defying stones. |
| 4 | + |
| 5 | +At first glance, they seem like normal stones: they're arranged in a perfectly _straight line_, and each stone has a _number_ engraved on it. |
| 6 | + |
| 7 | +The strange part is that every time you blink, the stones _change_. |
| 8 | + |
| 9 | +Sometimes, the number engraved on a stone changes. Other times, a stone might _split in two_, causing all the other stones to shift over a bit to make room in their perfectly straight line. |
| 10 | + |
| 11 | +As you observe them for a while, you find that the stones have a consistent behavior. Every time you blink, the stones each _simultaneously_ change according to the _first applicable rule_ in this list: |
| 12 | + |
| 13 | +- If the stone is engraved with the number `0`, it is replaced by a stone engraved with the number `1`. |
| 14 | +- If the stone is engraved with a number that has an _even_ number of digits, it is replaced by _two stones_. The left half of the digits are engraved on the new left stone, and the right half of the digits are engraved on the new right stone. (The new numbers don't keep extra leading zeroes: `1000` would become stones `10` and `0`.) |
| 15 | +- If none of the other rules apply, the stone is replaced by a new stone; the old stone's number _multiplied by 2024_ is engraved on the new stone. |
| 16 | + |
| 17 | +No matter how the stones change, their _order is preserved_, and they stay on their perfectly straight line. |
| 18 | + |
| 19 | +How will the stones evolve if you keep blinking at them? You take a note of the number engraved on each stone in the line (your puzzle input). |
| 20 | + |
| 21 | +If you have an arrangement of five stones engraved with the numbers `0 1 10 99 999` and you blink once, the stones transform as follows: |
| 22 | + |
| 23 | +- The first stone, `0`, becomes a stone marked `1`. |
| 24 | +- The second stone, `1`, is multiplied by 2024 to become `2024`. |
| 25 | +- The third stone, `10`, is split into a stone marked `1` followed by a stone marked `0`. |
| 26 | +- The fourth stone, `99`, is split into two stones marked `9`. |
| 27 | +- The fifth stone, `999`, is replaced by a stone marked `2021976`. |
| 28 | + |
| 29 | +So, after blinking once, your five stones would become an arrangement of seven stones engraved with the numbers `1 2024 1 0 9 9 2021976`. |
| 30 | + |
| 31 | +Here is a longer example: |
| 32 | + |
| 33 | +``` |
| 34 | +Initial arrangement: |
| 35 | +125 17 |
| 36 | +
|
| 37 | +After 1 blink: |
| 38 | +253000 1 7 |
| 39 | +
|
| 40 | +After 2 blinks: |
| 41 | +253 0 2024 14168 |
| 42 | +
|
| 43 | +After 3 blinks: |
| 44 | +512072 1 20 24 28676032 |
| 45 | +
|
| 46 | +After 4 blinks: |
| 47 | +512 72 2024 2 0 2 4 2867 6032 |
| 48 | +
|
| 49 | +After 5 blinks: |
| 50 | +1036288 7 2 20 24 4048 1 4048 8096 28 67 60 32 |
| 51 | +
|
| 52 | +After 6 blinks: |
| 53 | +2097446912 14168 4048 2 0 2 4 40 48 2024 40 48 80 96 2 8 6 7 6 0 3 2 |
| 54 | +``` |
| 55 | + |
| 56 | +In this example, after blinking six times, you would have `22` stones. After blinking 25 times, you would have `55312` stones! |
| 57 | + |
| 58 | +Consider the arrangement of stones in front of you. _How many stones will you have after blinking 25 times?_ |
| 59 | + |
| 60 | + |
| 61 | +Your puzzle answer was `[REDACTED]`. |
| 62 | + |
| 63 | +The first half of this puzzle is complete! It provides one gold star: ⭐ |
0 commit comments