Computer Science 101: Lab #8

You guys did an awesome job last week getting your Scribblers to navigate out of the corral despite the finicky sensors, so this week you get a break from Scribbler: most of this week's lab will involve writing graphics programs that run entirely in Calico. This lab will give you experience with the technology that goes into creating video games, CGI movies, and the like.

As usual, read through the chapter (8) and try out the author's code. Try not to skip over the narrative sections just to get to the Do This: parts, because those sections contain some very important information about Python (and programming languages in general) that we will be discussing next week. The author doesn't mention it until page 163, but the Myro library does not contain everything you need for graphics; you will also have to use the Graphics library. So the first thing you should do after launching Calico is to enter the following commands into the Shell:

from Myro import *
from Graphics import *
Other notes:

What to turn in

Based on how well you've all been doing in these labs, I don't see any point in turning in the copy-and-paste programs from the Do This: sections any more. So once you've worked your way through the chapter, write as many of the programs from the end-of-chapter exercises as you can. Specifically, you should work on Exercises 2, 3, and 4.

If you have time after that, a very cool project to try would be writing a little simulator for the Scribbler robot. The circle-animation program on p. 167 would be a good place to start, because it shows how to simulate bouncing off a wall. Ultimately such a simulator would be able to implement all the Scibbler functions like move() and getObstacle(), but for the time being you could just implement a single function like move(), testing the behavior of your simulator against your actual Scribbler.