Week 4
This is a combination week because I’ve been out and needing to catch up. This week, I combined the previous week’s conditionals with repetition with loops (and touched on  functions as well).

Here’s the link.
I sat around thinking about what to make. I’ve had a lot of matcha recently so I decided to theme it around that. I’ve also been obsessed with watching this guy on TikTok play a game of over/under with food. He takes a guess as to how many “bites” it will take him to complete something (a bite is how much food he can stuff in his mouth at once). He recently failed an attempt to eat a Costco Chicken Bake in 2.5 bites, and subsequently issued an apology to his TikTok following.

So, I combined the two. Over/under in sips of matcha to finish a glass of matcha.

I didn’t take any incremental screenshots because I was Too Locked In. I started by making a for loop that repeated 6 times, with conditionals based on horizontal placement for the cups. So, I ended up with three in one row and three in another.
Then, I developed my function to take a random sip, and keep that cumulatively. I defined a variable, totalDrank, that += each sip based on a random number between 5 and 20. I then used that variable to adjust the matcha contents in each glass.

THEN, I began my arduous process of assigning button inputs and outputs based on the outcome. I want the user to wager whether the cup will be done in over/under 6 sips. So, I coded some complicated conditionals and probably overcomplicated my variables to make it work. 
Here’s the final interface:


I couldn’t get the text to not turn this weird shade after clicking the button. Also, when the game initializes, clicking a button once won’t do anything. The second click works and every click after that, but not the first. No idea.