dad.cpp


SUBMITTED BY: anthonylopez

DATE: Jan. 9, 2017, 2:41 a.m.

FORMAT: C++

SIZE: 9.2 kB

HITS: 965

  1. /*
  2. * main.cpp
  3. * Text Based Adventure
  4. *
  5. * Created by Memedaddy on 12/14/16.
  6. * Copyright © 2016 Memedaddy. All rights reserved.
  7. */
  8. #include <iostream>
  9. #include <string>
  10. using namespace std;
  11. int main() {
  12. string in;
  13. bool alive = true, dogMoved = false, dwarfMoved = false, dragonMoved = false, greedyAF = false;
  14. cout << "\tYou wake up in a dimly lit room.\n";
  15. cout << "\tThere is a door in front of you.\n";
  16. cout << "\tAn inscription reads, \"Welcome to my incredibly complicated maze.\"\n";
  17. cout << "\tYou look around and there is nothing else around. The door seems to be the only option.\n";
  18. cout << "\n[\topen door\t]\n";
  19. cout << "> ";
  20. getline(cin, in);
  21. if(in != "open door") {
  22. cout << "\n\tThe ceiling collapses.\n";
  23. cout << "\tYou are dead.\n";
  24. alive = false;
  25. return 0;
  26. }
  27. cout << "\n\tYou enter the next room. The door behind you slams shut.\n";
  28. cout << "\tYou see a large dog in front of another door.\n";
  29. cout << "\tHe is gnawing on a bone, however you startle him and he begins to watch you.\n";
  30. cout << "\tYou hastily turn around in order to escape through the door you came in.\n";
  31. cout << "\tThe door is locked. The only way out is through the door behind the dog.\n";
  32. cout << "\tThere's no way through that door without getting past the dog.\n";
  33. cout << "\tBut how?\n";
  34. while(true) {
  35. if(!alive) {
  36. cout << "\tYou are dead.\n";
  37. break;
  38. }
  39. cout << "\n[\tcall dog\t]\n";
  40. cout << "[\ttaunt dog\t]\n";
  41. cout << "[\ttake bone\t]\n";
  42. if(dogMoved) {
  43. cout << "[\topen door\t]\n";
  44. }
  45. cout << "> ";
  46. getline(cin, in);
  47. if(in == "call dog") {
  48. cout << "\n\tThe dog bounds over to you and before you can even react, it knocks you to the ground.\n";
  49. cout << "\tYour consciousness begins to fade away.\n";
  50. alive = false;
  51. } else if(in == "taunt dog") {
  52. cout << "\n\tYour excessive waving annoyed the dog and he attacked you.\n";
  53. cout << "\tOddly enough, your consciousness begins to fade.\n";
  54. alive = false;
  55. } else if(in == "take bone") {
  56. if(dogMoved) {
  57. cout << "\n\tYou daringly take the bone, yet again.\n";
  58. cout << "\tHowever, this time, you're out of luck.\n";
  59. cout << "\tBefore you can even attempt to throw the bone, the dog rips you to shreds.\n";
  60. alive = false;
  61. } else {
  62. cout << "\n\tIn a moment of madness, you snatch the bone from the dog.\n";
  63. cout << "\tBefore he rips you to shreds, you throw the bone and shout\n";
  64. cout << "\t\"Fetch!\"\n";
  65. cout << "\tThe dog bounds eagerly after the bone.\n";
  66. dogMoved = true;
  67. }
  68. } else if(in == "open door" && dogMoved) {
  69. break;
  70. } else {
  71. cout << "\n\tThat wouldn't work too well here...\n";
  72. }
  73. }
  74. if(!alive) {
  75. return 0;
  76. }
  77. cout << "\n\tYou look around the new room as the sounds of the slamming door echos behind you.\n";
  78. cout << "\tYou see a dwarf guarding the next door.\n";
  79. cout << "\tHe, she, er.. it, is looking at you intently.\n";
  80. cout << "\tYou get the feeling the dwarf is trying to stare you up. (dwarves\n";
  81. cout << "\tare not able to stare down many people; even most animals are\n";
  82. cout << "\tout of the question)\n\n";
  83. cout << "\tYou need to wipe that stare of it's face.\n";
  84. while(true) {
  85. if(!alive) {
  86. cout << "\tThe dwarf walks over and smacks you in the head with the\n";
  87. cout << "\tside of the axe.\n";
  88. cout << "\tAs you lose conciousness you think to yourself how lucky\n";
  89. cout << "\tyou are that the flat side and not the sharp side connected\n";
  90. cout << "\twith your noggin.\n";
  91. cout << "\tYou are dead.\n";
  92. break;
  93. }
  94. cout << "\n[\ttalk\t]\n";
  95. cout << "[\tpush\t]\n";
  96. cout << "[\ttake axe\t]\n";
  97. if(dwarfMoved) {
  98. cout << "[\topen door\t]\n";
  99. }
  100. cout << "> ";
  101. getline(cin, in);
  102. if(in == "talk") {
  103. cout << "\n\tYou try to reason with the dwarf.\n";
  104. cout << "\tUnfortunately, your dwarfish is very rusty and you\n";
  105. cout << "\tinsult it instead.\n";
  106. alive = false;
  107. } else if(in == "push") {
  108. cout << "\n\tDespite being half your size, pushing dwarfs around is never a good idea.\n";
  109. alive = false;
  110. } else if(in == "take axe") {
  111. cout << "\n\tEmboldened by your perfomance in the last room, you\n";
  112. cout << "\tsnatch the axe from the grasp of the dwarf.\n";
  113. cout << "\tThis upsets the dwarf.\n";
  114. cout << "\tA lot.\n";
  115. cout << "\tYou feel like a bully, but only for the moment.\n";
  116. cout << "\tBecause, the door is clear. And you have an axe.\n";
  117. cout << "\t...\n";
  118. cout << "\tNo, you are not going to do a \"Shining\" on the door.\n";
  119. dwarfMoved = true;
  120. } else if(in == "open door" && dwarfMoved) {
  121. break;
  122. } else {
  123. cout << "\n\tThat wouldn't work too well here...\n";
  124. }
  125. }
  126. if(!alive) {
  127. return 0;
  128. }
  129. cout << "\n\tYou enter what feels like the final room.\n";
  130. cout << "\tBlocking the door this time is a great big dragon.\n";
  131. cout << "\tIn keeping with mythical creature stereotype, the dragon is sitting on a\n";
  132. cout << "\tgreat big pile of gold.\n";
  133. cout << "\tHow are you going to part a dragon with its gold, and therefore free the\n";
  134. cout << "\tdoor up for you to go through?\n";
  135. while(true) {
  136. if(!alive) {
  137. cout << "\tYou are dead.\n";
  138. break;
  139. }
  140. cout << "\n[\tnoise\t]\n";
  141. cout << "[\tslap\t]\n";
  142. cout << "[\tuse axe\t]\n";
  143. if(dragonMoved) {
  144. cout << "[\topen door\t]\n";
  145. cout << "[\ttake gold\t]\n";
  146. }
  147. cout << "> ";
  148. getline(cin, in);
  149. if(in == "noise") {
  150. cout << "\n\tYou make a noise that you hope will scare the dragon away.\n";
  151. cout << "\tThis just annoys the dragon.\n";
  152. cout << "\tIt slaps you into unconciousness.\n";
  153. cout << "\tThe sight of those claws coming towards you will haunt you \n";
  154. cout << "\tforever.\n";
  155. cout << "\tWell at least, they would have...\n";
  156. cout << "\tThat is, if they hadn't actually sliced through your skull..\n";
  157. alive = false;
  158. } else if(in == "slap") {
  159. cout << "\tYou slap the dragon, right on the snout.\n";
  160. cout << "In return, the dragon casually sends out a flame\n";
  161. cout << "which toasts you alive.\n";
  162. alive = false;
  163. } else if(in == "use axe") {
  164. cout << "\n\tYou remember you are still carrying an axe.\n";
  165. cout << "\tYou heft the axe and begin to walk towards the dragon.\n";
  166. cout << "\tSensing something is wrong, the dragon opens its eyes.\n";
  167. cout << "\tUpon seeing your big axe, the dragon lets out a scream\n";
  168. cout << "\tand bolts, leaving its gold behind and the door free to walk through.\n";
  169. dragonMoved = true;
  170. } else if(in == "open door") {
  171. break;
  172. } else if(in == "take gold") {
  173. greedyAF = true;
  174. break;
  175. } else {
  176. cout << "\n\tThat wouldn't work too well here...\n";
  177. }
  178. }
  179. if(!alive) {
  180. return 0;
  181. }
  182. if(greedyAF) {
  183. cout << "\n\tWith the dragon gone, the pile of shining gold seems to call to you.\n";
  184. cout << "\tYou go over to the pile of gold, and fill your pockets, and take as much\n";
  185. cout << "\tof the lovely stuff in your arms.\n";
  186. cout << "\tYou stagger over to the door and attempt to open the door.\n";
  187. cout << "\tAfter several attempts, you manage to open the door, while still carrying\n";
  188. cout << "\ta load of gold.\n";
  189. cout << "\tYou are free.\n";
  190. cout << "\tAnd rich.\n";
  191. cout << "\tNow, if only you knew where you were...\n";
  192. } else {
  193. cout << "\n\tYou open the door and see your way out.\n";
  194. cout << "\tAs you walk through the door it slams behind you.\n";
  195. cout << "\tAnd then you remember about the pile of gold.\n";
  196. cout << "\t...\n";
  197. cout << "\tUnguarded...\n";
  198. cout << "\tCompletely unguarded...\n";
  199. cout << "\tBut, hey... at least you have an axe.\n";
  200. }
  201. cout << "\n\n\t\tTHE END\n";
  202. return 0;
  203. }

comments powered by Disqus