Guest User

Untitled

a guest
Oct 17th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Guessing Game</title>
  5. </head>
  6. <body>
  7. <h1>Welcome to Code 201!</h1>
  8. </body>
  9. <script>
  10. var user = prompt('What is your name?');
  11. console.log('user: ' + user);
  12. if( user === '' || user === null){
  13. alert("Fine, don't play...");
  14. }
  15. else
  16. {
  17. alert('Greetings, ' + user + '. I have three questions...' );
  18.  
  19. var userFrom = prompt( user + ', where do you hail from?');
  20. console.log('userFrom: ' + userFrom);
  21.  
  22. if(userFrom === '' || userFrom === null){
  23. alert('I\'m sorry you don\'t feel like sharing, ', user );
  24. }
  25. else
  26. {
  27. alert('Bravo, ' + user + " of " + userFrom + ', you have traversed many domains to get here.');
  28.  
  29. var userQuest = prompt( user + ", hailing from " + userFrom + ', what is your quest?');
  30. console.log('userQuest: ' + userQuest);
  31.  
  32. if( userQuest === '' || userQuest === null){
  33. alert('You have come far in your journey with my questions, but you will not go far in life with out a nobel quest. End of line.');
  34. }
  35. else
  36. {
  37. if( userQuest === 'I seek the Holy Grail'){
  38. alert(userQuest + ', tis the nobelest of quests, Sir Galahad!')
  39. }
  40. else
  41. {
  42. alert(userQuest + ', tis the nobelest of quests! ');
  43. }
  44.  
  45. var favoriteColor = prompt( user + " of " + userFrom + ', what is your favorite color?');
  46. console.log('favoriteColor: ' + favoriteColor);
  47.  
  48. if( favoriteColor === '' || favoriteColor === null ){
  49. alert('I find you bland and boring, ' + user + ' of ' + userFrom + '. I have grown tired of you. Good day!');
  50. }
  51. else
  52. {
  53. if( favoriteColor === 'Red! I mean blue!' ){
  54. alert('Normally I would cry foul, but I accept your answer, Sir Lancelot!' );
  55. }
  56. else
  57. {
  58. alert('Ahh, ' + user + " of " + userFrom + ', on a quest ' + userQuest + ', I see you have a penchant for ' + favoriteColor + '. Alas, there be but one question left...');
  59. }
  60.  
  61. var velocityAnswer = prompt('What is the airspeed velocity of a swallow?');
  62. console.log('velocityAnswer: ' + velocityAnswer);
  63.  
  64. if( velocityAnswer === '' || velocityAnswer === null){
  65. alert(user + " of " + userFrom + ', obsessed with ' + favoriteColor + ', on a quest ' + userQuest +', you surely disapoint...')
  66. }
  67. else
  68. {
  69. if( velocityAnswer === 'African or European?'){
  70. alert('\"African or European?\" Fine ' + user + " of " + userFrom + ', obsessed with ' + favoriteColor + ', on a quest ' + userQuest +', you are obviously a Monty Python fan!' );
  71. }
  72. else
  73. {
  74. alert(velocityAnswer + 'was a noble guess, but the this was actually a trick question. The real answer is actually a question');
  75.  
  76. alert('African or European?');
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. </script>
  84. </html>
Add Comment
Please, Sign In to add comment