Test #2 - Drawing
Test Format and Review Page
CODING
(25 points)
During the first part of the test, you'll solve a programming challenge by writing code in Processing. You will have up to 20 minutes to complete this section. There are FOUR possible challenges you might be given, determined randomly on the day of the test. You may not use any notes, but the challenges are provided to you in advance to practice.
Students are given class time and guidance to completed and practice all of these before test day. If you're improvising when the test day arrives, that means you have not been completing your classwork and homework.
The next class period will offer a redo opportunity for any students who did poorly on the original. On the redo, you'll be given a different challenge and can complete it for a maximum score of 80%. You will receive the second score, even if it is lower.
Challenge #1
Canvas size: 600 x 600
Background: Orange
100 yellow squares with a randomly assigned size of 5 to 10 pixels that start at a random position on the screen.
Each squares moves to the right side at a speed of 5 pixels per frame.
Each time it reaches the right side of the screen, it appears at a new random position on the left side and increases its size by 40%
Tip: You'll need to use three arrays to keep track of xPositions, yPositions, and sizes.
Click HERE to Download a Running Example
Challenge #2
Canvas size: 600 x 600
Background: Blue
200 white circles, each with randomly assigned diameter of between 10 and 20 pixels that starts at a random position on the screen.
Each moves to the top at a speed equal to 20% of their current size in pixels per frame
Each time it reaches the top of the screen, it appears at a new random position on the bottom of the screen.
Tip: You'll need to use three arrays to keep track of xPositions, yPositions, and sizes.
Click HERE to Download a Running Example
Challenge #3
Canvas size: 600 x 600
Background: Pink
At the start of the program, 50 red circles are created random positions on the screen. Each has a random size between 10 and 100.
When the user presses the mouse, all circles will change size. Left click will grow the circles, and right click will shrink them. This can be done with either polling or event based methods; choose a rate of change that looks reasonable.
Tip: You'll need to use three arrays to keep track of xPositions, yPositions, and sizes.
Click HERE to Download a Running Example
Challenge #4
Canvas Size: 600 x 600
Background: Purple
At the start of the program, 50 yellow rectangles are created across the top of the screen. Each rectangle is 12 pixels wide, 100 pixels tall, and are spaced exactly 12 spaces apart, so that they are touching each other.
Each frame, move all rectangles down by 1 pixel and there is a 10% chance that they reduce their height by 2.
When a rectangle's height is reduced to 0, move it back to the top of the screen and restore its height back to 100.
Tip: You'll need to use three arrays to keep track of xPositions, yPositions, and heights.
Click HERE to Download a Running Example