News Brief Screenshots Tutorial Downloads Help wanted
Little Wizard

Explore the views

Run the Little Wizard application.

Just after start you will see application in the program view:

Where at the top of the window, beneath the menu bar, you will see a toolbar with the Program button pressed.

Below this, you will see a panel containing a tabbed palette full of icons.

Below this is the program grid where you write your program.

Press the World button to see application in the world view:

Press the Mixed button to see the mixed view:

These three modes of operation allow you to view and modify the world, your program, or both at once.

Try dragging dividers to set up the application's view you like.

Explore the program elements

Press the Program button to return to the program view. The Wizard tab is currently selected. Click on each of the other tabs: Math, Variables, Conditions and loops and Other to view all the palettes of program element icons.

Add icons to the program

Click and drag any icon in the palette downwards to the program grid below. Repeat this with several different icons, dragging them above, below, to the left and right of icons already placed on the program grid. This is how you add elements to your program.

Remove icons from the program

Click on one of the icons you have placed on the program grid and drag it upwards back to the palette. The icon will be removed from the program grid. Repeat this until there are no more icons left on the program grid.

Execute the program

Press the Execute button . You will see a new window open with the Little Wizard in it.

The title bar of this window will say "Program finished..." because we haven't yet given the Wizard anything to do in the program grid. Press the close button, which in most window managers appears as an "X" in the upper right corner of the title bar, to close the execution window. This terminates the program.

Change the world

Press the World button on the toolbar. Click and drag a piece of the house from the palette down into the World grid below. Drag some more pieces. Drag them back to the palette to remove them. Click on the Blackboard, Digits, Alphabet and Wizard tabs to reveal more icons that can be placed in the World in the same way.

In the World must be the only Wizard. Therefore it is impossible to remove him out of the World and dragging him from the Wizard tab only gives him a turn and moves him to the new position.

Click on the Grid button to show grid lines in the World grid, which makes placement of new icons in the grid a bit easier:

Click on the magnifying button to zoom the view of the world grid out and in. Click on the arrow buttons to add or remove columns and rows to your world grid.

Make a program

The program can be laid out to multiple rows or all in the same row. The execution will always go from left to right and downwards.

Click on the Program button.

Now try to drag program element icons from the palette onto the program grid to tell the Wizard what to do.

New icon can be placed before any existing one, at the end of any line or at the beginning of the new line.

The return symbol can be used to break long lines.

Take the wizard for a little walk

Click and drag icons from the palette into the first row of the world grid until it looks like the following picture. You will need to click on the Math tab to find the numbers, and click on the Wizard tab to find the other icons.

Press the Execute button to see what happens.

First, the Wizard starts walking in the direction he is already facing, which is to the right. The Wizard will walk two squares because we put the number two after the walk icon. Then the Wizard turns right and walks again, this time downwards. Then the Wizard turns right and walks three squares. The Wizard will end up five steps to the right, one down and will be facing right.

Close the execution window.

If the Wizard didn't do what you expected, go back and change the icons on the program grid so that they are the same as the image shown above and press Execute again. When programs don't do what they should do, we call it a bug. Taking bugs out of your program is called debugging.

Make the Wizard change the world

The Wizard is also able to alter his surroundings. He can use the wand, or create command to create items in the world. The command is followed by one or more icons or a number which the Wizard will create as he walks forward.

This is the result of the code above:

Invisible cap story

He is also able to disappear and reappear at command. Note that there is no delay after the first step and the disappear command afterwards. It will look like he'll stand still in the first cell, disappear, and reappear two steps away.

Can you think of a way to make it appear like the Wizard was blinking in place?

Speed up the Wizard

You can alter the speed with which the Wizard walks. 0 is the slowest speed and 9 is lightning fast. Can you see where the X will appear with this program? You won't see the wizard moving to write it, but just walking leisurely forward.

Exploring the wall

Let's introduce "Be behind" and "Be in front" commands, both of which tell the wizard to walk behind or in front of the world elements. If not told otherwise, the Wizard will hide behind whatever there is in the world.

In the following example the wizard creates the wall, then he passes it twice from different sides.

The remaining command in the Wizard tab is "Calculate" , which will be introduced shortly in the next session.


These commands allow you to do basic arithmetic. The normal precedence rules apply. Multiplication and division will be calculated before addition and subtraction. 5+4*2 is not the same thing as 4+5*2. If in doubt, you can always use parenthesis.

A word about division. The result is always just the quotient of the calculation, meaning that anything after the decimal point will be dropped away. Mod operation will conversely result the remainder.

Numbers can be used as arguments to create just like world elements.

Letters can be joined using "Concatenate" operator:

Random numbers can be generated with the hat. This will walk zero to two steps forward.

The third row has logic operations, which with "True" and "False" icons will be introduced in the section on loop and conditional instructions.

For descriptions of the "Set" operator and "Length" function see next section.


Next are the variables. Most of them are generic variables, which can store world elements, numbers and letters. Initialising them is a good idea, though letting them as they are will treat them as zero for most purposes.

Here a part of a wall is assigned to the variable C by using "Set" icon. This kind of an instruction, which doesn't lead to any Wizard action, will have to start with the "Calculate" command so that he won't get confused.

The variables can be used for arithmetic, too:

An advanced use for variables is as arrays. An index number, starting from one, can be set inside the brackets. Multiple brackets can be used to make multidimensional arrays. The details are left as an exercise, but let's introduce one special variable that uses them.

The world array represents the world. This program will read what is five cells to the right and one down.

Here the letter Q was inserted into the world before running the program, which the Wizard dutifully replicated in front of him.

Finally in this section let's measure the length of "LOVE":

"Length" function can be used also for finding size of array.

Conditions and loops

These are the loop and conditional instructions, can be used to control program execution. They are typically used along with the logic operations previously shown.

Here is the Wizard will write "NO" (execute commands after "Else" icon), because condition is false.

The logic operations can be used to great effect along with the conditionals. Here the condition "A is one and either B or C is one" is satisfied and the Wizard will step forward.

While instruction will repeat the following instructions for as long as the condition is true. Note that nothing will prevent you from doing an infinite loop. Here the Wizard will walk a full circle.

Repeat and until are always used as a pair. They are just like the while loop, except that the condition is checked after each loop, not before. This can be a more natural way to approach loops occasionally.

Since incrementing or decrementing a loop variable by one on each repetition is such a common case, there is a shorthand instruction for just that. This program here will increase L by two each time and will write it down.

It is possible to initialise the loop variable in the for instruction, too.

The twin of the, for...downto will count to the opposite direction.

Continue operator jumps to the next loop iteration. Break operator quits from the loop.

There are two Boolean variables "True" and "False" , which can be used for loops' conditions.

Overview of the Other tab

By setting abscissa and ordinate one can move the Wizard to the specific location in the world.

Also there are and commands to define the current location of the Wizard.

In the following example the Wizard is moved into the random place, then depending on the sum of its abscissa and ordinate he creates either blue (the sum is even) or red (the sum is odd) block:

In the last program the Wizard waits for user's input confirmed by Enter key, then hi moves entered number of steps forward, then the same number of steps forward or in requested by user direction (if user presses some arrow key) and at last hi waits pressing for some arrow key and moves one step according to it.

Code after icon "//" is named comment and it will never be executed, so it is used only for clarification.

This tutorial was extendent and updated by Kirill Kirillov. Original version is available here.

The Little Wizard project is hosted by: