Upon completing this assignment, you will be able to:


In this assignment, you will create a visual pattern which is altered through key presses. This program is required to do the following two things:

  1. The program will use 1 or more "for" loops to construct a repeating pattern out of identical shapes.
  2. When the user presses particular keys on the keyboard, the program will respond by altering the pattern. The new 'mode' or pattern alteration will remain until those keys are pressed again, or at least for 2 frames after the user releases the key. Your program will have at least 3 different 'modes' or pattern alterations driven by keystrokes, and uses the 'mode' framework introduced in Lecture 7.

You may design your program however you wish within these two constraints. For example, you may choose whether to make a 1- or 2-dimensional pattern, which keys you wish to respond to and how, and what kind of alteration is made.


You may proceed in any way that you wish to accomplish the requirements of this assignment. We strongly recommend proceeding step by step to design the program, making a working program that fulfills the first requirement (and saving a scratch copy of it) before going on to add the second requirement. In each case, start simply, and debug as you go along until you have achieved each requirement. If you decide you want a complex interaction, we strongly recommend making a simple version first that fulfills all requirements so you'll have a back-up in case your more ambitious program turns out to be too hard.

Grading scheme

A+ - All required elements included, plus an interesting and creative approach to fulfilling the assignment requirements.

A - All required elements included and functioning correctly. Arecognizable pattern is correctly generated using one or more logically constructed "for" loops, and key presses make a clear and (semi-)permanent change to the pattern.

B - Competent response to the assignment showing overall mastery of course material, with some small errors that do not greatly affect the quality of the assignment. For example, the code may be somewhat baroque (too complex for what it does), the for loop termination condition may be slightly off what is intended, or the code may be formatted incorrectly.

C - Some bigger errors, or a larger collection of smaller errors, but with potential to develop into a competent response. For example, the code may not run, but with a few small syntactical fixes would properly fulfill the assignment; the code may work but not be comprehensibly written; or the code completely misses on one of the requirements, but still shows some understanding of the unit's material.

D - Serious errors show clear effort, but serious gaps in understanding, such as code that does not run and is not close to being correct, or fulfills only part of a requirement.

F - Little demonstrated effort, or clear effort with no understanding, such as code fragments submitted which are only the start of a response to the assignment.