Created
January 14, 2016 21:24
-
-
Save brettvaida/d3641a972b97c0ca991f to your computer and use it in GitHub Desktop.
Choose your own adventure game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = prompt("The door is locked. Do you SEARCH for a key, try to PICK the lock, or KICK the door?").toUpperCase(); | |
switch (user) { | |
case 'SEARCH': | |
var perceptive = prompt("Do you have good eyesight? (YES/NO)").toUpperCase(); | |
var thorough = prompt("Are you thorough? (YES/NO)").toUpperCase(); | |
if (perceptive === 'YES' || thorough === 'YES') { | |
console.log("You search the room, find the key, and unlock the door."); | |
} else { | |
console.log("You search the room, but are unable to find the key."); | |
} | |
break; | |
case 'PICK': | |
var locksmith = prompt("Do you know how to pick locks? (YES/NO)").toUpperCase(); | |
var hasPicks = prompt("Do you have lock picks? (YES/NO)").toUpperCase(); | |
if (locksmith === 'YES' && hasPicks === 'YES') { | |
console.log("You pick the lock and open the door."); | |
} else { | |
console.log("You lack the required tools or experience to pick the lock."); | |
} | |
break; | |
case 'KICK': | |
var strong = prompt("Are you strong? (YES/NO)").toUpperCase(); | |
var sureStrong = prompt("Are you sure? (YES/NO)").toUpperCase(); | |
if (strong === 'YES' && sureStrong === 'YES') { | |
console.log("You kick the door as hard as you can, but it doesn't open."); | |
} else { | |
console.log("You kick the door as hard as you can, and break your leg instantly."); | |
} | |
break; | |
default : | |
console.log("That door isn't going to unlock itself. Try again!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment