Exercise: Our ability to see patterns is what makes us human. However we also see patterns where none exist because our brains are biased towards detecting certain kinds of patterns over others (e.g. faces). Create a pattern by making something with a lot of repetition, more than you want to hand-code. Is the resulting pattern easy to see or hard to see? What would it mean to create the illusion of pattern? Can you predict what the pattern will be when you run your code or does it surprise you? You could take something you've already done where there was a lot of repetition in the code (e.g. your self-portrait) and see if you can re-write it using a loop so that instead of 28 lines of code that call rect(), you have 1 line of code calls rect() inside of a loop that goes around 28 times. How do you need to rework the way you position that rect() in order to make it work in a loop? Try creating an algorithmic design with simple parameters. (One example is 10PRINT, example code).
- I had no idea where to start and ended up using the 10PRINT as a base to explore what I can do with some of the concepts we have covered in the past couple of weeks, mainly playing with size, color, if-else statements, basic math, and randomizers.
https://editor.p5js.org/zoemargolis/full/srr4q8PGW
Worksheet problems below:
- Worksheet 1: Create 20 columns that turn red when you hover over them.
- Worksheet 2:
- A. Skip over col #7.
- https://editor.p5js.org/zoemargolis/sketches/yKJOaL_Qo
- Notes: I accidentally made the inverse of this problem happen first. Link to that code is here for just col #7 turning red: https://editor.p5js.org/zoemargolis/sketches/2fGTmR-AW
- I then had a hard time moving to counting columns and figuring out how to assign column numbers in a way that could talk to my mouseX position. Took a few iterations of playing with mouseX constraints and how I counted my columns to figure it out. I did have the right logic on paper, just was not implementing it in the correct way in my code.
- B. Make the left half turn blue, right half turn red.
- C. Make every other column blue.
- D. Make every column a different color.
- Worksheet 3: Create a grid of 100 cells that turn red when you hover over them.
- Worksheet 4 Challenge: Create a checkerboard grid of 100 cells.
- Worksheet 5 Challenge: (After you’ve watched the videos for next week on functions...) How might you make something loop without using a for loop or a while loop? (Hints: https://en.wikipedia.org/wiki/Lather,_rinse,_repeat
- Watched the videos and working on this now