Skip to content

Instantly share code, notes, and snippets.

@krpeacock
Created March 16, 2021 02:55
Show Gist options
  • Save krpeacock/60813352a5684134d87467801e8c711b to your computer and use it in GitHub Desktop.
Save krpeacock/60813352a5684134d87467801e8c711b to your computer and use it in GitHub Desktop.
(()=>{
var mathProblem = `Calculate your bill:
Your tab came up to $88.50. Tax is 9%, and if you're feeling generous, you'll tip 20%. It's a pandemic, after all.
`
var riddle = `What goes up, but never comes down?`
var lifeSkill = `What is the second, little section, of the dishwasher detergent compartment for?`
console.log(`You are wandering through the forest, when you find a giant temple, with three ogres in front of the entrance.`);
console.log(`The first guard says, "to proceed, you must answer our three questions. If you answer wrong, you will die."`);
var proceed = prompt("Do you wish to continue?", "yes");
if(proceed !== "yes"){
console.error('you gave up!');
return;
}
console.log('Guard 1 asks you their question: ', mathProblem)
var question1 = prompt(mathProblem)
if(Math.floor(question1) > 96 && Math.floor(question1) < 114){
console.error('The guard hits you with a giant club. You should have tipped!');
return;
}
else if(Math.floor(question1) !== 114){
console.error('The guard hits you with a giant club on the head. You lose.');
return;
}
console.log('Guard 1 nods solemnly and says, "Correct. On to the next challenge"');
console.log('Guard 2 approaches and asks you their riddle: ', riddle);
var question2 = prompt(riddle);
if(question2.toLowerCase() === "age" || question2.toLowerCase() === "your age" || question2.toLowerCase() === "a person's age"){
}
else {
prompt("I'll give you one more chance. " + riddle);
if(question2.toLowerCase() === "age" || question2.toLowerCase() === "your age" || question2.toLowerCase() === "a person's age"){}
else {
console.error("The guard puts you on timeout. You sulk in the corner for 15 minutes and then you are allowed to go home.");
return;
}
}
console.log(`Congratulations. You have answered correctly, and now are on to the final question.`);
console.log('Guard 3 approaches, and asks ', lifeSkill);
var question3 = prompt(lifeSkill);
if(question3.includes('prewash')){}
else {
console.error("You have failed the final challenge. Victory is not yours.");
return;
}
console.log(`Congratulations! The guards let you enter, and inside you find a large pile of chitlins. You're invited to the cookout`);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment