Name________________________________________________________
Partner______________________________________________________
Providence College has a turtle graphics system for C++. We pretend we have a turtle that we can move around the screen. We can tell the turtle to move any distance in the direction it is pointed. We can also turn the turtle left or right. As the turtle moves, it can leave a trail or it can move without leaving a trail. There are other things the turtle can do, but we will use a small set of commands. The Turtle Graphics page gives a list of the commands we will use.
The graphics system requires an initialization step. Please do the initialization step described in the CSC103 Graphics Reference. Initialization is required only when C++ is first started or when it is restarted.
Start project lines.ide - see the CSC103 Graphics Reference.
If lines.cpp does not appear on the screen, retrieve it using File|Open.
We home to the center of the screen. We then move out 170, turn around (turn 180 degrees), and go back to the center. We then turn around again and move a small angle to the left. We repeat these steps 360 times. Run the program - see the CSC103 Graphics Reference . Try changing the variable Angle and see what kinds of patterns you get.
Close the project - see the CSC103 Graphics Reference.
Start project flipper.ide. If flipper.cpp does not appear on the screen, retrieve it using File|Open.
Flipper is an example of drawing and erasing. Run the program. To stop the program, strike Ctrl+Alt+Del and, when the windows screen appears, strike Enter.
Close the project.
The project file is spiral.ide and the program file is spiral.cpp. spiral.cpp is a shell - it contains initialization code, but you write the rest.
Write a program that moves the turtle 30000 steps. However, our turtle has been studying all night for a math test and he is a little groggy. He starts at the center and walks 1 step north(up). He then turns west and walks 2 steps. He then turns south and walks 3 steps. Next, he goes east 4 steps and then north 5 steps. He continues in this way until he has taken 30000 steps. Put a pause of .04 seconds each time the turtle turns.
The project file is skip.ide and the program file is skip.cpp. skip.cpp is a shell - it contains initialization code, but you write the rest.
Our groggy turtle from Part 1 suffered through his test and is on his way home. He's happy and he's skipping along. Starting at x = -310 and y = 0, he walks 1 step, hops two steps, walks three steps, hops four steps, and so on until he reaches x = 310 and y = 0. When he hops, he does not leave any mark. Write a program to show this action. Put a pause of .2 seconds after each walk and hop. Try changing the pause.
The project file is bullet.ide and the program file is bullet.cpp. bullet.cpp is a shell - it contains initialization code, but you write the rest.
Write a program to imitate a bullet going across the screen. The bullet is 10 units long. It starts at x = -310 and y = 0 and moves to x = 310 and y = 0. It then turns around and returns to its original position. Use different pauses to change the speed of the bullet.
Turn in a disk and a listing of each program. 10 percent will be deducted for each day late (except Sunday).