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:
SandIndicates a tile of unknown type.MovingFlowing water.StoppedEither clay tile or water that has settled.
This problem is similar to Year 2022 Day 14.
Structsยง
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.