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
- BFW2751: Derivatives 1 Assignment, MUM, Malaysia Nancy Lim a financial analyst, is looking for your guidance regarding her new investment portfolio, which is worth $2 million
- NBHS1112: Describe the pathophysiology of Type II Diabetes Mellitus with links to Madam Suba’s case: biochemistry Assignment, OUM, Malaysia
- Accounting and Finance for Managers Assignment, PBS, Malaysia Working capital management is a critical part of a company’s financial management. Sales, profitability
- Leadership and Organizational Behavior Assignment, UiTM, Malaysia Which leadership approach/s would you personally employ or apply at work? why? This is an academic paper
- Marketing Management Essay, HWU, Malaysia Is Tom’s of Maine toothpaste really green if consumers leave the water running while they brush their teeth
- Please explain the impact of interest rates on residents’ savings and investments: Macroeconomics Assignment, WMC, Malaysia
- You felt that the above retirement program may be very hard to achieve as your monthly income is not sufficient to contribute the required monthly investment installment: Financial Management Assignment, UTP, Malaysia
- MBM3783: Social Marketing Case Study, UoTS, Malaysia A local woman claims to have been cheated of over RM1.4 mil after meeting someone online who claimed to be a South African engineer
- BDNG3103: Introductory International Business Assignment, OUM, Malaysia Assume that Proton plans to expand its market by setting up a new production facility in Saudi Arabia in the year 2023
- UNGS2060: Malay Virtues Heritage & Malaysian Society Research Paper, IIUM, Malaysia Discuss the circumstances that led to the spread of Islam in the Nusantara