Volume 7 Number 2 - Spring 1999

Computer Games for Kids, by Kids
...continued

<--- previous page || next page --->

Mazes at Computer School II

Students at Computer School II come from many different elementary schools throughout Community School District 3, which covers Manhattan's West Side and south central Harlem. A few are from public schools in other districts, independent schools, or parochial schools. They come with a wide variety of school computer experiences. About half the students have computers at home. Hardly anyone knows Logo.

Prior to beginning the game project about six weeks into the first school year at Computer School II we spent some time gaining familiarity with MicroWorlds. The project "Creating a Dynamic Story" from the MicroWorlds Projects Book provided an introduction. We followed with some turtle geometry, which was related to a unit in the math curriculum on polygons and mosaics. With this background the students had enough collective knowledge and skill to begin their games.

Again, we used the MicroWorlds Project Book. The chapter "An A-Mazing Project" was a good starting point with its suggestions about how to create a maze and direct the turtle through it. But the kids did not like changing the turtle's heading by clicking buttons on the screen. They wanted to use the arrow keys. We put a project in the Public Folder that had the information needed to do this. Students could copy it and incorporate the procedures and techniques into their own projects.

Additional starters were put in the Public Folder as needed to illustrate various aspects of game programming. When more than a few students were asking the same question it was probably time for a new starter. Information spreads from student to student anyway, but putting something on the network and calling attention to it serves two purposes. First, it is a way of focusing attention on an idea or technique that we consider to be important. Second, it insures that everyone is aware of it. Informal communication would not necessarily reach everyone.

The sequence of starters below is based on the ones we used at Computer School II and in workshops with teachers. They are designed to get things going. Once the students are actively working on games, they move in many different directions. Increasingly, the students' own work takes the place of these starters as examples and material for others to follow.

This first starter just shows how to move the turtle with the arrow keys to arrive at a target.

Click here to play with the starter right now.

The procedures page looks like this:

to go
t1,  
    clickon
    forever [direct readchar]
end
         
to direct :key
if (ascii :key) = 28 [ seth 270]
if (ascii :key) = 29 [ seth 90]
if (ascii :key) = 30 [ seth 0]
if (ascii :key) = 31 [ seth 180]
if :key = "s [stopall]
end

The turtle is programmed to go forward 1 many times. The color blue is programmed to run the instruction announce [you win!] stopall when the turtle touches a blue part of the background.

An important note about Macintosh and PC computers

The ascii numbers for the arrow keys are not the same on all computers. On a Macintosh they are 28, 29, 30 and 31. On a PC the corresponding numbers are 37, 39, 38, and 40. If you are posting games to the Web to be played using the MicroWorlds Web Player, as we are doing in this article, you should include both sets of numbers in your procedures so that people using either platform can play. The direct procedure in the mazes we placed on our Web server looks like this:

to direct :key
if (ascii :key) = 28 [ seth 270]
if (ascii :key) = 29 [ seth 90]
if (ascii :key) = 30 [ seth 0]
if (ascii :key) = 31 [ seth 180]
if (ascii :key) = 37 [ seth 270]
if (ascii :key) = 39 [ seth 90]
if (ascii :key) = 38 [ seth 0]
if (ascii :key) = 40 [ seth 180]
if :key = "s [stopall]
end

There is a minor problem with readchar that is easily overcome. If the cursor is active in the command center readchar will not read what you type. Clicking somewhere on the MicroWorlds page makes readchar responsive. In practice this is not a problem with the games because they are started by clicking a button on the page.

Students sometimes want to know the ascii numbers for other keyboard characters. This is usually unnecessary since any printable character may be used directly as in the last line in direct :

if :key = "s [stopall]

Still for characters such as tab and space it is necessary to know the secret numbers, and some students are just curious. The trick to finding out is the instruction show ascii readchar. If you run the instruction, Logo waits for you to press a key and reports its ascii number in the command center. However, if you type the instruction in the command center you then have to click on the page to make readchar responsive. To avoid this we usually make a button programmedwith the instruction show ascii readchar, gather the numbers we need and then cut the button.

<--- previous page || next page --->

LOGO UPDATE Vol. 7 No. 2 - FRONT PAGE

WHAT'S NEW || LOGO FOUNDATION HOME || CALENDAR OF EVENTS

ABOUT THE FOUNDATION || WHAT IS LOGO?

FOUNDATION SERVICES || ON LINE PUBLICATIONS

LOGO RESOURCES || LOGO PRODUCTS