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.
- 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 are we 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.
- In addition to 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).
First of all, you need to perform object-oriented design of your new project. 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 design. I would recommend to create an abstract class
BattleObject and derive all classes 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:
This project is due by 11:59pm on Monday, April 12, 2004.