CSCI 1300 - Programming Assignment 8
Points and Lines

Dates:

  • Start: No later than October 17
  • Part 8A: Submit to Dora by 9:30, Tuesday, Oct 22. No late submissions accepted for credit. This part must be done entirely by yourself. You may consult books and the course instructors, but nothing else. Think of this as if it were a take-home exam.
  • Part 8B: Dubmit to Dora by 9:30, Tuessday, Oct 29. No late submissions accepted for credit. You may work with other students on this part. To receive full credit, you must also attend a code review during recitation on Oct 29/30.
  • Your work must follow the style rules from www.cs.colorado.edu/~main/intro/style.html. If you fail to follow these rules, then you cannot receive any help from the instructors.

    Homework Policy
    All the work for Part 8A must be entirely your own. You may consult books and the course instructors, but nothing else. You may work with other students on Part 8B. At the top of your program, put the names of any others that you have worked with. You must completely understand all work that you submit.

    The Student Honor Code applies to this assignment:

    "On my honor as a University of Colorado at Boulder student, I have neither received nor given unauthorized assistance on this work."

    Violation of this honor code will result in a grade of F for the entire course.


    Part 8A of the Points and Lines Program

    Due at 9:30am, Tuesday, Oct 22. No late submissions accepted for credit.

    Write a function that will draw a sequence of figures on a graphics screen that has previously been opened. The specification for the function is:

    void drawFigures(int x[], int y[]);
    // The function draws a sequence of white lines connecting the
    // (x[0],y[0]) to (x[1],y[1]) to (x[2],y[2]) to (x[3],y[3]) and
    // so on until a negative x coordinate is found.  When a negative
    // x coordinate is found, the figure is ended in one of these ways:
    // --
    // If x is -1, then the function ends with no more work.
    // --
    // If x is -2, then the function draws one more line from the last
    // point of the figure back to the first point of the figure.  Then
    // the function ends.
    // --
    // If x is -3, then the function ends the current figure, and the
    // next xy pair is the first point of a new figure.
    // --
    // If x -s -4, then the function draws one more line from the last
    // point of the figure back to the first point of the figure.  Then
    // the next xy pair is the first point of a new figure.
    // --
    
    Note: In order for Dora to correctly grade your work, the start of each figure must begin with a call to the moveto function from the winbgim library. Each of the lines must be draw by using the lineto function. No other calls to moveto or lineto are permitted. The program must work correctly regardless of how large the array is.

    y Your submission to Dora should include a small main function that tests the drawFigures function in some simple way.

    Part 8B of the Points and Line Program

    Due at 9:30am, Tuesday, Oct 29. No late submissions accepted for credit.

    Write a main program that allows the user to use the mouse to draw figures that contain up to 1000 points. Except for ending the program, the only user input is from the mouse. As a minimum, your program must allow the user to:

    1. Put a new point into the current figure.
    2. Undo the most recent action.
    3. Start a new figure.
    4. Add one more line to the current figure (back to the starting point) and then start a new figure.
    5. End the program.
    The most important new function that you'll use from winbgim is getmouseclick.