Guest User

Untitled

a guest
Dec 7th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 9.36 KB | None | 0 0
  1. %AREAS
  2.  
  3. location(troll,'You find yourself at the feet of a gigantic cave troll. \nHe growls at you menacingly, spraying you with gobs of his saliva. \n\nCome closer adventurer, he calls out. I havent spoken to a human in ages.. \nWelcome to the adventure! Type help to see commands. Talk to the troll to move on.').
  4. location(entrance,'You are in the entrance of a large cave. \nYou see that there is no way to get back out. \nTo the north is a lavishly decorated room, and to the south there is a long dark corridor labeled >TRAZURE<.').
  5. location(impslair, 'The cave is littered with expensive couches and pillows. \nYou can tell its dweller is very rich. \nLying at the end of the room is an impish looking fellow in a purple suit. \nHis nametag has been scratched off. Now it reads M######LK.\nBack to the south is the cave entrance.').
  6. location(treasureroom, 'The room is full of the treasures of past civilization. \nYou find it quite impossible to move them however, as they have been petrified by some sick smelling magic. \nTo the north is the cave entrance, and to the south is a fork in the cave.').
  7. location(fork, 'The path through the cave splits here. \nYou can hear the hustle and bustle of a town coming from somewhere. \nDown a ramp to the south you see a sandy floor.').
  8. location(town, 'Up the ramp there is a single human man in traditional middle eastern garb. \nHe sits on a large carpet next to a large boombox, which is projecting all of the sounds of civilization. \nHe eyes you carefully and frowns deeply. \nThe doormat says FORMERLY THE LAIR OF MXYZPTLK THE IMP. \nTo the west is the fork.').
  9. location(temple,'The cave floor is completely covered by sand. The light walls of an egyptian temple replace the dark cave walls. \nTo the north is the fork. To the east is an altarroom').
  10. location(altarroom, 'There is a gigantic ooze monster blocking your progress. This room once held a great altar, but now it is soiled. \nTo the west is the temple.').
  11. location(lightroom, 'A jeweled room with a beam of light in the middle. \nInside the beam you see a shadowy figure with an epic beard. \nAs your eyes adjust you see that the figure is none other than.... \n#38 of the San Francisco Giants, Mr. Brian Wilson himself. \nBack to the west is the altarroom.').
  12. location(safety,'You are on the surface now. Type done. to see how you did.').
  13.  
  14. %STATUS'
  15.  
  16. where(troll).
  17. treasure(none).
  18. back(thevoid).
  19. boss(nd).
  20. riddle(nd).
  21.  
  22.  
  23. %DOORS
  24.  
  25. door(troll, entrance).
  26. door(entrance,impslair).
  27. door(treasureroom,entrance).
  28. door(fork,treasureroom).
  29. hiddendoor(fork,town).
  30. door(temple,fork).
  31. door(temple,altarroom).
  32.  
  33.  
  34. %ITEMS
  35.  
  36. item(bazooka, 'A flippin bazooka.', forsale, nowhere, moveable).
  37. item(crossbow, 'A nonimpressive, yet very safe, crossbow.', forsale, nowhere, moveable).
  38. item(treasure, 'A large treasure pile.', nothidden, treasureroom, fixed).
  39.  
  40. %START BASIC COMMANDS
  41.  
  42. connected(X,Y) :- door(X,Y); door(Y,X).
  43.  
  44. look :- where(X), location(X, Y), nl, write(Y), nl, nl, show_items, nl, adjacent.
  45.  
  46. show_items :- where(Y), item(V,W,nothidden,Y,Z), write('You see an '), write(V),write('\n'), fail.
  47. show_items.
  48.  
  49. itemsearch :- where(Y), item(V,W,hidden,Y,Z), retract(item(V,_,_,_,_)), assert(item(V,W,nothidden,Y,Z)), write('You found a '), write(V), write('\nl').
  50. itemsearch.
  51.  
  52. inventory :- item(V,W,X,carrying,Z), write(W), nl, fail.
  53.  
  54. take(V) :- treasuretaker(V), where(Y), item(V,W,X,Y,Z), retract(item(V,_,_,_,_)), assert(item(V,W,X,carrying,Z)), write('You got it!').
  55.  
  56. treasuretaker(V) :- where(treasureroom), V = 'treasure', item(treasure,Y,Z,P,moveable), retract(item(treasure,_,_,_,_)), retract(treasure(_)), assert(treasure('3/3')), write('You take as much as you can carry.\n'), treasure.
  57.  
  58. drop(V) :- where(Y), item(V,W,X,G,Z), retract(item(V,_,_,_,_)), assert(item(V,W,X,Y,Z)).
  59.  
  60. h_adjacent :- write('You can move to'), nl.
  61. adjacent :- h_adjacent, where(X), connected(X,Y), write(Y), nl, fail.
  62. adjacent.
  63.  
  64. move(Y) :- where(X), retract(back(_)), assert(back(X)), connected(X,Y), retract(where(_)), assert(where(Y)), write('You are now in the '), write(Y), nl, troll, look; write('I see no way to get to the '), write(Y), write(' from here.').
  65.  
  66. troll :- back(troll), retract(door(troll,entrance));true.
  67.  
  68. doorsearch :- where(X), hiddendoor(X,Y), write('Alas! You caught a break. There is a hidden '), write(Y), write(' here! '), assert(door(X,Y)), retract(hiddendoor(X,Y)), write('Search again?'), nl, nl, look; where(X), hiddendoor(Y,X), write('Alas! You caught a break. There is a hidden '), write(Y), write(' here! '), assert(door(Y,X)), retract(hiddendoor(Y,X)), write('Search again?'), nl, nl, look.
  69. doorsearch.
  70.  
  71. search :- doorsearch, itemsearch;  write('These are not the droids you are looking for.').
  72.  
  73. talk :- where(Y), Y = 'troll', write('Halloooo. I am Reordin, the great keeper of the cave. \nWell, at least I was. Now my cave is full of strange creatures and evils. Can you go inside and clear them out for me. \nYou can even have some of my treasures. At least as much as a human can carry huehue....'); where(town), item(bazooka,_,_,nowhere,_), item(crossbow,_,_,nowhere,_), write('What do ye want? \nDont talk to me unless you want to buy my wares. \nFrom me, you can buy a bazooka for a 2/3 pile of treasure, or a crossbow for a 1/3 pile of treasure. \nYour choice mack.'); where(town), armed, write('Go away. Ive already given you the deal of a lifetime.'); where(impslair), write('WHAT IS MY NAME HUMAN??? \n(if you have the answer say it here.)'); brianwilson.
  74.  
  75. brianwilson :- where(lightroom), write('This game is too big for you to finish. You need a closer. \nThe large scary man then proceeds to throw a 99mph fast ball toward the eastern wall, blowing it to pieces. \nYou see a glimmer of hope shine through the wall. You know that the hole leads to the outside. \nTears well up in your eyes as you look to your new hero. Better thank him.\n'), assert(door(lightroom,safety)), retract(location(lightroom,_)), assert(location(lightroom, 'THE MAN Brian WIlson is here. \nBack to the west is the altarroom, to the east is safety.\n\n')), look.
  76.  
  77. done :- where(safety), scoreme.
  78.  
  79. scoreme :- treasure('1/3'), write('Congrats on beating the game. You scored a low. \nGreed must have gotten the better of you inside the cave, but at least you have enough to live on for a while. \nBut you fear that you will never escape the life of an adventurer at this rate. You write down the caves location on your map just to be sure you remember down the road....'); treasure('2/3'), write('Congrats on beating the game. You scored a medium. \nYou did what you had to do inside the cave. You made some hard decisions while still thinking of your future needs. You came out with enough gold to quit adventuring. \nMaybe with the right investments you will never have to come back to the cave.'); treasure('3/3'), write('Congrats on beating the game. You scored a high. \nYou carried out as much gold as a human possibly could. You should be commended for your fine work, but alas, no one will ever know of this achievement except for you. \n Well, except for you and your new troupe of butlers and handmaidens. The life of an adventurer is now way behind you.').
  80.  
  81. armed :- item(crossbow,_,_,carrying,_); item(bazooka,_,_,carrying,_).
  82.  
  83. pay(X) :- X = 'bazooka', retract(treasure(_)), assert(treasure('1/3')), write('Treasure taken.'); X = 'crossbow', retract(treasure(_)), assert(treasure('2/3')), write('Treasure taken.').
  84.  
  85. buy(X) :- armed, write('No can do.'); treasure('3/3'), where(town), item(X,Y,Z,P,D), pay(X), retract(item(_,_,_,_,_)), assert(item(X,Y,Z,carrying,D)), write('You got the '), write(X), write(' hooray!'); write('No can do.').
  86.  
  87. treasure :- treasure(X), write('You have '), write(X), write(' treasure\n').
  88. treasure.
  89.  
  90. thanks :- where(lightroom), write('Forget about it kid. It was nothing. \nBrian throws you a signed gold coin for your trouble\n'), freecoin.
  91.  
  92. freecoin :- treasure('1/3'), retract(treasure(_)), assert(treasure('2/3')); treasure('2/3'), retract(treasure(_)), assert(treasure('3/3')).
  93.  
  94. kill :- armed, boss(nd), where(altarroom), write('Its dead jim!'), retract(location(altarroom, _)), assert(location(altarroom, 'Here is the remains of a great black ooze. \nTo the west is the temple, now the the east is the lightroom.')), retract(boss(_)), assert(boss(d)), assert(door(altarroom,lightroom)), look.
  95.  
  96. back :- back(X), move(X).
  97.  
  98. mxyzptlk :- where(impslair), item(treasure,Y,Z,P,D), retract(item(treasure,_,_,_,_)), assert(item(treasure,Y,Z,P,moveable)), write('You hear a loud crackle from the other room. \nYou know now that the treasure in the other room is no longer fixed to the ground. \nNOW GET OUT OF MY CAVE the impish man yells. I WOULDNT WANT YOU TO GET ANY IDEAS. \n\n'), retract(location(treasureroom, _)), assert(location(treasureroom, 'The room is full of the treasures of past civilization, no longer fixed to the ground.\nTo the north is the cave entrance, and to the south is a fork in the cave.')).
  99.  
  100. kltpzyxm :- mxyzptlk, where(impslair), write('NOOOOO the man yells, as the room dissapears around you. \nYou look up and find yourself in the treasure room. \n'), retract(where(_)), assert(where(treasureroom)), retract(door(entrance,impslair)).
  101.  
  102. teleport(X) :- location(X,Y), retract(where(_)), assert(where(X)), look.
  103.  
  104. help :- write('Commands: look, move(X), back, treasure, inventory, search, take(X), drop(X), talk, thanks, buy(X), kill.').
  105. gmhelp :- write('GM Commands: teleport(X).').
  106.  
  107. boring :- write('Sorry.').
Add Comment
Please, Sign In to add comment