INFORMATION
BE SURE TO ASK IN THE LAB IF YOU NEED HELP WITH ANY STEPS!!!!
PART I.
These problems fit with this TUTORIAL on loops that we did in lab on Monday, Nov. 12th.
1. While Loop in the draw() function (1.0 point)
Step 1. Following steps 1 through 7 in the tutorial, implement a while() loop in the setup()function. Run the sketch, what is printed in the console? (You don't have to write the answer down to this question, but keep it in mind).
Step 2. Move the code that you added to the draw() function. Your setup() function should only have the size(600,600); statement in it. Run the sketch.
Question 1. What is printed to the console? How is that different from what was printed in Step 1?
Save As.. this sketch, naming it yourname-While, (i.e. my sketch would be called Chipp-While).
Turn this sketch (yourname-While) in with your HW F
2. Create a Column of Rectangles (1.0 point)
Make a copy of the program you were working on in the previous step:
Step 1. In the tutorial we added an ellipse to the while loop to create a row of ellipses. Add a rectangle to the while() loop. You should have a row of rectangles.
Step 2. Change the code to have a column of rectangles instead of a row. Hint: The rectangles will vary in the y direction.
Here is an example what your column of rectangles might look like. The spacing, and number of rectangles may be different.
Save As.. this sketch, naming it yourname-Change, (i.e. my sketch would be called Chipp-Change).
Turn this sketch (yourname-Change) in with your HW F
3. Vary the Color and Size (1.0 point)
Make a copy of the program you were working on in the previous step:
Step 1. By using the fill() function and the loop variable, have the rectangles vary in color. We did this in the tutorial.
Step 2. Have the rectangles vary in their size as while by using the loop variable. You may want to use division to scale down the size of the rectangle's dimensions like what we did in the tutorial with the fill color.
Save As.. the sketch you were previously working on, naming it yourname-Vary, (i.e. my sketch would be called Chipp-Vary).
Turn this sketch (yourname-Vary) in with your HW F
4. Use the Mouse (1.0 point)
Make a copy of the program you were working on in the previous step:
Step 1. Use the mouseY variable to change the spacing of the rectangles from each other.
Step 2. Use the mouseX variable to change the number of rectangles that you see on the screen.
Save As.. the sketch you were previously working on, naming it yourname-Mouse, (i.e. my sketch would be called Chipp-Mouse).
Turn this sketch (yourname-Mouse) in with your HW F
5. Extra Shapes (1.0 points)
Make a copy of the program you were working on in the previous step:Instead of having just rectangles, add 3-5 extra shapes (ellipses, triangles, lines), that are drawn in the while loop. They do not all have to be drawn in a column. For example, using the same loop variable, you can have a column of rectangles and a row of ellipses. Be creative. Have them vary with color and size. You can use the mouseX, mouseY, and mousePressed variables to make you sketch interactive with the mouse.
Save As.. the sketch you were previously working on, naming it yourname-Extra, (i.e. my sketch would be called Chipp-Extra).
Turn this sketch (yourname-Extra) in with your HW F
BONUS WORK
(1.0 points) Vary with Time.
Change the program you wrote for Problem 4 above to have the number of rectangles and/or the spacing between rectangles change with time (instead of with the mouse). Think how we changed the background color with time in the previous tutorial on variables.
Save As.. the sketch you were previously working on, naming it yourname-Time, (i.e. my sketch would be called Chipp-Time).
Turn this sketch (yourname-Time) in with your HW F
(1.0 - 2.0 points) Nested While Loops
Here is a sketch with one while loop "nested" in another. It uses two variables, one for each loop. Notice the println() function in the inner while loop. How are the variable values changing? Use these two changing variables to draw an ellipses in both rows and columns. Extra points for having it vary in color and size.
Save As.. the sketch you were previously working on, naming it yourname-Nested, (i.e. my sketch would be called Chipp-Nested).
Turn this sketch (yourname-Nested) in with your HW F
(1.0 points) For Loops
Go to the Processing reference section and read about using the for loop. Change the Program you wrote for Problem 3 above, to use a for loop instead of a while loop.
Save As.. the sketch you were previously working on, naming it yourname-For, (i.e. my sketch would be called Chipp-For).
Turn this sketch (yourname-For) in with your HW F