Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Content of Adventure2.txt 1 title Center of the Ruins exits null 2 6 4 description Phew, finally made it to the ruins! It's taken three

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Content of "Adventure2.txt"

1 title Center of the Ruins exits null 2 6 4 description Phew, finally made it to the ruins! It's taken three days and nights of traveling by description by foot, but it was worth it! Now to hurry up and find the treasure, but not without remembering description what you were told before you came here: description description "For the treasure you seek, it must be earned, and you must pass the tests description One test of resourcefulness, only for those with an eye of the sky description One test of wit, fit for one of two conjoined minds, or perhaps a mind of two. description The way shall be revealed for the one who can go forward in going backward." description description So now the question is...where do you go? puzzle keystone 15 null north 3 puzzle-text It seems like there's some door with an oddly shaped hole...maybe it's a key? puzzle-text Time to have a look around for it, I suppose. puzzle-result As you place the stone into the slotted hole, the stones around you begin to shift and puzzle-result move on their own, allowing you to move forward! ----- 2 title Entrance to Ruins exits 1 null null null description The outside of the ruins are...well, intimidating to say the least. Old styled columns description can be seen everywhere around you, and the entrance looks huge! Large enough to fit an description entire cruise ship! However it's not as if you would want to take something like that description here, the floor isn't exactly stable...plus the treasure's all yours! No need for anyone description else to come here and try to take it from you. puzzle break 40 null south 9 puzzle-text Hm...well the instructions you were given did say the one who can go backward, but there's puzzle-text no doors or anything out here that you can see where you can go! Maybe there are more puzzle-text clues inside you can use. puzzle-result As you utter the word break, staring at the ruin to see what would happen, you turn around puzzle-result and notice that a new staircase has risen from the ground! Maybe it leads to the treasure puzzle-result you've been looking for! ----- 3 title Hidden Room exits null 1 null null description After walking through a few staircases there is suddenly revealed to be a large room in front description of you. There are three different statues who all seem to have different colored gems on their description headpieces: one gold, one silver, and one bronze. Each seem to have a stone at their feet which description represents the same color of gem on their headpiece...interesting. puzzle silverstone 15 null null null puzzle-text Wait a minute...the middle statue doesn't have any stone at his feet! Maybe if you place it there puzzle-text it'll open the room where the treasure is! There's no time to waste. puzzle-result As you place the stone at the feet of the middlemost statue, the room begins to shake! puzzle-result Suddenly the three statues all start to rotate, until their backs are facing you. When they do, puzzle-result you start to notice that they spell out a new message: puzzle-result "For returning what was rightfully ours, you can now learn the secret to our treasure. puzzle-result It is only who knows how to break out of infinity, that truly deserves the wealth of the world." puzzle-result How to break out of infinity?...wait...like a break statement? Maybe that's the answer! puzzle-result But then where would you have to say something like "break" out loud? ----- 4 title West Hall exits null null 1 5 items ladder description As you go to the left from the central room, you notice that you're in a very long drawn-out description hallway marked by only a few torches. As you start walking you notice that there's a hole in description ruins above you, letting in some natural sunlight. You can keep trying to go down the hallway description maybe, see if there's another place where this key is hiding. puzzle ladder 15 keystone null null puzzle-text Hm...this ladder's gotta be useful for something! puzzle-result Wait a second...the hole at the top of this very room! Remember what you were told: puzzle-result "for those with an eye of the sky", it's gotta be up there! After climbing the ladder, puzzle-result, you're able to grab a stone that seems to fit the shape of the door in the center room puzzle-result Jackpot! ----- 5 title Pillar Room exits null null 4 null description After a while longer of walking you finally made it to the end of the hallway into a description mostly empty room, minus the pillared area in front of you and a few scattered platforms description around the room. puzzle ladder 0 null null null puzzle-text Maybe the key's on the top of that pillar! If only you had a way to get to it... puzzle-result You begin using the ladder to climb to the top of the pillar: getting to the top of one, puzzle-result then lifting it up with you to get to the next one. It's a little dangerous but you finally puzzle-result get to the top!...only to see that there's nothing there. puzzle-result As you start climbing back down, you try to think of where else the ladder could've been puzzle-result used before now. ----- 6 title East Hall exits 7 8 null 1 description As you enter in the smaller hallway, you notice that there are two other rooms that you description can choose to enter into. There's a clear sign on the wall in front of you: description description "Only when you shout the solution shall you be granted your reward." puzzle 10100 15 silverstone null null puzzle-text Hmm...well, the instructions did say the riddle was for "one of two 'conjoined' minds". Maybe puzzle-text it meant addition? And what does "two" mean? Binary, maybe? There must be clues in these two rooms of the numbers to add together, puzzle-text perhaps. Let's go have a look and see if we can get the right answer! puzzle-result As you shout out the answer in binary, a pedestal rises up from the ground in front of you! The puzzle-result podium seems to have a single stone of it, made entirely of silver! Although, you can't imagine this puzzle-result is the entire treasure...there's got to be more to it than that. ----- 7 title North Room exits null 6 null null description The northmost of the two rooms you can look through seems to be completely filled with description gourds. There's no way that you can count all of these! As you keep looking though you description notice that they're actually separated into eight piles. In addition, only one of those description gourds per row actually has water in it...perhaps the water is this important item? ----- 8 title South Room exits 6 null null null description The southern room in the hallway seems to have about twelve bookshelves, all filled description with ancient texts and books, and way too many to count! As you try to grab one, and description read it for curiosity, a line of it calls out to you: description "What is infinite knowledge, without a place for it to be stored for recollection?" description A place for knowledge to be stored... ----- 9 title Treasure Room exits 2 null null null description Finally! As you start walking down the staircase you see it: piles and piles of description gold and jewels galore! It's so big, the treasure cave in Aladdin almost looks like description nothing! As you finally reach the bottom of the stairs, one more message waits for you: description description "You have earned the right to enjoy these riches. description Enjoy your spoils, and remember what got you here: your wit and determination." -----

CSE 101 (Section 01) Spring 2017 Homework 3 Many years ago (in the 1970s and 1980s), most computer games didn't have fancy graphics or elaborate controls. Instead, they took the form of "text adventures" like Adventure (AKA Colossal Cave Adventure) and the Zork series, where the game presented written descriptions of various locations in the game and players typed in commands to move around and solve puzzles (this genre still exists today under the title of "interactive fiction"). Some of these games became extremely elaborate, featuring dozens or hundreds of in-game locations and the ability to understand complicated commands (e.g., "open the door with the green key", not just "open door"). For this assignment, you will write a parser that reads in a data file written in a special format and runs the resulting text adventure game. We won't create anything as sophisticated as the classic text adventure Zork, but we will still support a number of basic commands and simple puzzles. Note that the following instructions are long, but if you follow them closely, you will find that the actual solution process for this assignment is not extremely complicated. It mainly consists of a number of loops and nested if-elif-else chains Part 1: Loading the Data File Every game consists of a collection of locations, called rooms. Every room has four required pieces of information: A unique room number (this value is used internally to track the player's current position; it is hidden from the player) A room title (a word or short phrase that identifies the room, like "Kitchen") A room description (a string containing a text description of the room's appearance). A description may be specified using multiple lines of the data file A list of exits (directions that the player may go to travel to a different room). A room may have exits in any combination of the four cardinal directions (north, south, east, and west) A room may also have one or both of the following optional elements: A list of one or more items (objects that the player can pick up during the course of the game for use in solving puzzles) A puzzle that must be solved in order to progress in the game. Puzzles generally award points for being solved, and may reveal new locations in the game and/or produce new items that the player can use to solve other puzzles (for example, the player may need to solve Puzzle 1 to gain a new item that will let the player solve Puzzle 2 in another room). Like room descriptions, puzzles are specified using multiple lines within the data file. Each room may have up to one puzzle CSE 101 (Section 01) Spring 2017 Homework 3 Many years ago (in the 1970s and 1980s), most computer games didn't have fancy graphics or elaborate controls. Instead, they took the form of "text adventures" like Adventure (AKA Colossal Cave Adventure) and the Zork series, where the game presented written descriptions of various locations in the game and players typed in commands to move around and solve puzzles (this genre still exists today under the title of "interactive fiction"). Some of these games became extremely elaborate, featuring dozens or hundreds of in-game locations and the ability to understand complicated commands (e.g., "open the door with the green key", not just "open door"). For this assignment, you will write a parser that reads in a data file written in a special format and runs the resulting text adventure game. We won't create anything as sophisticated as the classic text adventure Zork, but we will still support a number of basic commands and simple puzzles. Note that the following instructions are long, but if you follow them closely, you will find that the actual solution process for this assignment is not extremely complicated. It mainly consists of a number of loops and nested if-elif-else chains Part 1: Loading the Data File Every game consists of a collection of locations, called rooms. Every room has four required pieces of information: A unique room number (this value is used internally to track the player's current position; it is hidden from the player) A room title (a word or short phrase that identifies the room, like "Kitchen") A room description (a string containing a text description of the room's appearance). A description may be specified using multiple lines of the data file A list of exits (directions that the player may go to travel to a different room). A room may have exits in any combination of the four cardinal directions (north, south, east, and west) A room may also have one or both of the following optional elements: A list of one or more items (objects that the player can pick up during the course of the game for use in solving puzzles) A puzzle that must be solved in order to progress in the game. Puzzles generally award points for being solved, and may reveal new locations in the game and/or produce new items that the player can use to solve other puzzles (for example, the player may need to solve Puzzle 1 to gain a new item that will let the player solve Puzzle 2 in another room). Like room descriptions, puzzles are specified using multiple lines within the data file. Each room may have up to one puzzle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Describe the nature of negative messages.

Answered: 1 week ago