CCP6124: In this assignment, you are required to implement a “Robot War” simulator using standard C++: Object Oriented Programming and Data Structures, Assignment, MMU, Malaysia
University | Multimedia University (MMU) |
Subject | CCP6124: Object Oriented Programming and Data Structures |
Assignment
In this assignment, you are required to implement a “Robot War” simulator using standard C++. The simulator simulates the warfare of robots in a given battlefield. The rules of war are as follows:
1. The battlefield of the war is a 2-d m x n matrix (for example an 80×50 battlefield matrix) to be displayed on a screen. You can choose any appropriate battlefield representation using characters and symbols to represent robots, battlefield locations and battlefield boundaries.
2. The simulation is turn-based. If you have 3 robots simulated, robot one performs its action plan first, followed by robot two and robot three before going back to robot one, robot two and so on. In each turn, depending on the capabilities of a robot, the robot will first perform a look action (if the robot has that capability), then make a move (if the robot has that capability), followed by a firing action (if the robot has that capability too).
3. The position of a robot is not revealed to other robots (robotPositionX and
robot PositionY are private members of every robot class). In general, each robot can perform a ‘look’ action to see what are around.
4. A robot can take a move action to one of its 8 neighbouring locations : up, down, left, right, up left, up right, down left and down right.
5. The look(x,y) action will reveal a nine-square area to a robot, centred on (robotsPositionX + x, robotsPositionY + y). Thus a look(0,0) will provide the robot with its immediate neighbourhood (an exhaustive list of places it can visit in its next turn). The I i i J look action should reveal whether a location is in the battlefield or not, or whether a location contains an enemy robot. A location can only be occupied by one robot.
Get Solution of this Assessment. Hire Experts to solve this assignment for you Before Deadline.
6. The robot can perform a fire(x,y) action (keeping in mind that different robot have different fire patterns). This action will destroy any robot in the location (robotsPositionX + x, robotsPositionY + y). Make sure that the robot will not fire at (0,0). A robot must not commit suicide.
7. Each robot has a type (which determines the robots strategy) and a name. The simulator will be started with a number of robots in different positions, and it will display the actions of robots until the simulation time is up or until one robot remains, whichever comes first.
8. All robots objects should inherit from a base abstract class called Robot. This Robot class is to be inherited by 4 basic abstract subclasses, namely MovingRobot, ShootingRobot, SeeingRobot and SteppingRobot. These 4 classes should not have any overlapping public member functions (methods) and data members. All robot types mentioned below must be inherited (multiple inheritance) from these 4 classes depending on their capacity to look, fire, move or stepping on other robots.
9. The initial robot types are defined as follows:
RoboCop: In each turn, this robot looks at its current position and decides on a move. Then moves (once) and fires (three times) at random positions. This sequence is repeated for each turn. The maximum city block distance of firing should be set to 10 (i.e. for any fire(x,y), x+y is at most 10). RoboCop cannot move to a location that contains another robot. If RoboCop shoots a total of 3 robots, then it will be upgraded to be allowed to move to a location that contains another robot, thus stepping and killing that robot. This type of robot is called TerminatorRoboCop (see below)
Terminator:Â In each turn, this robot looks at the immediate neighbourhood (3×3 window centred at the robot position) and performs a move to one of the neighbours. Thus, a Terminator will not fire at all and will terminate robots in its path. It will prefer locations which contain enemy robots. If the Terminator kills a total of 3 other robots, then the Terminator will be upgraded to be allowed to fire in a similar way to a RoboCop fire, this type of robot will now become a TerminatorRoboCop as well.
TerminatorRoboCop :Â This is either a upgraded RoboCop or a upgraded Terminator, it means it is a robot that can fire like RoboCop and step on other robots like Terminator. If the TerminatorRoboCop kills 3 other robots, it will be upgraded to UltimateRobot (see below).
BlueThunder:Â This robot does not move and cannot look. It fires at only one of its immediate neighbouring cells surrounding it. In each turn, the target location to fire is not random. The sequence of firing is such that it starts from the location up and continue with a new location clockwise in each following turn. If BlueThunder shoots a total of 3 other robots, it will be upgraded to MadBot.
Madbot: This robot does not move. It fires at only one of its immediate neighbouring locations surrounding it randomly. If Madbot eliminates a total of 3 other robots, it will be upgraded to RoboTank.
RoboTank: This robot does not move. It fires at one random location in the battlefield, killing a robot if one exist in that position. If RoboTank kills a total of 3 other robots, it will be upgraded to UltimateRobot
UltimateRobot : This robot moves like the TerminatorRoboCop, stepping and killing any robots on its path. On top of that, in each turn, this robot shoots randomly at 3 locations in the battlefield.
10. The initial conditions of a simulation are specified in a text file which contains
The dimensions of the battlefield ( M by N )
The number of simulation steps. (steps: T)
The number of robots. (robots: R)
The type, name, and initial position of each robot
(if the initial position is random, the robot is placed in a random location)
An example text file looks like this:`
M by N : 40 50
steps: 300
robots: 5
Madbot Kidd 3 6
RoboTank Jet 12 1
Terminator Alpha 35 20
BlueThunder Beta 20 37
RoboCop Star random random
11. Each robot has three lives. When a robot is destroyed, it can go into a queue to reenter into the battlefield three times. Only one robot can re-enter each turn to a random location in the battlefield.
12. The above requirements are the basic requirements of this assignment. You may feel free to add more features and capabilities, and even your own robot types to make the simulation exciting
Stuck in Completing this Assignment and feeling stressed ? Take our Private Writing Services.
Get Help By Expert
Recent Solved Questions
- TSE2231: Software Engineering Fundamentals Home Work, MMU, Malaysia MMU has recently set up to provide state-of-the-art research facilities in Computer Science. Apart from students
- Sustainable Project Management Assignment, UTM, Malaysia Decision-making for sustainable project management can be a very arduous task in which decision-making methods
- BNNS6433: The infection typically starts in the lower urinary tract as a urinary tract infection (UTI): Genitourinary & Endocrine Nursing Assignment, LUC, Malaysia
- Faculty of Business and Law Assignment, TU, Malaysia Analysis and discussion on the financial performance and Basically your financial performance analysis comprise of horizontal
- Business Statistics Assignment, SU, Malaysia In statistics, there are dependent and independent variables. Dependent variables are so-called because
- Biomechanics Assignment, UOC, Malaysia We expect that you will remember what you learn from writing this paper long after the class is over
- BBM208/05: Business Ethics Assignment, WOU, Malaysia Mr. Musk opened his California factory this week in defiance of local orders He has also criticized the response to the pandemic
- Healthcare Research Paper, IMC, Malaysia Nurses are the backbone of the healthcare industry. Nurses’ roles as patient advocates and skilled care providers will never
- You are required to prepare the alignment and detailed design of the proposed drainage system: Hydraulic Essay, UTM, Malaysia
- Information Technology Case Study, UTP, Malaysia Students are given an article British Airways suffers data breach compromising information