Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem. Create a simple text based adventure game. You explore the environment by issuing key commands. The computer produces textual descriptions of what you find.
Problem.
Create a simple text based adventure game. You explore the environment by issuing key commands. The computer produces textual descriptions of what you find. A discussion with example output can be found here: wwwcabinetmagazine.orgissueslucasphp
The game will be comprised of Room constructs. I use the word construct because you can use strucs, objects, arrays, scalar variables, or parallel arrays for your main data structure. These constructs will have a roomname, roomdescription, roomid occupied code, and exit codes NSEW You are free to add other variables as necessary. The room name always appears. The room description only appears the first time you enter that room or when you enter a Look command. The room id doesnt do anything unless you are using an array in that case it is the element number of that room in the array. The occupied code just indicates if there is anything in that room. The exit codes are the commands you use to move to the next room. Allowable exits should always display along with the room title.
If the room is occupied, randomly select one of monsters to spawn in the room. What, exactly, they do with your character is up to you. Not every room needs a monster! In fact, you are likely to not see some of the monsters on any given run. You DO NOT need to create a visual map.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started