Guest User

Untitled

a guest
Jul 17th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. let readlineSync = require('readline-sync');
  2.  
  3. // var userName = readlineSync.question('May I have your name? ');
  4. // console.log('Hi ' + userName + '!');
  5.  
  6. function startRoom(){
  7. console.log("- You awake to find yourself in a cold, dark room. You look around and see three doors.");
  8. console.log("- A super peppy woman shows up. She introduces herself as Bria.");
  9. 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!');
  10. var query = readlineSync.question("-- Pick a door [1, 2, or 3] \n > ");
  11. if(query == "1"){
  12. room1();
  13. } else if(query == "2"){
  14. room2();
  15. } else if(query == "3"){
  16. room3();
  17. } else {
  18. console.log("- Enter a valid selection.");
  19. startRoom();
  20. }
  21. }
  22.  
  23. function winston(){
  24. console.log('- WRONG! Winston says you suck. GAME OVER');
  25. }
  26.  
  27. function angel(){
  28. console.log("- You look around this new room and see two doors on the other side. A figure quietly stands in the shadows.");
  29. 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.");
  30. }
  31.  
  32. function don(){
  33. console.log("- You arrive into a room similar in ambience to the previous one.");
  34. console.log("- As before, another figure approaches only this time accompanied by a sweet dog.");
  35. console.log('"- Welcome!", he loudly exclaims as his doggie wags her tail rapidly.');
  36. console.log("- Now you must successfully answer this question if you wish to proceed.");
  37. }
  38.  
  39.  
  40. function room1(){
  41. angel();
  42. console.log("-He asks what HTML is used for?")
  43. 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 > ');
  44. var answer = query.toLowerCase();
  45. if(answer == "a"){
  46. winston();
  47. } else if(answer == "b"){
  48. pickRandomRoom();
  49. } else if(answer == "c"){
  50. winston();
  51. } else {
  52. winston();
  53. }
  54. }
  55.  
  56. function room2(){
  57. angel();
  58. console.log("- He asks what CSS is used for?");
  59. 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 > ');
  60. var answer = query.toLowerCase();
  61. if(answer == "a"){
  62. winston();
  63. } else if(answer == "c"){
  64. pickRandomRoom();
  65. } else if(answer == "b"){
  66. winston();
  67. } else {
  68. winston();
  69. }
  70. }
  71.  
  72.  
  73. function room3(){
  74. angel();
  75. console.log("- What is Javascript used for?");
  76. 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 > ');
  77. var answer = query.toLowerCase();
  78. if(answer == "a" || answer == "c"){
  79. winston();
  80. } else if(answer == "b"){
  81. pickRandomRoom();
  82. } else {
  83. winston();
  84. }
  85. }
  86.  
  87. function pickRandomRoom(){
  88. console.log("- Excellent choice! Now pick a door and proceed.")
  89. var query = readlineSync.question("- Pick a door [1 or 2] > ");
  90. if(query == 1) {
  91. room4();
  92. } else if(query == 2){
  93. room5();
  94. } else {
  95. console.log('- Make a valid selection');
  96. pickRandomRoom();
  97. }
  98. }
  99.  
  100. function room4(){
  101. don();
  102. console.log("-What is the purpose of an object?")
  103. 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] > ');
  104. var answer = query.toLowerCase();
  105. if(answer == "c"){
  106. interviewRoom();
  107. }else if(answer == "a" || answer == "b"){
  108. winston();
  109. } else {
  110. console.log("-Invalid selection.");
  111. room4();
  112. }
  113. }
  114.  
  115. function room5(){
  116. don();
  117. console.log("- What is the purpose of an array?")
  118. 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 > ');
  119. var answer = query.toLowerCase();
  120. if(answer == "a"){
  121. interviewRoom();
  122. } else if(answer == "b" || answer == "c"){
  123. winston();
  124. } else {
  125. console.log("- Invalid selection.")
  126. room5();
  127. }
  128. }
  129.  
  130. function interviewRoom(){
  131. console.log("- You proceed through the door and see a lone man sitting behind a desk beckoning you towards an empty chair.");
  132. console.log("- You sit down as he welcomes you to your job interview.");
  133. console.log("- Congratulations on making it this far. Now we just have one final question for you.");
  134. console.log(`- What's your experience with ReactJS?`);
  135. 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 > `);
  136. var answer = query.toLowerCase();
  137. if(answer == 'a' || answer == 'b'){
  138. winston();
  139. } else if (answer == 'c'){
  140. endGame();
  141. } else {
  142. console.log('- Please enter a valid selection');
  143. interviewRoom();
  144. }
  145. }
  146.  
  147. function endGame(){
  148. console.log(`"-Excellent work!", he exclaims! "You're hired! Just go through the door to get started."`);
  149. console.log(`-You go through the doors to see your old buddy Patricio.`);
  150. console.log(`-You go up to him to celebrate his teachings but he interrupts you.`);
  151. console.log(`-Did you really think you could get a job after two weeks of training? Wake up!`);
  152. }
  153.  
  154. startRoom();
Add Comment
Please, Sign In to add comment