CSCI 1300
Introduction to Computer Science
Homework 2: The Moving of a Star

Due Date

All work must be submitted by 7:50am on Tuesday, Jan 26. Submit the programming work online to http://culearn.colorado.edu. No late work is accepted, so submit what you have before the due date!

Working Alone

You may talk with other students and instructors about the assignments, but you may not look at or copy code written by others. The penalty for violating this code is an F for the entire semester.

The Assignment

This assignment again opens a graphics window and draws the Big Dipper. Then all the stars start dropping at a rate of 1 pixel per 20 milliseconds. In the second 20 milliseconds, the stars drop another 1 pixel, and so on until they fall off the bottom of the screen.

The technique that we'll use is called an animation loop with double-buffering. It is not a difficult technique (you will learn it in 50 minutes), but it is not in the textbook, so you must come to both lectures.

Program Requirements

Come to both lectures. You'll be able to start the work right after Wednesday's lecture, and on Friday you can ask questions. Don't leave it until the last moment in case you have trouble figuring out how to submit to CULearn. Remember that no late work is accepted.

  1. Your program must be called moving.cxx. You must submit this file and no other.

  2. Other than having a different file name and ending as soon as the last star has fallen off the screen, the program file must meet all criteria that were used for the first homework assignment.

  3. The program must correctly move the stars.

  4. The program must use double-buffering.

  5. When the last star has fallen off the screen, the program must end.

  6. The main program must have a single animation loop with double-buffering as described in Wednesday's lecture.

  7. The job of drawing the entire Big Dipper must be done by a function with one parameter called dy. The value of dy is the total distance (in pixels) that the stars have fallen so far.

  8. That function to draw the Big Dipper must make seven calls to your function for drawing one star (from last week's assignment).