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
- MPU2213: Bahasa Kebangsaan Assignment, WOU, Malaysia Jelaskan secara terperinci mengenai Bahasa Melayu Klasik dan huraikan perbezaannya dengan bahasa Melayu Kuno
- Environment and Sustainability Assignment, MUM, Malaysia Discuss the factors that contribute to the escalation of plastic pollution in a Southeast Asian country
- FBF1163: Fundamentals of Programming Coursework, UCSI, Malaysia What are the problem-solving strategies and Draw the figure that shows all the phases
- Disease Prevention Assignment, UKM, Malaysia Globally, healthcare systems are being affected by the rapid, dynamic changes in advancements in biomedical science
- ACC30008: You are required to analyse PN17 companies under Bursa KLSE 3 years (2017- 2019) during pre-pandemic COVID-19: Accounting theory Assignment, SUT, Malaysia
- MGMT20001: Organisational Behaviour Case Study, UOM, Malaysia What suggestions do you have for the president on how to coach Jack in developing a personal improvement plan
- ENT600: Technology Entrepreneurship Case Study, UiTM, Malaysia A case study is an account of an activity, event, or problem that contains a real or hypothetical situation
- UGB264: Business Ethics, Responsibility, and Sustainability Report, UOS, Malaysia Examine and discuss the key challenges around corporate responsibility, relating directly to the ethical stance
- ACC116: Introduction To Cost Accounting Assignment, UiTM, Malaysia Identify the cost driver for each of the activity cost pools below Machine cost and Purchase cost
- Human Computer Interaction Assignment, UU, Malaysia In order to use external knowledge sources for innovation activities in organizations, recently crowdsourcing platforms