RoboZZle Wiki

It is said that a process or procedure is recursive if a step on it is the process itself. For example you can say that sorting a list is finding the first element, moving it apart, and sorting the remaining list.

In roboZZle a function is recursive if it calls itself. For example F1 is recursive if it contains the command Execute F1.

There are two basic uses for recursion in robZZle, one is making loops and the other one, more complex, is memorizing things.

To make a loop you usualy place the code that needs to be repeated in the begining of a function, followed by the recursive call.

Edit

Examples

Go straight forever:

  • F1: Move forwardExecute F1

Go straight while blue:

  • F1: Move forwardOn blue execute F1

Go straight until blue:

  • F1: Move forwardOn red execute F1On green execute F1

Go straight but turn right on red tiles:

  • F1: Move forwardOn red turn rightExecute F1

When the recursive call is conditional (colored) the condition is called stop condition. When the stop condition is not satisfied the call returns, and the code after the recursive call is executed for every recursive call executed. This may be confusing at first but very useful as we will see later.

ScrewTurn Wiki version 2.0.36. Some of the icons created by FamFamFam.