# ✿ code toolkit ✿ python ✿

## spring 2022 agenda

### Due: Wednesday, February 9th by 8pm

1. Review this week's lecture notes.
2. Complete the reading
Write a short response in our shared reading response google doc (located in our shared google drive). Include 3-5 quotations that you found interesting, and add a few sentences explaining how you see connections between this reading, the programming exercises we've done so far this semester, or your past experience with coding.

Lev Manovich. The Language of New Media, Cambridge Mass.: MIT Press, 2002. Chapter 1 (pages 18-55)
3. Syntax Practice
Do the following debugging exercise: spot the differences. There are 8 differences between those two images. Indicate where all the differences are, and using the rules of Python Processing syntax, indicate whether or not each difference will cause an error. You can indicate the differences using whatever format you'd like — you can use Preview (Mac), Microsoft Word, Adobe Photoshop or Acrobat, or simply print them out and use pen or pencil and scan or photograph the result.

Name your file "week-2-puzzle" and upload it to Google Drive with your homework this week.
Create a new sketch file. Name it part_3. You can copy and paste your code from last week as a starting point, or you can start with something completely new.

Based on the "boxes" in-class example, add some variables to your code. Follow the same format that I did in terms of putting variable assignments first, and all your drawing code beneath that, keeping these two parts of your program separate. Use at least 4 variables. Use the variables to add variance into your sketch. Use these variables in some combined way, using arithmetic. For example, if you were drawing a person, say you drew the person's head at the `y` value of `25`. If you then added a `bodyHeight` and `legHeight` variables, you might draw the person's shoes at ```25 + bodyHeight + legHeight```. The idea is that you can change the variable values and the rest of your drawing code will adjust and still fit or line up.

Run your code and see how it looks. Take a screenshot. Now, without changing any of your draw code, change only the variable values, and re-run your code. Take another screenshot and compare the results. Experiment with running your code this way several times. The idea is that by only changing the variable values, without changing any drawing code you should be able to achieve a varied range of output possibilities.
5. Layering
Create a new sketch file. Name it part_4. Copy and paste your code from part 3 above as a starting point, and use the following code as a guide. Follow the instructions in the TODOs that I've made in comments. There are a total of 5 TODOs. Parts of this are probably confusing since we haven't talked about `setup()` and `draw()` yet. But this will lead in to the main topic for next week:
``````
# TODO 1: Put all your variable assignments here.
#         You should have no indentation here - i.e. no spaces
#         at the beginning of the line

def setup():
# size() goes inside setup() here. Like this:
size(600,600)

# Optional: If your sketch from the previous part used background(),
# put that here. It should have 4 spaces of indentation

def draw():

# TODO 2: Put each of your variables here on their own line
#         and mark each as 'global'. (I will explain what this
#         means next week.) And assign each one a random value
#         using a low, high range that works reasonably within
#         your composition. You should have 4 spaces of indendation.
#         For example:
global treeHeight
treeHeight = random(50,250)
# Replace the global variable that I wrote as an example above with your own.

# TODO 3: Now put all your draw code here (ie, the code
#         that uses those variables). All of the code here should
#         have 4 spaces of indentation.

# NOTE: If you are using background(), remove it for now, or move
#       it into the setup area, above.

# TODO 4: Go through your code and for every place you are setting
#         a color, add some transparency. For example, if your code
#         has this:
#   fill(255,0,0)
#         modify it to something like this:
#   fill(255,0,0,10)

# TODO 5: run your sketch and see what happens!

# The idea here is that if you do the above, you should hopefully
# get something that looks like the Idris Khan image compositions.
# Do you? This is a lead-in to the topic for next week, and I will
# explain more about it then.
```
```

6. Create a folder in your Google Drive folder called "homework_2_firstname". Upload both sketches into this folder, calling them "part_3" and "part_4" and your puzzle file.