Event Programming in Logo

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.

Well, you saw this project of the flowers, the game. Now I want to talk about another game project where inside this game project there are some very important ideas of mathematics and of physics. Now you might think physics is not something that you usually do in your elementary schools, but you could. And we’re talking about how the computer can enable children at a young age to learn ideas that usually they only meet at a much older age. So I am going to show you a program that I wrote here, which is another game — and, watch this, you see I made a little figure move along, and that’s a usual kind of Logo animation, you all know that. He’ll run along, and when he gets onto that that black area, whoa, he falls down.

How can we make him not fall down? Well, he’s going to … I wrote a procedure: when you press a certain key, he jumps. Watch that. Up he went, and down he came, but he didn’t jump far enough. Well, how can we be sure? We can do some experiments to find the right place for him to jump. But I found that because I couldn’t remember, I put in these trees, and the second tree there, that marks the good place to jump. If you jump there, when he gets to the second tree, he’s going to get over. Now there, he got away.

What I really wanted to talk about was, How do you make it jump? Making a jump is a very interesting thing to study because jumping is just an ordinary thing that everybody does all the time, and we never look at it, we never think about what goes into jumping. But if you are making this game, a good teacher would encourage the students to think about, What kind of jump do you want to make? And, in fact, many students won’t wait for the teacher, they will worry themselves about, How do you make a jump? Well, let me show you the ways I used to make a jump before I got it right.

Ah, and if we look at . . . I’m going to get a different page here. Now, I just had that turtle walking. I made two kinds of jumps, I did the — scan down — here’s one kind of jump . . . it just goes up, stays up for a while, and comes down: that’s a square jump. Now, here’s another jump, and that’s your familiar turtle circle like you’ve done a lot of times. It did forward a little bit, right a little bit, forward a little bit, right a little bit. Adalante, dereche, adalante, dereche, and that makes a circle. So, that’s another way to make a jump.

Now in my game it didn’t do it like that. It did it in a more interesting way by doing something more like the way that people really jump. They jump up and gravity pulls them down, so it’s not programmed in advance to go in a certain path, but there is a process going on, and I think that this process you’ll understand better when Michael tells you about it standing in front of you with a blackboard and trying out different ways of combining the commands together.

And I’m going to leave you there. I’m going to leave you thinking for today about how you use these new commands, this new kind of programming, what kind of projects you can develop, and how they might lead you to look at ordinary things like bees flying on flowers, or walking, or jumping, or throwing, or all the ordinary things that we do every day; so that projects can be developed that lead young people to look with a more scientific, with a more mathematical eye, at the ordinary world around them. Science and math isn’t something you just do in the classroom to calculate numbers, or prove that scientific laws are correct. It’s something that changes the way you look at the world around you every day. It changes the way you think about all the ordinary things that you don’t usually think about.

Well, that’s a lot for you to think about, and I guess I’ll be speaking to you in the next couple of days and talking about the projects that you might have made and what ideas have come to you from thinking about this kind of programming. And so I’ll say bye-bye for now, I’ll speak to you soon.