Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What do you need to do for this assessment? Task: In this assignment, you are going to design and implement classes and use them to

What do you need to do for this assessment?
Task:
In this assignment, you are going to design and implement classes and use them to write and modify programs. Marks will be awarded for a correct answer that shows good understanding of the C++ concepts: classes, data types, problem solving, and inheritance.
Specification
The aim of the coursework is to develop and implement a set of classes that represent the different elements that appear in a game. You are not developing the complete game, just the setting up, specific snapshots and display of the game. The system will have a console application that will display the board and the entities using ASCII.
You are required to write a 'level' editor for a simple game called MysteryWorld. A level in MysteryWorld is a room made up from 10 x 10 grid. Each cell in the room is referred to by the row and column number (coordinate). Hence the '@' in the room shown in Figure 1 is placed at cell (3,1):
Game Specifications
A room in MysteryWorld can be populated by two types of entities: inanimate and animate entities.
There are two kinds of inanimate entities: stones which are represented by 'S' and holes which are represented by a 'O'. Holes also have a depth in meters represented by a number between 0 and 20. Expectedly, inanimate do not move.
Each living entity has a measure of its health, represented using an integer value between 0 and 100 and all the living entities can move. There are three types of living entities: dragons represented by the symbol #, human beings represented by @; and monsters represented by a '* character. Each human being has a name, the monsters have strength represented by a number between 0 and 5.
All the animate objects can move and their health is usually reduced when they move.
Animate entities wandering around the world
o Humans: The humans always move to the cell to on their right, provided that this cell is not occupied and that they are not at the edge of the room. Otherwise they move to unoccupied randomly chosen cell adjacent to their current position. Their health is reduced by one every time that they move.
o A dragon moves to a cell that is randomly chosen from those cells that are unoccupied, and adjacent to its current position. The health of the dragon is very volatile and is reduced by a random number between 0 and 5 every time it moves.
o Monsters: A monster moves as many cells as its strength at any direction (up, down, left or right) as long as the destination is free and the monster remains within the room. For instance, the monster in position (9,3) in Figure 1 with strength 5 can move to position (9,8) but it cannot move to (4,3) because the cell is occupied, the monster cannot move to any other cell because it will reach the end of the room. In the case that there are not possible movements, the monster will move to a random empty cell next to it. The health is reduced as many points as the strength.
Note: In the unlikely event that all the possible options are invalid, the entity will not move. Furthermore, the default movement of all the living entities is to a random adjacent cell.
A typical level for a game would look like the following:
This shows 2 stones, 2 holes, 3 humans, 3 monsters and 2 dragons on this level. Note that a full stop is used to denote an unoccupied cell in the level.
0123456789
0..........
1. S ... # ....
2... O ......
3. @ .....*..
4... O ......
5.. S .......
6....... @ ..
7 # .. @ ......
8.......*..
9...*......
Figure 1
You will work only with the console application to test your implementation. It is suggested that you have the following classes at a minimum:
1. Entity class: This is an abstract class which will act as the parent (base) class to all the different entities (Holes, Stones, Humans...) of the game.
2. Room class: This is the class that stores the positions of all the entities. It should ideally contain the Methods to add entities, display the room, display information etc.
3. Main class: This is the main class that handles the game. The menu will be implemented here and you will need to add the call to the specific actions.
Functional Requirements
1. The program should be a console application. The user interacts with the program by typing instructions into the standard input, and the program gives output by writing to the standard output.
When the program starts, it should display the initial state of the game, and a menu. The initial state of the game should contain 2 holes, 2 stones, 3 monsters, 3 humans, 2 dragons, placed randomly in the room, with the constraint that two entities cannot occupy the same position. In the initial state, the depth of the holes is a random number between 0 and 20, monsters will be allocated a random strength between 0 and 5 and the three humans will be: Harold, David and Clar

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_2

Step: 3

blur-text-image_3

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions