Module aoc::y22d14

source ·
Expand description

Advent of Code 2022 Day 14: https://adventofcode.com/2022/day/14

Today’s puzzle is not too challenging. Essentially, we need to maintain a list of spaces that are occupied by rocks or sand and then simulate pieces of sand that fall down until they can’t anymore. As each piece of sand comes to rest it gets added to our list of occupied spaces. In part one when the sand would fall forever (it is below the lowest rock that we recorded from the puzzle input) we’re done. In part two there is a floor that extends forever in the “X” direction two spaces below the lowest recorded rock and so when there is no more space for the sand to fall as it’s reached the top we’re done.

Functions§

  • The solution for the day fourteen challenge.