2022 day 14, parts 1 & 2, before cleaning
This commit is contained in:
@@ -172,3 +172,61 @@ the path any new sand takes before falling forever is shown here with
|
||||
|
||||
Using your scan, simulate the falling sand. /How many units of sand come
|
||||
to rest before sand starts flowing into the abyss below?/
|
||||
|
||||
Your puzzle answer was =665=.
|
||||
|
||||
** --- Part Two ---
|
||||
You realize you misread the scan. There isn't an endless void at the
|
||||
bottom of the scan - there's floor, and you're standing on it!
|
||||
|
||||
You don't have time to scan the floor, so assume the floor is an
|
||||
infinite horizontal line with a =y= coordinate equal to /two plus the
|
||||
highest =y= coordinate/ of any point in your scan.
|
||||
|
||||
In the example above, the highest =y= coordinate of any point is =9=,
|
||||
and so the floor is at =y=11=. (This is as if your scan contained one
|
||||
extra rock path like =-infinity,11 -> infinity,11=.) With the added
|
||||
floor, the example above now looks like this:
|
||||
|
||||
#+begin_example
|
||||
...........+........
|
||||
....................
|
||||
....................
|
||||
....................
|
||||
.........#...##.....
|
||||
.........#...#......
|
||||
.......###...#......
|
||||
.............#......
|
||||
.............#......
|
||||
.....#########......
|
||||
....................
|
||||
<-- etc #################### etc -->
|
||||
#+end_example
|
||||
|
||||
To find somewhere safe to stand, you'll need to simulate falling sand
|
||||
until a unit of sand comes to rest at =500,0=, blocking the source
|
||||
entirely and stopping the flow of sand into the cave. In the example
|
||||
above, the situation finally looks like this after =93= units of sand
|
||||
come to rest:
|
||||
|
||||
#+begin_example
|
||||
............o............
|
||||
...........ooo...........
|
||||
..........ooooo..........
|
||||
.........ooooooo.........
|
||||
........oo#ooo##o........
|
||||
.......ooo#ooo#ooo.......
|
||||
......oo###ooo#oooo......
|
||||
.....oooo.oooo#ooooo.....
|
||||
....oooooooooo#oooooo....
|
||||
...ooo#########ooooooo...
|
||||
..ooooo.......ooooooooo..
|
||||
#########################
|
||||
#+end_example
|
||||
|
||||
Using your scan, simulate the falling sand until the source of the sand
|
||||
becomes blocked. /How many units of sand come to rest?/
|
||||
|
||||
Your puzzle answer was =25434=.
|
||||
|
||||
Both parts of this puzzle are complete! They provide two gold stars: **
|
||||
|
Reference in New Issue
Block a user