CPSC 120: Lab Assignment 1

Due at 4:30 pm on Friday, 01/29/2016

Home | Calendar | Announcements | Assignments | Example Code | Notes


This short assignment has two goals:



Variables and Assignment

  1. Modify Example #2 in two ways. First, adjust the dots so that the center one is in the center of the screen. Second, modify the placement of the dots so that the "line" is drawn vertically. Save the result as the sketch file prob-1.pde.

  2. Modify your work in Problem #1 so that it draws a line of 17 dots, rather than 5. The "line" should begin 20 pixels from the top of the window, extend to 20 pixels above the bottom edge of the window, and have a blue dot in the middle.

    Save the result as the sketch file prob-2.pde.

  3. Modify Example #4 so that the loop draws the "vertical" figure you did without a loop in Problem 2. Save the result as the sketch file prob-3.pde.
  4. Make a drawing that consists of the 5 dot horizontal line, the 17 dot vertical line, and diagonal lines (bottom left/top right and top left/bottom right), also made of dots and running through the center of the window. The lines should each be drawn with a loop, and you should have some variation in the colors that are used to draw each dot. Finally, there should be more than one dot size in the drawing. Use your creativity here!

    Save the result as the sketch file prob-4.pde.

Turn In

Make a folder in your turn in directory named "lab1". Copy all four of your solutions in to this folder. Consult the Linux tutorial from Lab #0 if you need a reminder of the details.


John H. E. Lasseter