Skip to main content

Module day17

Module day17 

Source
Expand description

ยงReservoir Research

Starting from the spring, recursively works out the kind of each tile, memoizing values for efficiency. Tiles are one of 3 kinds:

  • Sand Indicates a tile of unknown type.
  • Moving Flowing water.
  • Stopped Either clay tile or water that has settled.

This problem is similar to Year 2022 Day 14.

Structsยง

Scan

Enumsยง

Kind ๐Ÿ”’

Functionsยง

flow ๐Ÿ”’
Recursively work out the kind of each tile, memoizing values for efficiency.
parse
part1
part2
spread ๐Ÿ”’
Check the neighboring horizontal tile first to see if we can keep spreading, then check the tile underneath. Speed things up by first checking via the middle condition if the tile is already stopped water or clay.