Please wait...


Golden Quest Game Rules

Take to the high seas, visit islands and code your robot to dig for buried treasure – but watch out, you’re not alone!

This is the story of Cody, a pirate robot in the quest for golden treasures. We will follow Cody from one island to another and we will be an active partner during the adventure.


You are going to learn how to write real algorithms that solve challenges. At each challenge, you need to find the correct sequence of actions that lead Cody to find a treasure. The code editor is on the left-hand side. The Play button in the middle will make Cody execute the code, step by step.

The following topics will be covered all along the adventure.

  • Sequence of actions
  • Loops (repeat, while)
  • Defining and calling methods
  • Variables
  • Conditionals
  • … And more advanced topics

Basic actions

We need to help Cody by writing the needed sequence of actions to get the treasure.

The code editor is on the left side. The Play button in the middle will make Cody start the introduced instructions.


For example, right(2) means to take two steps to the right. The steps can be easily measured through the grid shown in the island.

right(2) in the following island will make Cody to arrive to the treasure position.

right() does not mean to make Cody turn right, not left() to turn left. Go right is from the view of the person who plays.

The level is restarted if …

Cody falls into the water

Cody walk close to an skeleton without fighting

Cody will not advance if there are blocking objects such as bushes, palm trees or barrels.


To destroy an enemy, Cody should be one step close to the enemy and then fight(). That means that Cody should not try to go to the exact position of an enemy but one step less and fight().

The direction is not important. For example, Cody can go up() and then fight() an enemy which is on its right.

Cody can only beat one enemy at a time. If there are several enemies around the position of Cody, Cody will beat one but the other one will attack and the level will be restarted.


Jumping is specially useful when the next step is water. This way, Cody avoid to fall in the water. In general, when Cody jumps, it advances two steps.

Cody needs to take a little run to jump in a direction. Otherwise, it will jump vertically and fall in the same position.

Blocking objects (palm trees or bushes) cannot be jumped.

Cody will lose the little run if blocked. 

Cody cannot attack during a jump. If Cody jump() and then fight(), the fight() will happen once Cody is on the ground.

Skeletons will attack while Cody is jumping if Cody is close to them. The level will be restarted.


Teleporters come in pairs which are distinguishable by the color. If Cody is in the teleporter position (walking or while jumping) it will appear in the counterpart teleporter and it will be dropped one step further of its previous direction.

If Cody jumps in the position of a teleporter, the jump will happen after it landed at the other side. The little run is kept in the current direction.

Teleporter pairs can be chained.

Teleporter pairs can be chained.

Skeletons will attack if Cody appear in one teleporter.

If there is a blocking element in the landing place. Cody will come back inside the teleporter in the opposite direction.

Push Button

Buttons serve to activate or deactivate a set of mechanisms associated with the color of the button. pushButton outside of a button position has no side effect.



For pushing a button, Cody needs to stop. Cody will lose the little run for jumping.

Time limit

Some levels can have time limit to solve them. However, the level can be played again and the inserted code will be kept.

The time progress is shown in the form of Voltar progressing to a treasure.

Play language


The play language (the one that Cody understands) is a case-sensitive procedural programming language.

The main procedure, the entry point to start the actions, is always :

In the same way, we can define other procedures to be reused by calling them as many times as we want.

We can use any name for the procedure (no whitespaces nor special characters) and names cannot be repeated if they take the same number of parameters.


The play language only allows numeric variables.

For example, in the following code, we declare the variable x and we assign it the value of 2. This way, we can use x in the actions. In the example, to take 2 steps to the right.

The value of x can change during the execution of the program. By adding x = x + 1 we are saying that the new value of x is the previous value of x (it was 2) plus 1. That means that in the following code, Cody will go right 2 steps and then 3 steps up.


The basic actions already have parameters. For example, in the following action 2 is the parameter that we use in this call to the right action.

We can declare our own procedures with parameters. This procedure will make Cody to go x steps to the right and x up.

This way we can call this procedure with different values. In the following code we will make Cody to go 3 steps right and 3 up, and then 5 steps right and 5 up.

We can also declare a procedure with as much input parameters as we want.

Loops: Repeat

The play language allows to write loops for repeating a sequence of actions. The language has two kinds of loops: repeats and whiles.

The following code will make to repeat 5 times the sequence of going right and then up.

The 5 can be replaced with other number or with a variable. If it was a variable and you change its value inside the repeat, it will have no effect in the number of times that it will be repeated. The number of times to repeat will be the first value it got when calling the repeat.

Loops: While

Compared to the repeat loop, when using a while loop, we have more control for when to finish the loop. A condition (a boolean true or false value) will be checked after the end of each repetition to decide if the loop will continue or not.

The following code shows a variable declaration and then a while where the variable is incremented by one in each iteration. The loop will repeat the sequence of actions 5 times because when x will get the value of 6, the condition will be false.

The value of x, can be used inside the actions of the loop. In the previous example, if we have right(x) inside the loop, the first iteration will go right one step, then 2 in the 2nd iteration, 3 in the 3rd and so on.


Conditions allow to execute one sequence of actions or not.

The value of x, can be used inside the actions of the loop. In the previous example, if we have right(x) inside the loop, the first iteration will go right one step, then 2 in the 2nd iteration, 3 in the 3rd and so on.

Variables scope

The scope of a variable defines when we can make use of a variable.

The play language has:

  • Global variables
  • Procedure variables
  • Block variables (inside a loop or if)


When you define a procedure that, inside the procedure, we call the same procedure, we have a case of recursion.

To avoid infinite recursion we should include a stop condition that will make the procedure not to call itself again.


The following math operators can be applied to numerical values and variables.


 Subtraction or negative number



Remainder, modulo

The following Boolean operators can be applied in conditionals (ifs, or whiles)

Between numerical values:

== Equal

!= Not equal

< Less than

<= Less than or equal

>= Greater or equal


and  the and operator

or the or operator

not negation of a Boolean value

Procedure overloading

We can declare the same procedure name with different number of parameters. For example, these three procedures can coexist in the same program.



A pirate robot that wants to find treasures.


A robotic parrot that always follows Cody. Chipset has the information of the treasure maps.


A mechanic pirate that helps Cody by providing tips and tricks for solving the levels.


A pirate that will attack if Cody is around.


Half-human and half-robot, Voltar tries also to get the treasures from the islands. Cody needs to be faster than Voltar to get the treasure in some levels.