## GAGUE ADVENTURE - score 120 points ## Remember the reason why Nicholas McConnell keeps planning more of these. ## If you're bored with one, you can try another. import os from random import * print "GAGUE ADVENTURE \n" sections = [ ( """You are in a finale's room at the south end of a long hallway.""", #0 "S Finale's Room"), ( """You are at the dead end of a dirt road. The road goes to the north. In the distance you see it will eventually fork off. The trees around you are very tall fruit trees, and they are spaced equidistant from each other.""", "Dead end"), ( """You are on the continuation of a dirt road. There are more trees on the sides of you. The road goes north and south.""", "N/S dirt road"), ( """You have reached a fork of two passages, one to the northwest, and one to the northeast. The ground here seems very soft. You can also go back south.""", "Fork"), ( """You are on a southeast-northwest road.""", "SE/NW road"), ( """You are at the end of a road. There is a stone wall to the northwest. You can go back southeast.""", #5 "NW end of road"), ( """You are on a northeast-southwest road.""", "NE/SW road"), ( """You have reached the end of a road. The road goes southwest.""", "Elephant hangout"), ( """You are at the front of a large building to the north. You can also go back southeast.""", "Building front"), ( """You are in the hallway of a building. There are rooms to the north and west, and a door to the south.""", "Building hallway"), ( """You are in a room where people often participate in drama. There is a large wooden board on the ground here. There is a door to the east. The exit is to the south.""", #10 "Drama room"), ( """You are in a room which appears to have a personal active computer on the counter. There is a gate to the west. The exit is to the east. Use the 'type' command to type on the PAC.""", "PAC area"), ( """You are in a field in the back of a building. The path goes north, and the building is to the west.""", "Field"), ( """You are in a round stone room with a gate to the east and a door to the south. There is writing on the wall here which reads: 'receiving area'.""", "Receiving area"), ( """You are at the east end of a hallway which leads to the west. There is a room to the north.""", "Eastbound hallway"), ( """You are at the end of an east-west hallway. You can go back east, or off to a room to the north or south.""", #15 "End of E/W hallway"), ( """You are in a weight room. It looks like everything is either destroyed or completely broken. There is a door to the south, and a ladder leading down a hole in the floor.""", "Weight room"), ( """You are in a breeze area. There is nothing here except for a slider on the wall. The exit is to the north.""", "Breeze area"), ( """You are in the swiss little passages of a maze, all alike. There is a button on the ground here.""", "Maze button room"), ( """You are in the little swiss passages of a maze, all alike.""", "Maze"), ( """You are in the smooth little passages of a maze, all alike.""", #20 "Maze"), ( """You are in the sixty little passages of a maze, all alike.""", "Maze"), ( """You are in the swiss little passages of a gaze, all alike.""", "Maze"), ( """You are in the swiss little cabbages of a maze, all alike.""", "Maze"), ( """You are in the lobby of a photography center. It looks as if all of the counselors retired. The exit is to the east, and there is a crawlway to the northwest.""", "Photography lobby"), ( """You are outside a large building to the west, which used to be a photography and LUNAPIC center. To the east in a distance you see a cavern.""", #25 "Photography club front"), ( """You are at the west side of a lake. The water here seems very deep.""", "Lakefront West"), ( """You are at the east side of the lake. Towards the east you see the cavern.""", "Lakefront East"), ( """The entrance to the cavern is to the north, and towards the west you see a deep lake. On the ground nearby is a chute, which says 'put treasures here for points'.""", "Cavern Entrance"), ( """You are in a misty room carved into a mountain. The path goes north. To the south are the remains of a rockslide.""", "Misty area"), ( """You are in a passage which continues north and south. You notice the stone on the walls are painted quite beautiful.""", #30 "Cavern N/S passage"), ( """You are at a junction of passages that go to the east, west, and south.""", "E/W/S Junction"), ( """You are at the east end of a cavern passage. Stairs lead up from here.""", "East end of cavern passage"), ( """You are at the west end of a cavern passage. Stairs lead up from here. There is a door to the south.""", "West end of cavern passage"), ( """You are in a kitchen built for many workers in the cavern. There is a refridgerator which is unfortunately empty due to retiring situations, and a sink on the counter, which reads 'put treasures in the drain for points'. Stairs lead down from here. To the east is a living room. You can take the plug off the drain with the 'unplug' command.""", "Kitchen"), ( """This is a marker for the sink. User will not see this, but it is a section that can contain objects.""", #35 "Sink"), ( """You are in what appears to be a living room. There is a television in the corner, and a sofa against the wall. Stairs lead up and down from here. To the west is a kitchen.""", "Living room"), ( """You are at the southeast end of a cavern passage. Stairs lead down out of sight.""", "SE end of SE/NW passageway"), ( """You are at the junction of passages to the east, west, southeast, and southwest.""", "E/W-SE/SW Junction"), ( """You are at the southwest end of a cavern passage.""", "SW end of NE/SW passageway"), ( """You are at the east end of a cavern passage. Stairs lead up from here.""", #40 "E end of E/W passageway"), ( """You are in a hidden area off across the road. Back southwest through the bush you can see the elephant hangout.""", "Hidden area"), ( """You are at the west end of a cavern passage. There is a hole in the ground here, which you would probably fit.""", "W end of E/W passageway"), ( """You have reached a dead end. It is very dark in here. The path goes south.""", "N end of passage"), ( """You have reached a rocky boulder room. Steps lead down from here.""", "Rocky boulder room"), ( """You are in a room which is completely blank. Paths go off to the west and south.""", #45 "Blank room"), ( """You are in a blank room. Surprisingly, all the stones here are painted lavender. Paths go off to the west and north.""", "Lavender room"), ( """You are in a blank room. Surprisingly, all the stones here are painted turquoise. Paths go off to the east and south.""", "Turquoise room"), ( """You are in a blank room. Surprisingly, all the stones here are painted infrared. Paths go off to the east and north.""", "Infrared room"), ( """You are at the north end of a cavern hallway.""", "North end of cavern hallway"), ( """You are in the middle of a cavern hallway which continues north and south.""", #50 "Cavern N/S hallway"), ( """You are at the south end of a cavern hallway. There is a box here with a thin slit on it. A passage leads to the southeast.""", "South end of cavern hallway"), ( """You are at the corner of a cavern crawlsplace. Paths go off to the northeast and northwest.""", "NE/NW corner"), ( """You are in a small crawlsplace. There is a hole in the floor here, and a path to the southwest.""", "Crawlsplace."), ( """You have reached a PAC computing center. There is a IBM/300 wooden stick on the wall here. The exit is to the north. There is nothing here on which you could type.""", "PAC computation center"), ( """There is a treasure chest on the ground here, which says 'put items here and score points'. There are paths that go off to the north and south.""", #55 "Golden place"), ( """You have reached the intersection of two roads. Main Street runs north into the distance, and Ewing Avenue runs east into the distance. Near the northeast you can see many intersections, but all the street signs that used to stand there are gone. There is a path to the south. There is a gate to the northwest which guards a building.""", "Main-Ewing intersection"), ( """You are at Main Street at the west end of Tree Avenue.""", "Main-Tree intersection"), ( """You are at Main Street at the west end of Texas Avenue.""", "Main-Texas intersection"), ( """You are at the north end of Main Street and the west end of Syno Avenue.""", "Main-Syno intersection"), ( """You are at the south end of First Street at Ewing Avenue.""", #60 "First-Ewing intersection"), ( """You are at the intersection of First Street and Tree Avenue.""", "First-Tree intersection"), ( """You are at the intersection of First Street and Texas Avenue.""", "First-Texas intersection"), ( """You are at the north end of First Street at Syno Avenue.""", "First-Syno intersection"), ( """You are at the south end of Second Street at Ewing Avenue.""", "Second-Ewing intersection"), ( """You are at the intersection of Second Street and Tree Avenue.""", #65 "Second-Tree intersection"), ( """You are at the intersection of Second Street and Texas Avenue.""", "Second-Texas intersection"), ( """You are at the north end of Second Street at Syno Avenue.""", "Second-Syno intersection"), ( """You are at the south end of Third Street and the east end of Ewing Avenue.""", "Third-Ewing intersection"), ( """You are at Third Street at the east end of Tree Avenue. There is a cliff off to the east.""", "Third-Tree intersection"), ( """You are at Third Street at the east end of Texas Avenue.""", #70 "Third-Texas intersection"), ( """You are at the north end of Third Street and the east end of Syno Avenue.""", "Third-Syno intersection"), ( """You are at the entrance of a museum to the north. You can also go back southeast.""", "Museum entrance"), ( """You are in the lobby of a museum. It looks as if most of the material here has been removed. Paths go off to the north, west, and south.""", "Museum lobby"), ( """You are in a maintenance area. There is a SAS switch on the wall here, and a door to the north with an 'EXIT' sign on it. Paths go off to the west and south.""", "Maintenance area"), ( """You are in a turtle life area. There is a tank with a dead turtle in it, and the turtle has apparently died due to starvation. Paths go off to the north and east.""", #75 "Turtle life area"), ( """You are in a study of workers in the museum, but the workers have retired. There are paths off to the east and south.""", "Study"), ( """You are in a Texas Station. A train is sitting here waiting for you.""", "Texas station"), ( """You are at the east end of a tunnel. The path goes west.""", "Museum station"), ( """You are in an east-west tunnel passage.""", "E/W tunnel passage"), ( """You are at the west end of the tunnel. Stairs lead up and down from here. There is a silverware holder here, saying, 'put treasures here and score points'.""", #80 "W end of E/W tunnel"), ( """You are at the bottom of the subway stairs. There is a door to the northeast.""", "Bottom of subway stairs"), ( """You are in a computer room. There is a personal active computer here even larger than that in the PAC area, and it's machine's name is 'Finale'. The exit is to the southwest. There is nothing here on which you could type.""", "Finale computer room"), ( """You are at the top of the subway stairs. There is a door to the south.""", "Top of subway stairs"), ( """You have reached a question room. You must answer six questions properly in order to get by. Use the 'answer' command to answer them.""", "Question room"), ( """You are in a finale's room at the north end of a long hallway. There is a door to the north.""", #85 "N finale's room"), ( """You are in a winner's room. There is a door to the south.""", #86 "Winner's room")] def sect_simplify(string): """Lowercase. Change all spaces and slashes to dashes. Remove allperiods and apostrophes.""" string = str(string) newstring = "" for char in string.lower(): addchar = char if addchar in " /": addchar = "-" if addchar in "'.": addchar = "" newstring = newstring + addchar return newstring ## Make a dictionary of all section numbers. s = {} for i in xrange(len(sections)): s[sect_simplify(sections[i][1])] = i light_sections = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 25, 26, 27, 28, 41, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72] d = { "north": 0, "n": 0, "south": 1, "s": 1, "east": 2, "e": 2, "west": 3, "w": 3, "northeast": 4, "ne": 4, "southeast": 5, "se": 5, "northwest": 6, "nw": 6, "southwest": 7, "sw": 7, "up": 8, "u": 8, "down": 9, "d": 9, "on": 10, "off": 11, "in": 10, "out": 11, "enter": 10, "exit": 11, "board": 10, "leave": 11} dungeon_map = [ # nort sout east west ne se nw sw up down in out [255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #0 [2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #1 [3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #2 [-1, 2, -1, -1, 6, -1, 4, -1, -1, -1, -1, -1 ], #3 [-1, -1, -1, -1, -1, 3, 5, -1, -1, -1, -1, -1 ], #4 [-1, -1, -1, -1, -1, 4, 255, -1, -1, -1, -1, -1 ], #5 [-1, -1, -1, -1, 7, -1, -1, 3, -1, -1, -1, -1 ], #6 [-1, -1, -1, -1, 255, -1, -1, 6, -1, -1, -1, -1 ], #7 [255, -1, -1, -1, -1, 5, -1, -1, -1, -1, 255, -1 ], #8 [10, 8, -1, 11, -1, -1, -1, -1, -1, -1, -1, 8 ], #9 [-1, 9, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #10 [-1, -1, 9, 255, -1, -1, -1, -1, -1, -1, -1, -1 ], #11 [55, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1 ], #12 [-1, 14, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #13 [13, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1 ], #14 [16, 17, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #15 [-1, 15, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1 ], #16 [15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #17 [-1, 18, 18, 18, 255, 18, 18, 18, 255, 18, -1, 18 ], #18 [19, 19, 19, 19, 19, 19, 19, 19, 19, 20, -1, -1 ], #19 [20, 20, 20, 20, 20, 20, 20, 21, 20, 20, 20, -1 ], #20 [21, 21, 21, 21, 21, 21, 21, 21, 22, 21, -1, -1 ], #21 [22, 22, 22, 22, 23, 22, 22, 22, -1, 22, -1, -1 ], #22 [23, 23, 23, 23, 16, 24, 23, 23, 23, 23, 23, -1 ], #23 [-1, -1, 255, -1, -1, -1, 20, -1, -1, -1, -1, -1 ], #24 [-1, -1, 26, 24, -1, -1, -1, -1, -1, -1, -1, -1 ], #25 [-1, -1, 255, 25, -1, -1, -1, -1, -1, -1, 255, -1 ], #26 [-1, -1, 28, 255, -1, -1, -1, -1, -1, -1, 255, -1 ], #27 [255, -1, -1, 27, -1, -1, -1, -1, -1, -1, 255, -1 ], #28 [30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #29 [31, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #30 [-1, 30, 32, 33, -1, -1, -1, -1, -1, -1, -1, -1 ], #31 [-1, -1, -1, 31, -1, -1, -1, -1, 36, -1, -1, -1 ], #32 [-1, 54, 31, -1, -1, -1, -1, -1, 34, -1, -1, -1 ], #33 [-1, -1, 36, -1, -1, -1, -1, -1, -1, 33, -1, -1 ], #34 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #35 [-1, -1, -1, 34, -1, -1, -1, -1, 37, 32, -1, -1 ], #36 [-1, -1, -1, -1, -1, -1, 38, -1, -1, 36, -1, -1 ], #37 [255, -1, 40, 42, -1, 37, -1, 39, -1, -1, -1, -1 ], #38 [-1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1 ], #39 [-1, -1, -1, 38, -1, -1, -1, -1, 44, -1, -1, -1 ], #40 [-1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1 ], #41 [-1, -1, 38, -1, -1, -1, -1, -1, -1, 45, -1, -1 ], #42 [-1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #43 [-1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1 ], #44 [-1, 46, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1 ], #45 [45, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1 ], #46 [-1, 48, 45, -1, -1, -1, -1, -1, -1, 255, -1, -1 ], #47 [47, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #48 [-1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #49 [49, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #50 [50, -1, -1, -1, -1, 52, -1, -1, -1, -1, 52, -1 ], #51 [-1, -1, -1, -1, 53, -1, 51, -1, -1, -1, -1, 51 ], #52 [-1, -1, -1, -1, -1, -1, -1, 52, -1, 31, -1, -1 ], #53 [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #54 [56, 12, -1, -1, -1, -1, -1, -1, -1, -1, 255, 255], #55 [57, 55, 60, -1, -1, -1, 255, -1, -1, -1, 255, 255], #56 [58, 56, 61, -1, -1, -1, -1, -1, -1, -1, 255, 255], #57 [59, 57, 62, -1, -1, -1, -1, -1, -1, -1, 255, 255], #58 [-1, 58, 63, -1, -1, -1, -1, -1, -1, -1, 255, 255], #59 [61, -1, 64, 56, -1, -1, -1, -1, -1, -1, 255, 255], #60 [62, 60, 65, 57, -1, -1, -1, -1, -1, -1, 255, 255], #61 [63, 61, 66, 58, -1, -1, -1, -1, -1, -1, 255, 255], #62 [-1, 62, 67, 59, -1, -1, -1, -1, -1, -1, 255, 255], #63 [65, -1, 68, 60, -1, -1, -1, -1, -1, -1, 255, 255], #64 [66, 64, 69, 61, -1, -1, -1, -1, -1, -1, 255, 255], #65 [67, 65, 70, 62, -1, -1, -1, -1, -1, -1, 255, 255], #66 [-1, 66, 71, 63, -1, -1, -1, -1, -1, -1, 255, 255], #67 [69, -1, -1, 64, -1, -1, -1, -1, -1, -1, 255, 255], #68 [70, 68, 255, 65, -1, -1, -1, -1, -1, -1, 255, 255], #69 [71, 69, -1, 66, -1, -1, -1, -1, -1, -1, 255, 255], #70 [-1, 70, -1, 67, -1, -1, -1, -1, -1, -1, 255, 255], #71 [73, -1, -1, -1, -1, 56, -1, -1, -1, -1, 255, 255], #72 [74, 72, -1, 75, -1, -1, -1, -1, -1, -1, -1, -1 ], #73 [255, 73, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1 ], #74 [76, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #75 [-1, 75, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #76 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1 ], #77 [-1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1 ], #78 [-1, -1, 78, 80, -1, -1, -1, -1, -1, -1, -1, -1 ], #79 [-1, -1, 79, -1, -1, -1, -1, -1, 83, 81, -1, -1 ], #80 [-1, -1, -1, -1, 82, -1, -1, -1, 80, -1, -1, -1 ], #81 [-1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1 ], #82 [-1, 74, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1 ], #83 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #84 [86, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ], #85 [-1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ]] #86 # nort sout east west ne se nw sw up down in out ## How the user references /all/ objects, permanent and regular. o = { "shovel": 0, "lantern": 1, "floppy": 2, "disk": 2, "peanut": 3, "peanuts": 3, "bag": 3, "opener": 4, "door": 4, "gvr": 5, "rossum": 5, "statue": 5, "statuette": 5, "quartz": 6, "crystal": 6, "weight": 7, "life": 8, "preserver": 8, "string": 9, "beads": 9, "sulfur": 10, "gold": 11, "platinum": 12, "silver": 13, "towel": 14, "beach": 14, "pickaxe": 15, "axe": 15, "license": 16, "medal": 17, "golden": 17, "coins": 18, "egg": 19, "pipe": 20, "steel": 20, "container": 21, "ruby": 22, "baking": 23, "soda": 23, "vinegar": 24, "ring": 25, "bead": 26, "bill": 27, "van": 28, "vangogh": 28, "gogh": 28, "painting": 28, "art": 28, "knocker": 29, "boulder": -1, "tree": -2, "trees": -2, "elephant": -3, "board": -4, "drama": -4, "pac": -5, "personal": -5, "active": -5, "computer": -5, "mess": -6, "slider": -7, "ladder": -8, "button": -9, "chute": -10, "fridge": -11, "refridgerator": -11, "sink": -12, "HANDDIRT": -13, "tv": -14, "television": -14, "sofa": -15, "couch": -15, "box": -16, "slit": -16, "stick": -17, "treasure": -18, "chest": -18, "cliff": -19, "van": -20, "gate": -21, "tank": -22, "turtle": -23, "switch": -24, "sas": -24, "train": -25, "silverware": -26, "holder": -26, "apple": -27, "apples": -27, "lake": -28, "water": -28} objects = [("There is a shovel here.", "A shovel"), ("There is a lantern nearby.", "A lantern"), ("There is a floppy disk here.", "A floppy disk"), ("There is a bag of peanuts here.", "Some peanuts"), ("There is a apartment-room door opener here.", "A door opener"), ("There is a wax statuette of Guido Van Rossum here.", "A GVR statuette"), ("There is a shimmering quartz crystal here.", "A quartz crystal"), ("There is a 10 pound weight here.", "A weight"), ("There is a life preserver here.", "A life preserver"), ("There is a string of emerald beads here.", "A string of beads"), ("There is a sulfur mineral here.", "A sulfur mineral"), ("There is a gold cube here.", "A gold cube"), ("There is a platinum cube here.", "A platinum cube"), ("There is a silver cube here.", "A silver cube"), ("There is a beach towel on the ground here.", "A beach towel"), ("There is a pickaxe here.", "A pickaxe"), ("There is a driver's license here.", "A license"), ("There is a golden medal here.", "A medal"), ("There are some valuable coins here.", "Some valuable coins"), ("There is a Ukranian-fashioned egg here.", "A valuable egg"), ("There is a steel pipe here.", "A steel pipe"), ("There is a glass container here.", "A glass container"), ("There is a valuable ruby here.", "A ruby"), ("There is a packet of baking soda here.", "A packet of baking soda"), ("There is a packet of vinegar here.", "A packet of vinegar"), ("There is a valuable ring here.", "A ring"), ("There is a valuable emerald bead here.", "A bead"), ("There is a 150-dollar bill here.", "A $150 bill"), ("Van Gogh's painting is here.", "Van Gogh's painting"), ("There is a secret-door knocker here.", "A knocker")] obj_desc = [ "It is a normal shovel with a price tag attached to it reading $21.99.", "The lantern was hand-crafted by Geppetto.", "It belongs to a PAC and its drive is A:\\.", "They look like hard peanuts.", None, """The statuette is for the likeness of Guido Van Rossum, the author of Python. You'll notice that he has no base to stand still on.""", None, "You observe that the weight is heavy.", "It says I. I. Wales.", None, None, None, None, None, "It has a picture of Squidword on it.", None, "It has your own picture on it!", "It is a golden medal from California.", "They are valuable coins from the 18th century.", "It is a valuable Ukranian egg.", None, "It is just a plain glass container.", None, None, None, None, None, None, None, "You can use this to find secret doors. Use the 'knock' command to try to."] perm_objs = [None, "There is a large boulder here.", None, "There is a large elephant here.", None, None, "There is a worthless pile of junk mess here.", None, None, None, None, None, None, "There is a very strange smell in here.", None, None, None, None, None, None, "There is a van here.", None, None, None, None, None, None, None, None] perm_obj_desc = [None, "It is just a boulder. It cannot be moved.", "There are tall trees with a bountiful supply of apples in them.", "It appears twice as tall and four times as wide as you.", """It's old, but you can still use it now. It has had a lot of scratches since four years ago. You notice two names in the scratches. They read: Michael Jones Jennifer Jones """, None, "It is just a garbled mess.", "The slider points to a scale of wind which has long since faded away.", "The ladder is permanently attached to the hole.", None, None, None, """The sink is the cleanest compared to everything else in the cavern. The faucet is so clean that you can see your reflection in it. You notice that there is a drain on the bottom which is too small for your hand to fit in. There is a plug on the drain which is removable.""", None, "It is a MAGNAVOX television. It has an attached remote control.", "It is a three-seat sofa, with a fuzzy outside.", """There is a thin slit on the box, and sloppy writing that reads: TO UPGRADE YOUR DOOR OPENER, PUT IT HERE""", None, "It says 'loving treasures' on it.", "It is a HIGH cliff!", "It is a 7-seat SIENNA vehicle.", "The gate is too tall for one to climb over.", None, "The turtle looked like it was once someone's pet.", None, "It is a passenger train ready to go.", None, None, None] # Where objects are. inventory = [1] items = [[], [o["tree"], o["apple"], o["shovel"]], #dead-end [o["tree"], o["apple"], o["boulder"]], #n-s-dirt-road [], [o["knocker"]], #se-nw-road [], [o["peanuts"]], #ne-sw-road [o["elephant"]], #elephant-hangout [], [], [o["board"]], #drama-room [o["pac"]], #pac-area [o["lantern"], o["license"], o["medal"]], #field [], [], [], [o["weight"], o["life"], o["ladder"]], #weight-room [o["slider"]], #breeze-area [o["button"], o["ladder"]], #maze-button-room [], [o["gvr"]], #smooth-maze [], [], [], [o["sulfur"]], #photography-lobby [], [o["water"]], #lakefront-west [o["water"]], #lakefront-west [o["chute"]], #cavern-entrance [o["gold"]], #misty-area [], [], [], [], [o["fridge"], o["sink"]], #kitchen [], [o["tv"], o["sofa"]], #living-room [], [], [], [], [o["string"]], #hidden-area [], [o["silver"]], #n-end-of-passage [o["boulder"]], #rocky-boulder-room [], [], [o["towel"]], #turquoise-room [], [], [], [o["box"]], #s-end-of-cavern-hallway [], [o["pickaxe"]], #crawlsplace [o["pac"], o["stick"]], #pac-computation-center [o["chest"]], #golden-place [o["gate"]], #main-ewing-intersection [], [], [], [], [], [], [], [], [], [], [], [], [o["coins"], o["cliff"]], #third-tree-intersection [], [o["van"]], #third-syno-intersection [], [o["steel"]], #museum-lobby [o["soda"], o["switch"]], #maintenance-area [o["container"], o["ruby"], o["turtle"], o["tank"]], #turtle-life-area [o["vinegar"]], #study [o["train"]], #texas-station [], [], [o["holder"]], #w-end-of-e-w-tunnel [o["ring"]], #bottom-of-subway-stairs [o["pac"]], #finale-computer-room [o["bead"]], #top-of-subway-stairs [], [o["bill"]], #n-finales-room [o["art"]]] #winners-room items[randrange(16)+56].append(o["egg"]) diggables = [[], [], [], [o["floppy"]], [], [], [], [], [], [], #0-9 [], [], [], [], [], [], [], [], [], [], #10-19 [], [], [], [], [], [], [], [], [], [], #20-29 [], [], [], [], [], [], [], [], [], [], #30-39 [], [], [], [], [o["platinum"]], [], [], [], [], [], #40-49 [], [], [], [], [], [], [], [], [], [], #50-59 [], [], [], [], [], [], [], [], [], [], #60-69 [], [], [], [], [], [], [], [], [], [], #70-79 [], [], [], [], [], [], []] #80-86 # Data. obj_pts = [0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 10, 10, 10, 10, 0, 0, 0, 10, 10, 10, 0, 0, 10, 0, 0, 10, 10, 10, 10, 0] obj_lbs = [2, 1, 1, 1, 2, 2, 1, 10, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2] visited = [41] container = [] current_section = 1 fttp_type = "asci" mode = "normal" building_door_opened = False cavern_door_opened = False pac_in_progress = False fttp_in_progress = False breeze_level = 0 opener_level = 0 hands_dirty = True black = False notreas = False hole = False invan = False pac = False logged = False connected = True dead = False finale = False justrestored = False numsaves = 0 numcommands = 0 questions = [("What is the nearest whole dollar of the price of the shovel?", ["22", "twenty-two"]), ("What is the login on the PAC?", ["jones"]), ("Name either one of the two objects you found by digging.", ["floppy", "disk", "platinum"]), ("What type of van were you driving?", ["sienna"]), ( """Name either of the two amounts that the elephant is larger than you by that many times.""", ["2", "two", "4", "four"]), ("Name the STREET which goes over the subway stop.", ["2", "second"]), ("Excluding the finale, how many places can you put treasures for points?", ["4", "four"]), ("Name either one of the two first names in the drama room.", ["michael", "jennifer"]), ("Which avenue is named after a U.S. state?", ["texas"]), ("What is the drive on the floppy disk?", ["a", "a:\\"]), ("What network protocol is based on the PAC?", ["tcp"]), ("How many pounds did the weight weigh?", ["10", "ten"]), ("What is the last name of the author of Python?", ["rossum"]), ("How many secret doors did you find?", ["2", "two"]), ("What cartoon character was on the towel?", ["squidword"])] questions_on_list = [] for i in xrange(6): qanda = questions[randrange(len(questions))] questions_on_list.append(qanda) questions.remove(qanda) def reg_score(): if o["HANDDIRT"] in items[s["s-finales-room"]]: #this damages everything return 0 else: return sum([obj_pts[x] for x in items[s["s-finales-room"]]]) def finale_score(): return sum([obj_pts[x] for x in items[s["n-finales-room"]]]) def score(args): if not finale: print "You have scored %d points out of a possible 120." % reg_score() else: print "You have scored %d points out of a possible 140 finale points." % finale_score() if finale_score() == 140: print "\n\nCongratulations. You have won. Now you can give someone else a turn." def dolog(how): "Make a score document in the folder." score = open("gague adventure last score.txt", "w") score.write("Last score: Player ") if how == []: if finale and finale_score() == 140: score.write("won") else: score.write("quit") else: score.write("killed by ") score.write(how[0]) if finale and finale_score() == 140: score.write(" at winning score") score.write(" at ") score.write(sections[current_section][1]) score.write("\n\nSaves: ") score.write(str(numsaves)) score.write("\nPoints: ") if finale: points = finale_score() + 120 else: points = reg_score() score.write(str(points)) score.write("\nLast commands: ") score.write(str(numcommands)) score.write("\n") score.close() def die(args): global dead print if len(args) > 0: print "You are dead." score([]) dolog(args) dead = True def _quit(args): die([]) def _long(args): global mode mode = "long" def short(args): global mode mode = "short" def normal(args): global mode mode = "normal" def special_objects(): "Certain case where the object is special." global current_section, breeze_level if current_section == s["nw-end-of-road"]: if building_door_opened: print "There is a door to the northwest." if current_section == s["pac-area"]: if not pac: print "The lights are motionless." else: print "The lights are evenly flashing." if current_section == s["breeze-area"]: if breeze_level > 4: print None elif breeze_level < 0: breeze_level = 0 else: print ["It is normal room breeze in here.", "It is quite refreshing in here.", "It is comfortably windy in here.", "It is strongly windy in here.", "You are dead now."][breeze_level] if breeze_level == 3: rip_apart() if current_section == s["e-w-se-sw-junction"]: if cavern_door_opened: print "There is a door to the north." if current_section == s["turquoise-room"] and not o["towel"] in items[s["turquoise-room"]]: print "There is a hole in the floor here." if current_section == s["turtle-life-area"] and black: print \ """The room is lit by a black light, causing the turtle, and some of your objects, to give off a shiny glow.""" if current_section == s["second-texas-intersection"] and hole: if not invan: print "You fall into a hole in the ground." current_section = s["texas-station"] describeIfNew() else: print "The van falls into a hole and explodes." die(["a van accident"]) if current_section == s["question-room"]: print "You have this question:" print questions_on_list[0][0] if invan: print "You are in the van." def rip_apart(): "Have the statuette fall apart and uncover a quartz crystal." global inventory, items if o["gvr"] in inventory or o["gvr"] in items[current_section]: print \ """You notice the layers of wax on the statuette beginning to rip off, until they completely fall apart. You are left with a beautiful quartz crystal!""" if o["gvr"] in inventory: inventory.remove(o["gvr"]) inventory.append(o["quartz"]) else: items[current_section].remove(o["gvr"]) items[current_section].append(o["quartz"]) def describe(lng=False): if not current_section in light_sections and not o["lantern"] in inventory: print "It's pitch dark. You are likely to be eaten by a grue." else: print sections[current_section][1] if lng: print sections[current_section][0] #Explain special_objects() for i in items[current_section]: if i >= 0: print objects[i][0] if i == o["container"] and len(container) > 0: print "The container contains the following:" for i2 in container: print " " + objects[i2][1] else: if isinstance(perm_objs[abs(i)], str): if i != o["van"] or not invan: print perm_objs[abs(i)] def describeIfNew(): global visited if mode == "long": describe(True) elif mode == "short": describe() else: if not current_section in visited: describe(True) else: describe() if not current_section in visited: visited.append(current_section) def swim(args): global current_section if not current_section in [s["lakefront-west"], s["lakefront-east"]]: print "I see no water!" else: if not o["life"] in inventory: print \ """You dive in the water, and first notice it is quite cold. But then you realize that you get used to the fact that you never really learned how to swim.""" die(["drowning"]) else: if current_section == s["lakefront-west"]: current_section = s["lakefront-east"] else: current_section = s["lakefront-west"] def special_move(direct): "Case where you can't go that way unless certain conditions meet, etc." global current_section, invan, notreas if current_section == s["s-finales-room"]: if questions_on_list == []: current_section = s["n-finales-room"] else: current_section = s["question-room"] elif current_section == s["nw-end-of-road"]: if not building_door_opened: print "You can't go that way." else: current_section = s["building-front"] elif current_section == s["elephant-hangout"]: if o["elephant"] in items[current_section]: print "The elephant is blocking your way!" else: current_section = s["hidden-area"] elif current_section == s["building-front"]: if not o["opener"] in inventory: print "You don't have anything that can open this door." else: current_section = s["building-hallway"] elif current_section == s["drama-room"]: if not o["opener"] in inventory or opener_level == 0: print "You don't have anything that can open this door." else: current_section = s["field"] elif current_section == s["pac-area"]: print "You can't get past a closed gate!" elif current_section == s["receiving-area"]: print "You can't get past a closed gate!" elif current_section == s["maze-button-room"]: if direct == 4 and o["weight"] in items[current_section]: current_section = 19 elif direct == 8 and not o["weight"] in items[current_section]: current_section = s["weight-room"] else: print "You can't go that way." elif current_section == s["photography-lobby"]: if breeze_level != 3: current_section = s["photography-club-front"] else: print \ """As you exit the building, you notice a blast of wind coming from one of the windows. Suddenly, the building breaks into a million minituare pieces. The wind blows you back until you smash your head. You bleed to death.""" die(["being wind-smashed"]) elif current_section in [s["lakefront-west"], s["lakefront-east"]]: swim([]) elif current_section == s["cavern-entrance"]: print \ """As you enter the cave, you hear a rumbling noise. You look back to see huge rocks falling from the ceiling and blocking your way out. """ current_section = s["misty-area"] elif current_section == s["e-w-se-sw-junction"]: if not cavern_door_opened: print "You can't go that way." else: current_section = s["n-end-of-passage"] elif current_section == s["turquoise-room"]: if o["towel"] in items[current_section]: print "You can't go that way." else: current_section = s["north-end-of-cavern-hallway"] elif direct > 9 and current_section < 73 and current_section > 54: # This region of the map is completely covered with 255's # due to getting in and out of the van in the whole region # the van can go. if direct == 10: if invan: print "You are already in the van!" else: if o["van"] in items[current_section]: if not o["license"] in inventory: print "You are not licensed for this type of vehicle." else: print "You enter the van and buckle up in the driver's seat." notreas = True invan = True else: print "You can't go that way." else: if invan: print "You hop out of the van." invan = False else: if o["van"] in items[current_section]: print "You are already out of the van!" else: print "You can't go that way." elif current_section == s["main-ewing-intersection"]: if not invan: print "The gate will not open." else: print "As the van approaches, the gate opens. You drive through." items[current_section].remove(o["van"]) current_section = s["museum-entrance"] items[current_section].append(o["van"]) elif current_section == s["third-tree-intersection"]: if not invan: print "You fall off the cliff and land on your head." die(["a cliff"]) else: print "The van flies off the cliff, and plunges to the bottom where it explodes." die(["a van accident"]) elif current_section == s["maintenance-area"]: print "The door is locked." elif current_section == s["texas-station"]: print \ """As you board the train it immediately leaves the station. The ride seems bumpy at first. You sit down in one of the chairs to be more comfortable. """ print \ """Finally, the train comes to a sudden stop, the doors open, and the train pushes you out. The train speeds away. """ current_section = s["museum-station"] def move(args): global current_section direction = (args + [None])[0] if not direction in d: print "I don't understand where you want me to go." else: if not current_section in light_sections and not o["lantern"] in inventory: print \ """You trip over a grue and fall into a pit where you break every bone in your body.""" die(["a grue"]) else: direct = d[direction] # Use the dungeon map to figure out where we are going. newroom = dungeon_map[current_section][direct] if newroom == -1: print "You can't go that way." elif newroom == 255: special_move(direct) else: if invan: if newroom < 55 or newroom > 72: print "The van cannot go that way." describeIfNew() else: print "The van drives ahead and stops." items[current_section].remove(o["van"]) current_section = newroom items[current_section].append(o["van"]) else: if current_section == newroom: describeIfNew() current_section = newroom for i in ["north", "south", "east", "west", "northeast", "southeast", "northwest", "southwest", "up", "down", "in", "out"]: command = "" command = command + "def move_" command = command + i command = command + "(args):\n move([\"" command = command + i command = command + "\"])" exec command def examine(args): if args == []: describe(True) else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] if not objnum in inventory and not objnum in items[current_section] and \ not (objnum in container and (container in inventory or container in items[current_section])): print "I don't see that here." else: if objnum == o["pipe"] and current_section == s["turtle-life-area"] and black: print \ """In this light you can see writing on the pipe. It appears to say: 'For an explosive time, go to the corner of Second St. and Texas.' """ else: if objnum >= 0: description = obj_desc[objnum] else: description = perm_obj_desc[abs(objnum)] if description is None: print "I see nothing special about that." else: print description def take(args): if args == []: print "You must supply an object." else: if args[0] in ["all", "entire", "everything"]: gotsome = False firstItems = list(items[current_section]) for x in firstItems: if x >= 0: gotsome = True print objects[x][1], ":", take_object(x) if not gotsome: print "Nothing to take." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] take_object(objnum) def take_object(objnum): global items, inventory if objnum in container and (o["container"] in inventory or o["container"] in items[current_section]): print "You remove it from the container." container.remove(objnum) inventory.append(objnum) else: if not objnum in items[current_section]: print "I do not see that here." else: if objnum < 0: print "You cannot take that." else: if inven_weight() + obj_lbs[objnum] > 11: print "Your load would be too heavy." else: print "Taken." items[current_section].remove(objnum) inventory.append(objnum) if current_section == s["turquoise-room"] and objnum == o["towel"]: print "I think taking the towel just uncovered a hole in the floor." def inven_weight(): weight = sum([obj_lbs[x] for x in inventory]) if o["container"] in inventory: weight += sum([obj_lbs[x] for x in container]) return weight def drop(args): if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] if not objnum in inventory: print "You don't have that." else: print "Done." items[current_section].append(objnum) inventory.remove(objnum) drop_check(objnum) def drop_check(objnum): global hole, container, inventory, current_section if o["peanuts"] in items[s["elephant-hangout"]] and o["elephant"] in items[s["elephant-hangout"]]: print \ """The elephant takes the peanuts and walks away with them. I think he left something behind.""" items[s["elephant-hangout"]].remove(o["elephant"]) items[s["elephant-hangout"]].remove(o["peanuts"]) items[s["elephant-hangout"]].append(o["opener"]) if objnum == o["container"] and o["vinegar"] in container and o["soda"] in container: print "The container immediately falls into pieces when it hits the ground." container = [] items[current_section].remove(o["container"]) if current_section == s["second-texas-intersection"]: print "The impact causes a hole to open up in the ground. You fall through." hole = True current_section = s["texas-station"] if objnum == o["weight"] and current_section == s["maze-button-room"]: print "A passageway opens." def shake(args): if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] ## If shaking anything will do anything, put here. if objnum >= 0: if not objnum in inventory: print "You don't have that." else: print "Shaking %s seems to have no effect." % objects[objnum][1].lower() else: if not objnum in items[current_section]: print "I don't see that here." else: if objnum == o["tree"]: #Doing this can be deadly print \ """You begin to shake a tree, and notice an apple fall from up high. As you try to move your hands out and grab it, you feel the impact as it lands on your head. More and more apples fall from the air and hit your head.""" die(["apples"]) else: print "You cannot shake that." def press(args): global black if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] ## If shaking anything will do anything, put here. if not objnum in items[current_section]: print "I don't see that here." else: if not objnum in [o["button"], o["switch"]]: print "You can't press that!" else: if objnum == o["button"]: if o["weight"] in items[s["maze-button-room"]]: print "The button is out of sight." else: print \ """As you press the button, you notice a passageway open up, but when you release the button, the passageway closes.""" else: #switch black = not black if black: print "The button is now in the on position." else: print "The button is now in the off position." def slide(args): global breeze_level if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] ## If shaking anything will do anything, put here. if not objnum in items[current_section]: print "I don't see that here." else: if objnum != o["slider"]: print "You can't slide that!" else: direction = (args + [None])[1] if not direction in ["right", "left"]: print "You must indicate right or left." else: if direction == "right": breeze_level += 1 else: breeze_level -= 1 if breeze_level < 0: print "The slider will go no further in that direction." breeze_level = 0 elif breeze_level == 0: print "The room has returned to normal room wind." if breeze_level == 1: print "It is quite refreshing in here. Your hair is being blown." if breeze_level == 2: print "It is pretty windy in here. It is still very comfortable." if breeze_level == 3: print "It is now very windy in here. There is something very strong about this." rip_apart() if breeze_level == 4: print "As the slider clicks into place, you immediately get smashed on the wall." die(["being wind-smashed"]) def answer(args): global questions_on_list, current_section if current_section != s["question-room"]: print "I don't believe that anyone asked you anything." else: if args == []: print "You must give the answer on the same line." else: correct_answers = questions_on_list[0][1] if not args[0] in correct_answers: print "That answer is incorrect." else: print "Correct." questions_on_list = questions_on_list[1:len(questions_on_list)] if questions_on_list == []: current_section = s["n-finales-room"] else: print "They have another question for you!" def feed(args): if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] ## If shaking anything will do anything, put here. if not objnum in items[current_section]: print "I don't see that here." else: if not objnum in [o["elephant"], o["turtle"]]: print "You cannot feed that." else: if objnum == o["elephant"]: if not o["peanuts"] in inventory: print "You have nothing with which to feed it." else: drop(["peanuts"]) else: print "The turtle is dead." def put(args): if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that object is." else: objnum1 = o[args[0]] if not objnum1 in inventory: print "You don't have that." else: if not "in" in args and not "into" in args and not "on" in args and \ not "onto" in args and not "through" in args: print "You must supply an indirect object." else: trial = 0 while not args[trial] in ["in", "into", "on", "onto", "through"]: trial += 1 if trial == len(args) - 1: print "You must supply an indirect object." else: if not args[trial+1] in o: print "I don't know what that indirect object is." else: objnum2 = o[args[trial+1]] if not objnum2 in inventory and not objnum2 in items[current_section]: print "That indirect object is not here." else: if objnum1 == objnum2: print "You can't put anything in itself." else: put_objs(objnum1, objnum2) def put_objs(obj1, obj2): global pac, opener_level if obj2 == o["treasure"] and not notreas: obj2 = o["chute"] if obj2 == o["silverware"]: obj2 = o["chute"] if obj2 == o["container"]: if not obj1 in [o["string"], o["quartz"], o["sulfur"], o["license"], o["coins"], o["egg"], o["medal"], o["vinegar"], o["soda"]]: print "That won't fit in the container." else: print "Done." inventory.remove(obj1) container.append(obj1) elif obj1 == o["floppy"] and obj2 == o["pac"]: print "Done. You notice all the lights starting to flash." inventory.remove(obj1) pac = True elif obj1 == o["weight"] and obj2 == o["button"]: drop(["weight"]) elif obj2 == o["chute"]: print "You hear it slide down the chute and off into the distance." inventory.remove(obj1) items[s["s-finales-room"]].append(obj1) elif obj2 == o["box"]: if obj1 == o["opener"]: print \ """You drop in the opener, and it begins to halt. It finally swooshes ahead. It seems to have flown!""" inventory.remove(obj1) items[s["pac-area"]].append(obj1) opener_level += 1 else: print "You can't put that in the door opener box!" elif obj2 == o["sink"]: #Put in sink print "You hear it fall deep into some water below." inventory.remove(obj1) items[s["sink"]].append(obj1) elif obj2 == o["chest"]: print "The treasure chest is locked shut." elif obj2 == o["cliff"]: print "You hear it impact the bottom of the cliff (almost)." inventory.remove(obj1) else: print "I don't know how to put that there. Maybe you should just try dropping it." def eat(args): global inventory if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] if not objnum in inventory: print "You don't have that." else: if objnum != o["peanuts"]: print "You shove %s down your throat, and start choking." % objects[objnum][1].lower() die(["choking"]) else: print "You have eaten the peanuts." inventory.remove(objnum) def lick(args): if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] if not objnum in inventory: print "You don't have that." else: if objnum != o["peanuts"]: print "You spread your tongue on %s and cut it on a sharp edge." % objects[objnum][1].lower() print "You start whining." die(["a tongue cut"]) else: print "You have licked the peanuts." def quaff(args): global inventory if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] if objnum >= 0: if not objnum in inventory: print "You don't have that." else: if objnum != o["vinegar"]: print "You can't drink that!" else: print "You taste the vinegar. Ughhh!!! This is not right for you." die(["tasting vinegar"]) else: if not objnum in items[current_section]: print "I don't see that here." else: if objnum != o["water"]: print "You can't drink that!" else: print \ """You manage to drink one sip of the water, but spit it out. You notice that the water is very salty.""" def climb(args): if args == []: if current_section in [s["dead-end"], s["n-s-dirt-road"]]: climb(["tree"]) elif current_section in [s["weight-room"], s["maze-button-room"]]: climb(["ladder"]) else: print "There is nothing here to climb." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] ## If shaking anything will do anything, put here. if not objnum in items[current_section]: print "I don't see that here." else: if objnum == o["tree"]: print \ """You manage to get halfway up the tree and fall back down. You notice the tree is very unsteady.""" elif objnum == o["ladder"]: if current_section == s["weight-room"]: move_down([]) else: move_up([]) else: print "You can't climb that!" ## List every object in the player's inventory. ## Special case for the container. We must also print what is in it. def inven(args): print "You currently have the following:" for i in inventory: print " " + objects[i][1] if i == o["container"] and len(container) > 0: print " The container contains the following:" for i2 in container: print " " + objects[i2][1] def drive(args): if not invan: print "You cannot drive when you're not in a vehicle." else: move(args) def watch(args): if current_section != s["living-room"]: print "I see nothing to watch." else: print \ """As you turn on the television you notice an interesting channel on. You see workers walking in a cave, finding a place to bury an object. You see them going to a rocky boulder room, burying a treasure, and then going back to the darker part of the cave and hiding another treasure. After this, you turn off the television.""" def unplug(args): if current_section != s["kitchen"]: print "There is nothing here to unplug." else: print "Sssss!!" items[s["s-finales-room"]] = items[s["s-finales-room"]] + items[s["sink"]] items[s["sink"]] = [] def wash(args): global hands_dirty if current_section != s["kitchen"]: print "You can't do such a thing here, don't even bother trying." else: if not hands_dirty: print "I'm afraid you don't have to wash now." else: print "That felt nice." hands_dirty = False items[s["sink"]].append(o["HANDDIRT"]) def sleep(args): global hands_dirty if current_section != s["living-room"]: print "You try to do that like this, but can't seem to." else: hands_dirty = True print \ """You lie down on the sofa with your eyes closed for a while. Oh, you must have gotten tired walking all the way here!""" def dig(args): global items, diggables if not o["shovel"] in inventory: print "You have nothing you can use to dig." else: if diggables[current_section] == [] or invan: print "Digging here reveals nothing." else: print "I think you found something." items[current_section] = items[current_section] + diggables[current_section] diggables[current_section] = [] def knock(args): global building_door_opened, cavern_door_opened if not o["knocker"] in inventory: print "You have nothing you can use to do that." else: if invan: print "Knocking here results nothing." else: if current_section == s["nw-end-of-road"] and not building_door_opened: print "I think you found a secret door." building_door_opened = True elif current_section == s["e-w-se-sw-junction"] and not cavern_door_opened: print "I think you found a secret door." cavern_door_opened = True else: print "Knocking here results nothing." def _help(args): print \ """Gague Adventure by Nicholas McConnell Welcome to adventuring! Here are some useful information: - If you have an opener that can open a ddoor, you do not need to explicitly open it. You can just use 'in' or walk in the direction of the door. - If you have a lantern, it is always litt. - You never really score any points untill you manage to put treasures where signs tell you to. Simply finding treasures is not good enough. There are multiple ways to get a treasure to a special place. It is also important that you get them to the place /unharmed/ and /untarnished/. You can tell if you have successfully given up a treasure by looking at the score, as it changes immediately. Note that an object can be harmed after you get points for it. If that happens, your score will decrease and never get better again. - Don't give up the moment you've scored all of your points! There is still a finishing touch to the adventure. - You can save a game with the 'save' commmand, and restore it with the 'restore' command. - Directions are: north, south, east, wesst, northeast, southeast, northwest, southwest, up, down, in, out. These can be abbreviated: n, s, e, w, ne, se, nw, sw, u, d, in, out. - If you go down a hole in the floor withhout an aid such as a ladder, you probably won't be able to get back up the way you came, if at all. - To run this game in a DOS window (no IDDLE shell), double-click on: gague_advent.py NOTE: This game /should/ work in a DOS window! If you have any questions about this, please go to the website http://www.bluzeandmuse.com/ and click on the Games link. """ def _break(args): global items, inventory, connected, current_section if not o["pickaxe"] in inventory: print "You have nothing you can use to break things." else: if args == []: print "You must supply an object." else: if not args[0] in o: print "I don't know what that is." else: objnum = o[args[0]] if objnum == o["pickaxe"]: print "You can't break a pickaxe with itself!" else: if objnum in inventory: print \ """You aim for the object in your hands and swing the pickaxe! ... unfortunately, you miss the object and slice off your left hand. You bleed to death.""" die(["a pickaxe"]) else: if not objnum in items[current_section]: print "I don't see that here." else: if objnum == o["stick"]: print \ """As you break the wooden stick, it immediately opens a large hole in the ground which you fall through. You look around the hole, dropping all of your items up where you started. In about 30 seconds you land on the PAC. """ items[current_section] = items[current_section] + inventory inventory = [] connected = False current_section = s["pac-area"] print "Case closed." pac_interface() else: if objnum >= 0: print "Your pickaxe breaks it into a million pieces." items[current_section].remove(objnum) else: print "Your pickaxe shatters up into a million pieces." inventory.remove(o["pickaxe"]) def save_val(string): return "%s = %s\n" % (string, `eval(string)`) def save_game(args): global numsaves if args == []: print "You must supply a filename for the save." else: try: if not os.access("saved games", os.F_OK): os.mkdir("saved games") savepath = os.path.join("saved games", "gague advent") if not os.access(savepath, os.F_OK): os.mkdir(savepath) game = open(os.path.join(savepath, "%s.txt" % args[0]), "w") game.write(save_val("inventory")) game.write(save_val("items")) game.write(save_val("diggables")) game.write(save_val("visited")) game.write(save_val("container")) game.write(save_val("current_section")) game.write(save_val("fttp_type")) game.write(save_val("mode")) game.write(save_val("building_door_opened")) game.write(save_val("cavern_door_opened")) game.write(save_val("breeze_level")) game.write(save_val("opener_level")) game.write(save_val("hands_dirty")) game.write(save_val("black")) game.write(save_val("notreas")) game.write(save_val("hole")) game.write(save_val("invan")) game.write(save_val("pac")) game.write(save_val("logged")) game.write(save_val("connected")) game.write(save_val("finale")) game.write(save_val("questions_on_list")) game.close() numsaves += 1 print "Game saved." except Exception, error: print "Error saving to file." def restore_game(args): global inventory, items, diggables, visited, container, current_section, fttp_type, mode, building_door_opened, cavern_door_opened, pac_in_progress, fttp_in_progress, breeze_level, opener_level, hands_dirty, black, notreas, hole, invan, pac, logged, connected, finale, questions_on_list, justrestored if args == []: print "You must supply a filename." else: try: command = "global inventory, items, diggables, visited, container, current_section, fttp_type, mode, building_door_opened, cavern_door_opened, pac_in_progress, fttp_in_progress, breeze_level, opener_level, hands_dirty, black, notreas, hole, invan, pac, logged, connected, finale, questions_on_list\n" game = open(os.path.join("saved games", "gague advent", "%s.txt" % args[0]), "r") for i in game: command = command + i exec command justrestored = True print "Game restored. \n" except Exception, error: print "Could not load restore file." def _type(args): if current_section != s["pac-area"]: print "There is nothing here on which you could type." else: if not pac: print "You try to, but the characters don't even show up on the screen." else: pac_interface() ## Now for PAC and FTTP. pac_objnames = ["shovel.obj", "lantern.obj", "floppy.obj", "peanuts.obj", "opener.obj", "gvr.obj", "quartz.obj", "weight.obj", "life.obj", "string.obj", "sulfur.obj", "gold.obj", "platinum.obj", "silver.obj", "towel.obj", "pickaxe.obj", "license.obj", "medal.obj", "coins.obj", "egg.obj", "pipe.obj", "container.obj", "ruby.obj", "soda.obj", "vinegar.obj", "ring.obj", "bead.obj", "bill.obj", "art.obj", "knocker.obj"] #Possible objnames on PAC pac_objind = {} #Dictionary that finds the index for i in xrange(len(pac_objnames)): pac_objind[pac_objnames[i]] = i def fttp_help(args): print \ """POSSIBLE COMMANDS ARE: HELP ASCI BINARY SEND QUIT SENDING TYPES: [ASCI | BINARY] """ def fttp_asci(args): global fttp_type fttp_type = "asci" print "TYPE SET TO ASCI." def fttp_binary(args): global fttp_type fttp_type = "binary" print "TYPE SET TO BINARY." def fttp_send(args): global items, inventory ## User can send commands! What amnesia... if args == []: print "FILE REQUIRED ON LINE" else: if args[0] in ["gate", "finale"]: print "CANNOT SEND HOSTFACE FILES" elif args[0] == "joke.txt": print "CANNOT SEND TEXT FILES" else: if not args[0] in pac_objnames: print "NO SUCH FILE." else: objnum = pac_objind[args[0]] if not objnum in inventory: print "NO SUCH FILE." #Doesn't matter here! else: print "SENDING %s FILE FOR %s (0 BYTES) ..." % (fttp_type.upper(), objects[objnum][1].upper()) ## Just incase it does take time, don't show "TRANSFER COMPLETE" until we're done. inventory.remove(objnum) if fttp_type != "binary": #Objects got messed up if not o["mess"] in items[s["receiving-area"]]: items[s["receiving-area"]].append(o["mess"]) else: items[s["receiving-area"]].append(objnum) print "TRANSFER COMPLETE." def fttp_quit(args): global fttp_in_progress fttp_in_progress = False fttp_verblist = {"help": fttp_help, "asci": fttp_asci, "bin": fttp_binary, "binary": fttp_binary, "send": fttp_send, "quit": fttp_quit} def fttp_interface(): global fttp_in_progress print "GOT INTO FTTP VER 19/00/00.0003" login = raw_input("LOGIN: ") if login == "jones": print "JONES FTTP ACCESS NOT ALLOWED." else: if login != "anonymous": print "LOGIN FAILED." else: fttp_in_progress = True while fttp_in_progress: reply = raw_input("FTTP> ").lower().split() if len(reply) > 0: if not reply[0] in fttp_verblist: print "NO SUCH COMMAND. TRY HELP." else: function = fttp_verblist[reply[0]] argset = reply[1:len(reply)] function(argset) def pac_dir(args): print "VOLUME IN DRIVE A:\\ HAS NO LABEL \n" print "TOTAL %d:" % (9+len(inventory)) print \ """ PAC . JONES COMMAND (2 BYTES) => DIR PAC . JONES COMMAND (2 BYTES) => AREAS PAC . JONES COMMAND (2 BYTES) => FTTP PAC . JONES COMMAND (2 BYTES) => GOTO PAC . JONES COMMAND (2 BYTES) => TYPE PAC . JONES COMMAND (2 BYTES) => EXIT PAC . JONES HOST (1 BYTE) => GATE PAC . JONES HOST (1 BYTE) => FINALE PAC . JONES TXTFILE (3 BYTES) => JOKE.TXT""" for i in inventory: print " PAC . JONES OBJECT (0 BYTES) => " + pac_objnames[i].upper() def pac_areas(args): print "VOLUME IN DRIVE A:\\ HAS NO LABEL \n" print "TOTAL %d:" % len(visited) for i in visited: print " PAC . JONES AREA (12 BYTES) => " + sect_simplify(sections[i][1]).upper() def pac_fttp(args): if args == []: print "FTTP: HOST REQUIRED ON LINE." else: if args[0] == "finale": print "FTTP: CANNOT FTTP OBJECTS INTO FINALE" else: if args[0] != "gate": print "FTTP: UNKNOWN HOST" else: if not connected: print "FTTP: HOST NOT RESPONDING." else: fttp_interface() def pac_goto(args): global finale, current_section, items, inventory if args == []: print "FTTP: HOST REQUIRED ON LINE." else: if args[0] == "finale": score([]) if reg_score() != 120: print "You have not achieved enough points to connect to finale." else: print "Welcome to the finale. You are a truly brave adventurer." finale = True current_section = s["s-finales-room"] pac_exit([]) else: if args[0] != "gate": print "UNKNOWN HOST" else: if not connected: print "HOST NOT RESPONDING." else: print \ """As you hit the RETURN key, you notice the gate open up. You excitedly jump up and pass the gate before it closes, dropping all your items in the PAC area. You look back and see yourself in a somewhat funny room, sort of which looks like a bridge. Then you straighten yourself up.""" items[s["pac-area"]] = items[s["pac-area"]] + inventory inventory = [] current_section = s["receiving-area"] pac_exit([]) def pac_type(args): if args == []: print "FILE REQUIRED ON LINE" else: if args[0] in ["gate", "finale"]: print "CANNOT TYPE HOSTFACE FILES" else: if args[0] == "joke.txt": print \ """Hey there! If you're thirsty, you can call me Friday! - Michael Jones from Texas """ else: if args[0] in pac_objnames: if pac_objind[args[0]] in inventory: print "CANNOT TYPE BINARY FILES" else: print "UNKNOWN FILE NAME" else: print "UNKNOWN FILE NAME" def pac_exit(args): global pac_in_progress print "\nYou step back from the PAC." pac_in_progress = False pac_verblist = {"dir": pac_dir, "areas": pac_areas, "fttp": pac_fttp, "goto": pac_goto, "type": pac_type, "exit": pac_exit} def pac_interface(): global logged, pac_in_progress if not logged: for tries in xrange(3): print "PAC SYSTEM" login = raw_input("LOGIN: ") if login != "jones": print "LOGIN INCORRECT \n" else: print \ """ WELCOME TO PAC PLEASE CLEAN UP. OUR SYSTEM OF TCP IS GETTING FULL, BUT STILL IN USE. TYPE DIR TO SEE THE LIST. DIRECTORY OF A:\\ """ logged = True break if logged: pac_in_progress = True while pac_in_progress: reply = raw_input("A:\\> ").lower().split() if len(reply) > 0: if not reply[0] in pac_verblist: print reply[0].upper(), ": NOT FOUND" else: function = pac_verblist[reply[0]] argset = reply[1:len(reply)] function(argset) verblist = {"die": die, "quit": _quit, "score": score, "help": _help, "type": _type, "inventory": inven, "i": inven, "take": take, "get": take, "drop": drop, "throw": drop, "toss": drop, "examine": examine, "x": examine, "look": examine, "l": examine, "read": examine, "describe": examine, "eat": eat, "drink": quaff, "quaff": quaff, "sip": quaff, "shake": shake, "wave": shake, "press": press, "switch": press, "push": press, "slide": slide, "move": slide, "lick": lick, "swim": swim, "sleep": sleep, "lie": sleep, "rest": sleep, "unplug": unplug, "break": _break, "cut": _break, "chop": _break, "watch": watch, "channel": watch, "wash": wash, "clean": wash, "answer": answer, "go": move, "n": move_north, "north": move_north, "s": move_south, "south": move_south, "w": move_west, "west": move_west, "e": move_east, "east": move_east, "northeast": move_northeast, "ne": move_northeast, "southeast": move_southeast, "se": move_southeast, "northwest": move_northwest, "nw": move_northwest, "southwest": move_southwest, "sw": move_southwest, "up": move_up, "u": move_up, "down": move_down, "d": move_down, "in": move_in, "out": move_out, "on": move_in, "off": move_out, "enter": move_in, "exit": move_out, "board": move_in, "leave": move_out, "feed": feed, "drive": drive, "put": put, "climb": climb, "dig": dig, "save": save_game, "restore": restore_game, "long": _long, "verbose": _long, "short": short, "superb": short, "normal": normal, "knock": knock} def run_prompt(): global justrestored, numcommands ignore = ["the", "to", "at", "this", "that"] describeIfNew() while not dead: lastsect = current_section if not finale: lastscore = reg_score() reply = raw_input(">").lower().split() for c in ",:;": newstring = "" for item in reply: newstring = newstring + item + c reply = newstring.split(c) while "" in reply: reply.remove("") if len(reply) > 0: for ignorer in ignore: while ignorer in reply: reply.remove(ignorer) if reply == []: reply = [None] if not reply[0] in verblist: print "I don't understand that." else: function = verblist[reply[0]] argset = reply[1:len(reply)] function(argset) numcommands += 1 if lastsect != current_section or justrestored: #Time to describe! describeIfNew() if not finale: if lastscore != reg_score() and not justrestored: #Has the score changed? score([]) justrestored = False print raw_input() ##This is so you can see how the game ended (when doing what I asked about the DOS run). if __name__ == "__main__": run_prompt()