• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.


Little Wizard Programming

Page history last edited by kirish43@... 12 years ago

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.

Comments (0)

You don't have permission to comment on this page.