DEV Community

Cover image for Many-Worlds Interpretation
Robert Mion
Robert Mion

Posted on

Many-Worlds Interpretation

Advent of Code 2019 Day 18

Try the simulator using my puzzle input!

Animation of tunnel game

Task: Solve for X where...

X = the number of steps in the shortest path that collects all of the keys
Enter fullscreen mode Exit fullscreen mode

Example input

#########
#b.A.@.a#
#########
Enter fullscreen mode Exit fullscreen mode

It represents:

  • A map of tunnels
  • @ is the entrance
  • .s are open spaces
  • #s are walls
  • A-Z are doors
  • a-z are keys that unlock the corresponding uppercase door

Part 1

  1. I can't solve it manually or algorithmically
  2. But I can make it a game!

I can't solve it manually or algorithmically

  • Perhaps if my puzzle input were the same scope as the examples: less than 10 keys and doors within a 20x20 area
  • But my puzzle input is a 40x40 area with the full alphabet of keys and doors

I'm not motivated enough to attempt to identify even a single possible way to solve the puzzle...
...let alone the shortest path!

And I'm still not educated on pathfinding algorithms to write one capable of solving this puzzle.

But I can make it a game!

  • And that's exactly what I did!
  • To make it even harder, but fit on a screen without requiring scrolling, I limited the field of vision to roughy 6 spaces in all directions from the player

The result is a masochistic game that I challenge you to play!

Try the simulator using my puzzle input!
Animation of tunnel game

Short and sweet

  • I couldn't solve Part 1, so I didn't even see Part 2
  • But I repurposed my code from an earlier Intcode computer simulator to make today's puzzle into a game

Top comments (0)