15 points - Due session 5
The purpose of this assignment is to help you gain experience using polymorphism and inheritance to extend an object-oriented program.
Consider the Minefield example we discussed in class. Enhance the game by adding two new types of cells: a CFoggyCell and CRadarCell.
The CFoggyCell does no player damage, and to the player, it appears to be an empty cell. That is, the player is awarded 10 points for exploring it, and once explored, it seems to reveal the number of mines in all adjacent cells. However, since the atmosphere in a CFoggyCell is foggy, the number of mines it displays for the adjacent cells is inaccurate. So in essence, the CFoggyCell does not tell the truth about the number of adjacent mines.
The CRadarCell also does no player damage, and when explored, it reveals the contents of all adjacent cells that do not cause damage. (Hint: Think about how you can leverage the declareNeighbors() method in the CCell class to provide specialized behavior in the new class.) The player's score should increase by 20 after exploring a CRadarCell, but no points or bonuses (e.g. shield upgrades) are awarded for the adjacent cells that are revealed. The character representation of an explored CRadarCell is 'R'.
If two CRadarCells are adjacent, the process of exploring and activating the first one renders the second one inoperable because of their close proximity. In other words, you do not need to recursively reveal the neighbors of adjacent radar cells.
Modify the program so that approximately 3% of all cells are CRadarCells and 3% of all cells are CFoggyCells.
The code for the basic Minefield game can be found here. This is the code you must extend for this assignment.
Put only the .h and .cpp files that you have added or changed into an archive file named hw4.zip or hw4.tar.Z. Save this archive file in your AISYG 240 course directory (Courses/AISYG 240) on ftp.coe.neu.edu.