Skip to content

Instantly share code, notes, and snippets.

@mbjelac
Last active March 1, 2019 08:40
Show Gist options
  • Save mbjelac/eb11eb048a25ea7c846cd56da256fb81 to your computer and use it in GitHub Desktop.
Save mbjelac/eb11eb048a25ea7c846cd56da256fb81 to your computer and use it in GitHub Desktop.
Comment type: 2 algorithms
/*
a recipe for carrot soup:
1. buy carrots & onions at the market (make sure they are fresh!)
2. slice carrots
3. slice onions
4. put carrots, onions & some salt in a pot
5. fill pot with water
6. heat it up
7. wait for the water to start boiling or the carrots to be soft
8. turn off heating
*/
function createCarrotSoup() {
// buy carrots & onions
marketplace.signIn(SECRET_CREDENTIALS);
carrots = marketplace.buy(CARROT, 5);
onions = marketplace.buy(ONION, 1);
//validate freshness
validateFreshness(carrot, 1);
validateFreshness(onion, 1);
pot = [];
pot.push(carrots, onions, SALT);
hotPlate.clear();
hotPlate.add(pot);
hotPlate.turnOn(7);
// wait
while(!pot.isBoiling()) {
hotCarrot = pot.takeOut(CARROT, 1);
if(hotCarrot.isSoft()) {
break;
}
wait(1000);
}
hotPlate.turnOff();
}
@mbjelac
Copy link
Author

mbjelac commented Mar 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment