Module aoc::year2019::day25

source ·
Expand description

§Cryostasis

Plays the game automatically, solving the weight puzzle using Gray codes to check every combination of items by swapping only one item at a time.

Makes some assumptions:

  • The ship’s layout contains no loops, so a depth first search will explore every room then return to the starting point.
  • The 5 dangerous items are common across all inputs.
  • No items are called “north”, “south”, “west” or “east”.
  • The final room is called “Pressure-Sensitive Floor”.

If these assumptions hold then this solution will solve any arbitrary combination of ship layout and items.

Just for fun this solution can be played interactively on the command line if “–features frivolity” is enabled.

Functions§