Requirements correctness code quality total
His name has been lost to history so we will refer to him as the curmudgeon. The curmudgeon was an old, crusty, mean fellow who made his fortune the same way that other noblemen did during the dark ages did, by exploiting the weak, poor, and desolate. In the dark ages, business was good for men like these as there were many downtrodden for them to prey upon.
The curmudgeon of our story was the worst of all. He had become so wealthy that he had built himself a castle. It was not a castle like those of his peers, it was more of a ranch style castle; a one-floor ordeal and in the shape of a square. It looked more like the box that the castle was shipped in than it did a traditional castle. He built such a castle because he was a miserly man.
The third type of guard is the most highly trained of them. These guards have dogs and actively search for an intruder. They are paid fairly well by the curmudgeon and that's why there are so few of them. These guards are known as hunter guards.
Regardless of the quality of guard, if our hero enters a room with a guard in it or a guard enters the room where our hero is, our hero will die. The guards are armed with weapons that our young hero cannot resist. Also, if a hunter-guard enters a room directly adjacent to our hero, our hero will be slain.
Page 1 of 5 |
---|
write a computer simulator in the dark ages, the curmudgeon can have a computer-controlled security system.
Activity
• Moves can only be made to directly adjacent rooms. Our guards and hero cannot move diagonally.
• The following number and type of guards are randomly located throughout the castle:
With every move our young hero makes these guards move as well but in a random direction.
o2 hunter guards
tied up. These rooms are located in the center of the castle as shown in red in the diagram below. With the start
of each play, she will be placed in a random bedroom and stay there until she is rescued.
freedom.
• There are 6 actions that our hero can take: move west, move east, move north, move south, pause (don't move
"H", our young hero's wife by a "W". Our young hero by a "Y".
Design
Prof. Dominick Atanasio | Page 2 of 5 |
---|
oIt will also hold our young hero and his wife as separate variables of type Innocent pointers.
oThe only way the wife can move is if she is carried by the young hero.
• Create a person class that will be the base class for all of the guards, the young hero, and his wife.
oThis class will have a protected Position data member which represents the Person's initial or current position.
oThis class will have a pure virtual function called move which has a move as its parameter which defaults to 'A' for auto.
• Create the three guard classes, IndenturedGuard, RovingGuard, and HunterGuard which derive the Guard class.
• Create an Innocent class that inherits Person. This is the class that represents our hero and his wife.
oThis class overrides the pure virtual move function in its inherited Person class. The move function must accept only a valid Position to which to move. It should throw a runtime exception if the move is invalid.
oThe hero saves his awesomely beautiful young with if their positions are at 0,0.
Prof. Dominick Atanasio |
|
Page 3 of 5 |
---|
oAll objects will be created on the heap so the destructor in the object or program that created an
object is responsible to delete it.
polymorphism.
• You can create private helper (utility) functions in any of your classes but do not add any public functions.
Welcome to the Curmudgeon's Castle
---------------------------------
| | | |I | | | | |
| Y | | | | | | | |
---------------------------------
| |I | | |IR | R | | |
| | | | | | | | |
---------------------------------
| | | | W| | | | |
| | | | | | | | |
---------------------------------
| |I | | | |H | | |
| | | | | | | | |
---------------------------------
| | |R | | | | | |
| | | | | | | | |
---------------------------------
| | | |H | | | | |
| | | | | | | | |
---------------------------------
| | |I | | | | | |
| | | | | | | | |
---------------------------------
| | | | | | | R | |
| | | | | | | | |
---------------------------------Your move [N,S,W,E,P,C]:
Prof. Dominick Atanasio Mt San Antonio College Page 4 of 5
CSCI 140: Project 3: Curmudgeon's Castle Spring 21 • Add pre
and post condition comments to function prototypes in each header
file.
• Create a separate definition file for each header
file.
Partial credit will be awarded for the features of the program that do work if the program compiles and runs.
Program ............................ 200
Requirements 100
Correctness 80
Code Quality 20
Total .................................. 200
Note: code quality refers to following good coding practices.
Indentation, spacing, proper naming of identifiers, and modularization
make up this part of the grade.