Javascript minichoose

With some switch/case and some conditionals, I’ve got a cutie lil game I made for the codecademy class. Load it up if you like!

Edit note, for readability I altered some of the spacing and tabbing.

var user = prompt("You are wandering along Deck 7.  People don't use this one
as much as the others, and doesn't smell as much like gorba root, the principal
trade roughage of The Captaincy.  As you rest your bones to look out the 
viewport onto the planet whose gorba the crew of The Captaincy just acquired, 
your Eye Viewer switches to life:

\n\n'ALERT ---- ALERT ---- ALERT\n\n



Oh no!!  What do you do?\n
 - If you would like to contemplate a bit more, type 'think'.\n
 - If you would like to look around for something to entertain yourself 
   on the no doubt long, slow voyage to the next system with unknown 
   shuttlemates, type 'look'.\n
 - If you want to just get to da choppah, type 'shuttle'.").toLowerCase();

switch(user) {
    case 'think':
        var thinking = prompt("what do you think about?  you can think 
            about 'escape', your 'cat', or 'cheese'.").toLowerCase();
        if (thinking === 'escape') {
            console.log("excellent!  you get to the shuttle.  you live!");
        } else if (thinking === 'cat') {
            console.log("such a fuzzy whatnot kitty!  too bad you are dead now.");
        } else {
            console.log("you're thinking about WHAT??  ok, you're dead.  imagine that, 
            if the ship is going down, you have to EVACUATE.");
    case 'look':
        var looking = prompt("you look over the ship, and you find your e-reader
         with 500 of your future favorite books and a 4000-pack of eternally 
         shelf-stable, forever delicious squeaky cheese!  HOORAY!  if you take it, 
         type 'true,' if you don't (ya crum-head) type 'false'.");
        var secondThing = prompt("ok, now do you get to the shuttle?  
         type 'true' or 'false'.");
        if (looking && secondThing) {
            console.log("Moments after you and your VERY ATTRACTIVE shuttlemates 
             strap in to your anti-G gel beds, SHWOOMPF K-CHK K-CHK KSHHHHHHHHHHHHHhhh
             hhhhh, you have taken off!  Enjoy the next several years, and your squeaky
             cheese!  You won!");
        } else if (looking || secondThing) {
            console.log("I guess you got one of them?  but not both?  you still 
             win, I guess?");
        } else {
            console.log("not really sure but I guess you lost.");
    case 'shuttle':
        console.log("you made it!  but your tummy's grumbling.");
        console.log("your unpredictable behavior is reprehensible.");

5 thoughts on “Javascript minichoose

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s