Showing posts with label eating. Show all posts
Showing posts with label eating. Show all posts

Saturday, May 25, 2013

What Would You Like to Eat Today?


Oh man, it is so totally freeing not having to create those stale blog posts! Here are two more mini -games micro-games I whipped up later in the week. They're both related to food (no surprise, right?) and I think I'm really getting to master the whole choose-your-adventure-game-mode. I think it would be relatively achievable to write a storybook and have several different possible endings! How cool would that be? I also found out that it's actually pretty useful to create diagrams in a notebook before starting to code everything out. It's like drafting an essay or creating a plan so that everything makes sense and you don't have to waste time figuring those silly little details out. Ah, this is so much better and way more engaging! I hope you all give these games a try!

// here's my first version: 

var omelette = prompt("Good morning! Are you hungry for breakfast? The chickens and ducks laid a whole bunch of eggs, so we're planning to make omelettes for everyone. Do you eat meat?").toUpperCase();

switch(omelette) {
  case 'YES':
    var salmon = prompt("Do you eat fish?").toUpperCase();
    if(salmon === 'YES') {
      console.log("One smoked salmon and tomato omelette coming right up!");
    } else {
      console.log("We'll have your ham and cheese omelette plated in a jiffy!");
    }
    break;
  case 'NO':
      var dairy = prompt("Do you eat dairy?").toUpperCase();
    if(dairy === 'YES') {
      console.log("Well here's a cheesy mushroom and onion omelette... one of my favorites!");
    } else {
      console.log("Sorry, we don't have any omelettes for you!");
    }
    break;
  default:
    console.log("Say you don't like omelettes? Well we have some soggy oatmeal leftover from yesterday's brunch...");
}
     

// here's the second (and slightly more intricate) one: 

var hungry = prompt("So I see you're feeling a little hungry. Well, what time is it (BREAKFAST, LUNCH, or DINNER time)?").toUpperCase();

switch(hungry) {
  case 'BREAKFAST':
    var meat_breakfast = prompt("It's breakfast time! Do you eat meat?").toUpperCase();
    var dairy_breakfast = prompt("Do you eat dairy?").toUpperCase();
    if(meat_breakfast === 'YES' && dairy_breakfast === 'YES') {
      console.log("Have some bacon and eggs!");
    } else if(meat_breakfast === 'YES' && dairy_breakfast === 'NO') {
      console.log("Allergic to dairy? How about some sausage and hashbrowns?");
    } else if(meat_breakfast === 'NO' && dairy_breakfast === 'YES') {
      console.log("What about a tomato and spinach omelette?");
    } else {
      console.log("How about some fresh fruit?");
    }
    break;
  case 'LUNCH':
    var meat_lunch = prompt("Lunchtime! Do you eat meat?").toUpperCase();
    var dairy_lunch = prompt("What about dairy? Can you have milk? Eggs?").toUpperCase();
    if(meat_lunch === 'YES' && dairy_lunch === 'YES') {
      console.log("Alrighty, how about a ham and cheese sandwich? Does that sound good to you?");
    } else if(meat_lunch === 'YES' && dairy_lunch === 'NO') {
      console.log("Well what about just a tunafish sandwich?");
    } else if(meat_lunch === 'NO' && dairy_lunch === 'YES') {
      console.log("Grilled cheese for one! Coming right up!");
    } else {
      console.log("What about a classic PB and J sandwich? Does that sound good to you?");
    }
    break;
  case 'DINNER':
    var meat_dinner = prompt("Ah, the last and BEST meal of the day! Do you include meat in your diet?").toUpperCase();
    var dairy_dinner = prompt("How about dairy?").toUpperCase();
    if(meat_dinner === 'YES' && dairy_dinner === 'YES') {
      console.log("What about some pepperoni pizza?");
    } else if(meat_dinner === 'YES' && dairy_dinner === 'NO') {
      console.log("How about the classic spaghetti and meatballs? We'll hold the cheese, don't worry about that!");
    } else if(meat_dinner === 'NO' && dairy_dinner === 'YES') {
      console.log("In the mood for mac and cheese! I know I am!");
    } else {
      console.log("Well in that case, what about a nice refreshing kale salad?");
    }
    break;
  default:
    console.log("Hmm... you sure you're hungry?");
}


P.S. I started using canv.as and it is so freaking fun. Here's my page.