# Cargo Bot help

Just discovered Cargo Bot and love it. I know that it has a tutorial but it’s not really complete. what do all the square and half square gadgets mean. I understand the arrows, but how about the green, yellow, none, rainbow mean. how do i use them and when. also when do i use prog 1, 2, 3 or 4. I found the solutions for the levels, but I would like to understand the process to the solution.

thanks

In a nutshell:

The green, yellow, none and rainbow are modifiers for another operation. If you have a left arrow in your program and put the green tab on it, then the left arrow will only run if the bot is currently holding a green box. Similarly blank is only run if the claw is empty and rainbow is if the claw holds any colour of box.

As to the progs, this is a key part of the system, basically it runs prog 1 at the start.
If you put things in prog 2, then this will only run if you put a prog 2 operation into program 1. Being able to chain up programs this way is key to most levels.

Additionally the programs run as a call stack which is key to later levels… It’s a bit difficult to explain simply, but running it in debug mode (stepping through operation by operation) should make it clear. Basically if a program calls another program, the first one is still running and will then continue when the called program finishes.

A probably not useful example would be the following factorial recursive function which relies on call stacks

function factorial(int n) {
if n > 1
n = n * factorial( n-1 )
else
n = 1
return n

If I call factorial (3) this will call factorial (2) which will call factorial (1).
When it get’s down to factorial (1) it just returns 1. Then it pops back up to the factorial (2) level which will receive 1 from it’s “factorial(n-1)” call, multiple this by 2 and return 2. Then it pops back up to factorial 3 which will receive the 2, multiply it by 3 and return the answer 6 to the user.

The key here is when it pops back to the calling program, the calling program then continues from where it was up to.

Awesome, just what i was looking for.