2011 Spring Creative Computing »
Your goal for this project will be to discover a different, visual way to give commands to a computer. You will connect this to what we learned together in Python.
Complete the following:
Explore Scratch. Scratch is designed to be learned through exploration. With your background in basic programming principles, you should have no trouble diving into it. You could start by looking at some examples by going to File -> Open and then clicking on the Examples button in the lower left. Drag blocks from the …
2011 Spring Creative Computing »
Thanks to Nick Parlante and Stuart Reges for the original project idea!
You will write a program that graphs name popularity for each decade since 1900 based on data given by the Social Security Administration (See their website for the latest data).
Details
You will read from two files: names.txt and meanings.txt. You must download them and save them in the same directory as your program.
names.txt: each line includes a name followed by 11 decades’ worth of popularity ranking. Notice that a ranking of 1 means the name is the MOST popular. …
2011 Spring Creative Computing »
Adapted from CS110 lab 8 — thanks!
Complete the 4 exercises below and get your progress checked off!
Recall that you can use makePicture(pickAFile()) to select and load a picture from your computer.
Image Color Filters
1. Write code to tint an image purple.
2. Write code to convert a color image to grayscale. Recall that shades of gray have their red, green and blue values set to be the same.
Changing Colors
3. Write code to change the yellow and red pixels in the image below to different colors.
For example, you may want to create the following …
2011 Spring Creative Computing »
“Theremin”
Write a program that beeps at different pitches based on the light sensor values. For example, I wrote one that just adds up the three sensor values and uses that as the beep frequency. I had mine loop for 20 seconds so that as I approach my hand to the robot, the pitch gets higher and higher. This behavior is roughly based off of an interesting instrument called the Theremin. Look it up!
Cockroach
Your cockroach function will take one value as a parameter: the length of time the robot should move …
2011 Spring Creative Computing »
1. Write a function named panorama that takes three pictures of areas next to each other, stitches them together horizontally and displays them.
2. Write a function named photobooth that beeps to warn the subject that a picture is about to be taken, takes the picture, waits 2 seconds then repeats three times. It then stitches the three pictures vertically and displays them.
You can use the savePicture function that takes a picture and a filename in quotes to save the results. For example, savePicture(my_cat, “cat.jpg”) will save what is in my_cat to …
2011 Spring Creative Computing »
A digital picture is simply a list of dots of different colors. We will use this idea to create interesting images.
Our ultimate goal will be to create two little programs: one to create a panoramic view by stitching several images together horizontally (example below) and another very similar one to create a photo-booth by stitching together several pictures vertically.
Today, you will complete a few steps that bring us closer to these goals. Start by exploring the following commands:
The makePicture function takes in two values: a width and a height. …
2011 Spring Creative Computing »
1. In the following Scribbler code, what is img?
img = takePicture()
show(img)
2. What happens when I run the following code?
img = takePicture()
show(pic)
3. How could the code above be re-written in a single line?
4. How do you think computers represent images?
5. Why do you think taking pictures with the Scribblers takes a relatively long time?
2011 Spring Creative Computing »
The Scribblers have a digital camera — identify it using the image below. Though the camera is fairly low quality (in order to keep the price of the robots down), it takes very recognizable images of the environment so can be useful for performing a variety of tasks.
Basic code
pic = takePicture()
show(pic)
The first line commands the robot to take a picture and save it in a variable called pic. The second line displays this picture on the screen.
grayPic = takePicture(“gray”)
show(grayPic)
This example is very similar to the previous but the picture is …
2011 Spring Creative Computing »
Robots are one of those things we all think we know something about but that are surprisingly difficult to define. Broadly, a robot is a program that runs automatically without a human needing to interfere. Robots have logic of varying complexity that allow it to react to different situations on its own. Given this definition, a robot doesn’t technically need to be a physical machine like the Wall-Es and Transformers found in movies. One type of robot all of us depend on without necessarily realizing it is a webcrawler which …
2011 Spring Creative Computing »
Movement
joyStick()
Pops up a window that allows you to move the robot using a mouse-driven joystick.
backward(SPEED, SECONDS)
Move backwards at SPEED (value in the range -1.0…1.0) for a time given in SECONDS, then stop.
forward(SPEED, TIME)
Move forward at SPEED (value in the range -1.0…1.0) for a time given in seconds, then stop.
stop()
Stops the robot.
turnLeft(SPEED, SECONDS)
Turn left at SPEED (value in the range -1.0..1.0) for a time given in seconds, then stops.
turnRight(SPEED, SECONDS)
Turn right at SPEED (value in the range -1.0..1.0) for a time given in seconds, then stops.
wait(TIME)
Pause for the given amount of …



