Event Programming in Logo

The following speech was delivered by Seymour Papert by video to an audience of Costa Rican educators.


  Part 1   real video file

Greetings to all of you friends in Costa Rica. I'm sorry I'm not there in person with you. I'm looking forward to seeing you soon.

What I'd like to do is talk a little about some new ideas of kinds of projects that we're going to be concentrating on in this workshop, and during the course of the workshop, I'll be talking to you almost every day about your projects. So, to give you an idea of the kind of project we're talking about, I'd like to compare it with the kind that I've mostly seen in Costa Rican schools.

There is a certain kind of project that is done so well in Costa Rica that nowhere in the world are there better examples. This kind of project typically involves graphics programming -- programming shapes, programming text, going from one page to another, and, of course, behind the computer stuff is a lot of thought and research. The computer program is presenting a set of ideas, some facts, theory, something about history; these are wonderful projects, and I hope they will continue always to be carried out in your schools. But we're going to concentrate on another kind of project.

I saw last time I was in Costa Rica, in March, a project in which there was some animation. I saw a bee flying across the screen and settling on a flower, waiting a little while, and going off somewhere else. When I looked at the program, I saw that the bee's path had been programmed as a whole series of instructions: "Adalante 5" and "derecha 10" -- and so its whole path was described. And this is what we could call literal exact programming.

We're going to be looking at a different kind of programming, and if you look at the bee that you have on my screen, which you might see here -- we'll look at it more closely in a while -- you'll see that this bee is moving around in a random way. We'll look at the program in a moment. It's moving in a random way, and every time it gets onto a red flower, it stops, waits there for a while, and then takes off again.

This is what I would call event programming. We're used to shape programming and text programming and story programming. This event programming -- or you could call it cause-and-effect programming, or even condition-and-action programming. Now, you see that bee sitting on the red flower? It isn't programmed for any special path. It's flying around. When's it going to get there, even? Well, inside the program there's a command that says, "Fly around, and when you get onto something red, stop." Well, when's it going to do it? It makes you very impatient, and this is one of these things that kids love. You wonder, when is it going to get there? Maybe it will never get there at this rate. Come on, bee! There, it got there and it stopped. It's going to wait a while and then fly off. When it gets on this blue flower it stopped again on this red flower, now it'll never get on the blue if it ever gets on the blue flower it'll ignore it completely. So I'm going to look . . . there's the blue . . . it's going to get there, you see it Well, it doesn't matter. Eventually it will get on the blue flower, and it won't do anything.

Here's its program: "para abeja," that's our program. "Volar," that's the program that makes it fly. And we'll see in a while "para volar," how it does that. In fact, we can look at that right now. "Para volar" is "ad 5" goes forward a little bit Michael Tempel will explain all that to you. How it goes right a little bit, turns at random right or left. And then, this is the part I really want to pay attention to, "sicolor 4 [alto]." "Sicolor" is a command that you have not met before. It means, if it's sitting on a color -- 4 in this case -- what it says in here is going to happen: in this case, "alto." This is the cause -- the color. That is the effect. This is the condition; that is the action. And this kind of . . . this new command then is completely new -- and we've just made it a new tool in Logo Writer -- is the key to programming this new kind of event program.

So if we look at this we see it's a recursive program: it will keep going as long as the bee doesn't get onto color number four. If it does get onto color number four, it will stop. And when it stops, well, we can see what happens by going back here, "para abeja volar," it will fly around until it stops. "Espera 10," it will wait; "ad 100," it will go off somewhere else, a big jump, to get clear of the flower. And then "abeja" makes the same thing keep going. So here's an example . . . the bee flies around until something happens. It gets on a red plant, and when it gets on a red plant it stops, and this will keep going.

Well, you're going to take off on that, I hope, and make all sorts of wonderful programs, where maybe you could have a species of bee that likes blue flowers, or a species of bee that likes all flowers. Maybe it could pollinate the bee -- oh, I'm sorry, maybe it could pollinate the flower -- and if it goes off onto a flower of the same color, a new one would grow. So this opens up a whole area of new kind of programming.

Here's another example of the same type. And this is one that I showed when I gave a lecture in Costa Rica in March. It's a game this time, but playing a game is a good area for practicing event programming. It's a good kind of project just because the children can get into a lot of programming. In this game, you see, there's a spaceship, and it'll keep going. But if it gets onto a black area, it makes that funny noise. And if you notice the number here, each time it gets onto a black area, you lose points. It's twenty now, it'll get onto a black area -- ooh, it's lucky it didn't get it -- and it's going to get there. You see -- twenty points, it's now minus ten points.

So it's doing some arithmetic there; it's interesting, sort of working with numbers in these programs. But now, if it gets to the star watch this: I can hit a key -- ooh, I didn't mean to do that. It goes over there, if it hits that star and watch the score go up. Minus seventy now it's minus sixty. It's gone up a little. I hope you all understand that. Minus sixty is bigger than minus seventy. There it goes. But now notice every time it hits on the star, the star moves somewhere else.

So there is some very interesting programming there and some mathematical ideas behind the choice of the new place for the star. They used positions, coordinates, random choice, and all this I hope you will soon understand. And my friend Michael Tempel is going to be explaining it to you.

Important Notice: You may copy these tapes onto your computer for your personal educational use only. You are not permitted to further copy, distribute or display these tapes, or the images contained within these tapes, beyond your computer for personal use. © Seymour Papert 2000. All rights reserved.