I’ve been playing a game recently called Manufactoria (AKA Finite Automata: The Game) (Spoilers ahead). It’s complicated enough that I created a DSL to represent it, and a Komodo Edit plugin to provide syntax highlighting, indentation, and code folding. Why a separate language, you ask? Because the puzzle is really 3 parts:
- Find the right algorithm
- Implement the algorithm
- Make it fit on the stupid board
The game gets challenging enough that solving 2 and 3 simultaneously is more than I care to think about sometimes. To put it another way, would you rather generate the diagram below from nothing or from the code provided?
The code and pictured machine take in two numbers (with blue being 1 and red being 0) separated by a green, and puts something in the yellow box if and only if the first number is greater than the second (Numbers are Big Endian and must be read left to right). If the picture isn’t intimidating enough, play a few levels and you’ll appreciate the pain.