EditDirty tricks
These are tricks that can be used to manipulate the RoboZZle game to figure out a solution to hard puzzle. Feel free to use them as you find them useful... for some puzzles, you'll need all the help you can get.
EditUse puzzle designer as a sandbox
The puzzle designer can be used as a sandbox where you create simpler versions of the puzzle you are trying to solve. Your simpler version could:
- Allow more commands and/or functions. Then, you can figure out how to fit your program into the puzzle constraints
- Put the robot into a starting position that is easier to reason about. For example, many puzzles require that the robot solves a particular problem for increasing problem sizes. In the first step, the robot will have to solve the problem of size 1, and it may be harder to see where things go wrong.
- Remove some complexity from the puzzle.
recursive and
life96 independently started using this trick to tackle difficult puzzles.
EditSketch the path in an image editor
For some puzzles, it is difficult to figure out what is the path that the robot should take. It can be useful to take a screenshot, open it in an image editor, and experiment with drawing lines that represent paths the robot could take.
This trick was originally
pointed out by
rako.
EditInsert a fake breakpoint
If a recursive solution is slightly wrong, the robot path will often bear little resemblance to the intended solution. One missing turn can make the path look unrecognizable.
One trick that is sometimes useful is to insert a "fake breakpoint" at a particular place in the program. A fake breakpoint is a function that calls itself in a tight loop that does not contain any directional commands. Since the robot will never move after entering the function, the game stops the animation.
In this example, we insert a fake breakpoint into F1 while deep inside a recursive call, stopping the robot in its place:
EditAdd unnecessary colors to reveal opportunities for program shrinking
After you've created a working program, try to add as many colors to the commands as possible while maintaining the program's correctness. After you have most of the commands colored, optimizations frequently become visible. Many of these optimizations are of the form of re-using one function for multiple purposes depending on context, or finding new uses for functions that were not previously apparent.