Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing this class based on the program description and UMl diagram: Problem Description: The idea for this project is similar to old

I need help writing this class based on the program description and UMl diagram:

image text in transcribed

image text in transcribed

Problem Description: The idea for this project is similar to old text-based adventure games in which a player is presented with various options through various screens of text. In the case of your project, you have been trapped in a maze and must figure out how to navigate a maze in order to escape. The maze is composed of rooms. In order to escape, the player needs to travel through each room of the maze, gathering keys and objects along the way that will aid in their escape. Take the following maze as an example (note that you do not need to implement this visualization): | The StartThe Landing Master Bedroom | axe,blue_key | tred_key--+ | The Kitchen The Hall I red_key The Exit! 1- This maze is composed of two rows and three columns. Every maze can be represented as a grid. In order to get the specifications for a maze, you will read in a maze's layout through a data file (discussed later). For each maze, the player starts in the top left corner of the maze and must make their way out of the maze. Escaping the maze means finding an exit that has an accessible passagway out of the maze. The data read in from the input file will define characteristics about each room of the maze and the passageways connecting them. Some rooms will have passageways blocked by doors that require special items to open. In the given example, the door to the south of the player's starting location is blocked by a door that requires a red_key to open. The player must make their way to the "Master Bedroom" first before they backtrack and can finally open the door that will allow them to progress to The Exit. The maze will be interactive as described in the next section The Passage Class C) Passage isOpen: bool key: std: string Passage() o Passage(bool isOpen) o Passage(bool isOpen, std::string key) o IsOpen): bool o RequiresKey) bool o GetRequiredKey): std::string o Open) void This class is responsible for storing information on a passage in the maze. A passage can either be a solid wall, an open passageway, or a door. The first parameterized constructor can be used to create a passage that is not a door. The second takes in an additional key parameter for a door. In addition to the parameterized constructors, this class should have the following methods: IsOpen() o Returns a boolean value to state whether the passage is currently open. Requireskey() o Returns a boolean (true or false) if the passage requires a key to open. o This function allows you to determine whether the passage is a door GetRequiredKey() o Returns an std::string of the key needed to open the door. For instance a "red_key" is needed to open the door that is South of The Start Open o Opens a closed door. You should check that the player has the required key before opening the door Problem Description: The idea for this project is similar to old text-based adventure games in which a player is presented with various options through various screens of text. In the case of your project, you have been trapped in a maze and must figure out how to navigate a maze in order to escape. The maze is composed of rooms. In order to escape, the player needs to travel through each room of the maze, gathering keys and objects along the way that will aid in their escape. Take the following maze as an example (note that you do not need to implement this visualization): | The StartThe Landing Master Bedroom | axe,blue_key | tred_key--+ | The Kitchen The Hall I red_key The Exit! 1- This maze is composed of two rows and three columns. Every maze can be represented as a grid. In order to get the specifications for a maze, you will read in a maze's layout through a data file (discussed later). For each maze, the player starts in the top left corner of the maze and must make their way out of the maze. Escaping the maze means finding an exit that has an accessible passagway out of the maze. The data read in from the input file will define characteristics about each room of the maze and the passageways connecting them. Some rooms will have passageways blocked by doors that require special items to open. In the given example, the door to the south of the player's starting location is blocked by a door that requires a red_key to open. The player must make their way to the "Master Bedroom" first before they backtrack and can finally open the door that will allow them to progress to The Exit. The maze will be interactive as described in the next section The Passage Class C) Passage isOpen: bool key: std: string Passage() o Passage(bool isOpen) o Passage(bool isOpen, std::string key) o IsOpen): bool o RequiresKey) bool o GetRequiredKey): std::string o Open) void This class is responsible for storing information on a passage in the maze. A passage can either be a solid wall, an open passageway, or a door. The first parameterized constructor can be used to create a passage that is not a door. The second takes in an additional key parameter for a door. In addition to the parameterized constructors, this class should have the following methods: IsOpen() o Returns a boolean value to state whether the passage is currently open. Requireskey() o Returns a boolean (true or false) if the passage requires a key to open. o This function allows you to determine whether the passage is a door GetRequiredKey() o Returns an std::string of the key needed to open the door. For instance a "red_key" is needed to open the door that is South of The Start Open o Opens a closed door. You should check that the player has the required key before opening the door

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

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

ISBN: 3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

Methods of Delivery Guidelines for

Answered: 1 week ago