Project 3
Your third project is to extend the program developed in your second project. In the new version
of the robot war you need to implement the following:
- From now on, the robots belong to several different armies. That is, each robot should gave one more field
army, which can take one of the color values (blue, red, yellow, etc). Robots of the same army
don't fight each other.
- In addition to robots associated with some armies, there may be bandit robots, which attack anyone including
other bandit-robots. In other words, you cannot consider those bandints as yet another army.
- Also our robots now are supposed to behave smart. That is, they don't just go in a specific direction until it
reaches a boundary. Instead, the new robots can make their decision on every move. For this, they need to know
the location of other robots on the battle field (well, at least in the neighbor cells). Thus, the robot's method
Move() should take a variable of the Grid type to provide a robot with
information needed.
- In addition to robots, we are allowed to set land-mines. Unlike robots land-mines cannot move along the battle field
and they damage every robot which is in their cell.
- Besides simple land-mines, we will have smart land-mines, that behave the same way as usual ones,
except they also belong to an army and they don't explode if there is at least one robot from the same army in the
mine's cell.
- Another new object on our battle field will be a rocket tower. A rocket tower also belongs to an army and, of course,
doesn't attack robots of the same army. Towers don't move (like land-mines) and can choose their target (like
robots). However, unlike robots they can attack several targets (let's say two) during one move.
- Each object on the battle field should have it's own unique ID.
- User is allowed to specify how many armies she/he wants to have, how many robots in each army, how many land-mines
of each sort, how many rocket towers. Also user can choose the size of the grid (the number of cells on the battle
field).
In order to complete the assignments you need to decide on several things like:
- How to set priorities (reaction time) for robots, mines, and towers. Remember, these priorities are
important because they decide who attacks first.
- How the priorities change when a robot gets hit.
- How a robot makes a dicision about the new move.
- How the main program knows ahen to stop the simulation.
- How rocket towers chose their targets, etc.
Please have all these decisions well commented in the correspondin methods.
To complete this project, you need to perform object-oriented design of your new system. In this step,
you need to review the design of your previous project and decide what changes you need to make. Try to reuse
as much code as you can. During this step you need to come up with new object hierachical structure. I would
recommend creating an abstract class BattleObject and derive all classes for robots, mines, towers
from this object. Try to include all common characteristics in the base class as well as the
interface (the set of methods you will need all your objects to have).
If you follow this direction, then you will have to slightly redesign your PRobot class (may be give it a
better name too).
The completed project should include three parts:
- MS Visio document with the schema that results your object-oriented analysis;
- detailed description of each class, which includes a short description of the class, the way it will be used in the
program code, and detailed description of each method (especially public) of the class. That can be done
as comments in the header files. Please take it seriously, this part will be graded separately. I will also
grade how the code in the method corresponds to its comments.
- the working program code.
Additional requirements: