Written By: Mohamed Ihsan

Partner: Changqi Yu

Written On: 11/7/21

Process:

Issues with Random:

Having successfully gotten the start button to work, we now moved on to trying to incorporate recipes. We decided we would have random recipe be chosen. We were having issues with random() method working at first, and found at, firstly, that it was due to it being before setup() (therefore it was undefined). After doing this, we had issues getting the values that random was reading to be defined values. We fixed this by putting it in a loop that was only called once per cycle. And thus, we got this to work!

if (button1>0){
    buttonState = true;
    recipes = random(fruits);   
  }
  if (buttonState && rounds <= 3){
    text("please make a " + recipes + " smoothie!", 30, 250);
  }
  if(rounds > 3){
    text("congrats! you made a smoothie!", 30, 250);
    text("push button to make a new smoothie", 30, 280);
  }
    if(rounds > 3 && button1>0){
      rounds = 0;
    }
}