Specification of Assignment

In this assignment, you will write a simple stamp-based drawing program. In this program, the user can use these stamps to draw pictures on the screen by selecting three different kinds of stamps and four colors.

Initially, the canvas should be square (1 point) with a blank, dark grey, or black background (1 point). Nothing should happen when you move the mouse around the canvas without clicking. One of the three stamps will follow your mouse when you click down (3 points). The default stamp is a happy face, and the default color is red (1 point).

There are three possible stamps that the user can select: a face, a target, or an arrow.

  • The face should have two eyes, a nose made of a triangle, and a mouth with a thin black stroke (1 point).
  • The target should be three concentric circles with a thick black stroke made using arrays and a recursive function (1 point).
  • The arrows should be two triangles and a rectangle, with a medium-thickness white stroke (1 point).

The user should be able to switch between these by pressing f (for face - 4 points), t (for target - 4 points), and a (for arrows - 4 points).

The user can also change the color of the stamps with the r, g, b, and p keys (for red, green, blue, and purple keys, respectively - 3 points per color).

Whenever the user selects a color or stamp by pressing a keyboard key, your program should remember this setting until the stamp/color is changed again (3 points). It should not just take effect while it is being held down. Also, the user should be able to press the c key to clear the screen (3 points).

Please remember that all assignments should be written without using advanced features to show your understanding of the material presented in class. Any material not covered in the lecture is considered an advanced feature. For example, You must use the keyPressed Boolean Variable to detect key presses. Do not use the keyPressed function. The assignment will be graded as Zero if you use any feature that has not been covered in the lecture. Use the slides to reference the topics that we have covered.

Comments and Programming Style

Name the file stamper.pde (2 points). This will be automatically checked by the autograder when you upload the file to Gradescope.

Each program file should have a header comment at the top that has the following format (1 point):

/* Author: Student Name
 * Description:
 *    A short description of what this program does!
 */ 

To help with readability, indent and separate the code that creates the main shapes in your program with a blank line and include a comment that describes the shape(s) being created (2 points).

For example,


// check for key presses
// if the 'f' key is pressed, draw a face