Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let readlineSync = require('readline-sync');
- // var userName = readlineSync.question('May I have your name? ');
- // console.log('Hi ' + userName + '!');
- function startRoom(){
- console.log("- You awake to find yourself in a cold, dark room. You look around and see three doors.");
- console.log("- A super peppy woman shows up. She introduces herself as Bria.");
- console.log('- She motions towards the doors and speaks, "Now we shall see if you are truly ready to be a web developer. Enter the maze and test your mettle against the challenges that await. Beware though! One wrong choice and youd\'re done!');
- var query = readlineSync.question("-- Pick a door [1, 2, or 3] \n > ");
- if(query == "1"){
- room1();
- } else if(query == "2"){
- room2();
- } else if(query == "3"){
- room3();
- } else {
- console.log("- Enter a valid selection.");
- startRoom();
- }
- }
- function winston(){
- console.log('- WRONG! Winston says you suck. GAME OVER');
- }
- function angel(){
- console.log("- You look around this new room and see two doors on the other side. A figure quietly stands in the shadows.");
- console.log("- He steps into the dim light and introduces himself as Angel. Seems like a pretty cool dude. Also like the kind of guy who chills in the back of a classroom typing on a computer doing cool stuff or something. I don't know.");
- }
- function don(){
- console.log("- You arrive into a room similar in ambience to the previous one.");
- console.log("- As before, another figure approaches only this time accompanied by a sweet dog.");
- console.log('"- Welcome!", he loudly exclaims as his doggie wags her tail rapidly.');
- console.log("- Now you must successfully answer this question if you wish to proceed.");
- }
- function room1(){
- angel();
- console.log("-He asks what HTML is used for?")
- var query = readlineSync.question('- A: Used to style your website, B: Used to give structure to your website, C: Used to make your website interactive. [A, B, C] \n > ');
- var answer = query.toLowerCase();
- if(answer == "a"){
- winston();
- } else if(answer == "b"){
- pickRandomRoom();
- } else if(answer == "c"){
- winston();
- } else {
- winston();
- }
- }
- function room2(){
- angel();
- console.log("- He asks what CSS is used for?");
- var query = readlineSync.question('- A: Used to give structure to your website, B: Used to make your website dynamic, C: Used to style your website. [A, B, C] \n > ');
- var answer = query.toLowerCase();
- if(answer == "a"){
- winston();
- } else if(answer == "c"){
- pickRandomRoom();
- } else if(answer == "b"){
- winston();
- } else {
- winston();
- }
- }
- function room3(){
- angel();
- console.log("- What is Javascript used for?");
- var query = readlineSync.question('- A: Used to give structure to your website, B: Used to make your website dynamic, C: Used to style your website. [A, B, C] \n > ');
- var answer = query.toLowerCase();
- if(answer == "a" || answer == "c"){
- winston();
- } else if(answer == "b"){
- pickRandomRoom();
- } else {
- winston();
- }
- }
- function pickRandomRoom(){
- console.log("- Excellent choice! Now pick a door and proceed.")
- var query = readlineSync.question("- Pick a door [1 or 2] > ");
- if(query == 1) {
- room4();
- } else if(query == 2){
- room5();
- } else {
- console.log('- Make a valid selection');
- pickRandomRoom();
- }
- }
- function room4(){
- don();
- console.log("-What is the purpose of an object?")
- var query = readlineSync.question('- A: a code block that executes when called, B: a container to store data, C: a container with key: value pairs [A, B, C] > ');
- var answer = query.toLowerCase();
- if(answer == "c"){
- interviewRoom();
- }else if(answer == "a" || answer == "b"){
- winston();
- } else {
- console.log("-Invalid selection.");
- room4();
- }
- }
- function room5(){
- don();
- console.log("- What is the purpose of an array?")
- var query = readlineSync.question('- A: a container to store data, B: a code block that executes when called, C: a container with name: value pairs [A, B, C] \n > ');
- var answer = query.toLowerCase();
- if(answer == "a"){
- interviewRoom();
- } else if(answer == "b" || answer == "c"){
- winston();
- } else {
- console.log("- Invalid selection.")
- room5();
- }
- }
- function interviewRoom(){
- console.log("- You proceed through the door and see a lone man sitting behind a desk beckoning you towards an empty chair.");
- console.log("- You sit down as he welcomes you to your job interview.");
- console.log("- Congratulations on making it this far. Now we just have one final question for you.");
- console.log(`- What's your experience with ReactJS?`);
- var query = readlineSync.question(`- A: lie and say you can do it, B: flat out say that you have no idea what he's talking about, C: tell him you are familiar with the concept and are willing to quickly learn it \n > `);
- var answer = query.toLowerCase();
- if(answer == 'a' || answer == 'b'){
- winston();
- } else if (answer == 'c'){
- endGame();
- } else {
- console.log('- Please enter a valid selection');
- interviewRoom();
- }
- }
- function endGame(){
- console.log(`"-Excellent work!", he exclaims! "You're hired! Just go through the door to get started."`);
- console.log(`-You go through the doors to see your old buddy Patricio.`);
- console.log(`-You go up to him to celebrate his teachings but he interrupts you.`);
- console.log(`-Did you really think you could get a job after two weeks of training? Wake up!`);
- }
- startRoom();
Add Comment
Please, Sign In to add comment