Recommendation on how to develop the program: a. Create a class named Map which would be used to create the following: - The actual Map
Recommendation on how to develop the program: a. Create a class named Map which would be used to create the following: - The actual Map of Mars, which is to be hidden from the user and will only be displayed to the user at the end of the game. The Mars Rover Mapper, which keeps track of the cells in the map the Rover had already observed. b. One possible minimal class declaration for Map is shown below: class Map { private: vector > map; int dimx, dime; public: Map(int dimx, int dimy); void resize (int dimx, int dimy, char ch); void display(); void setObject (int x, int y, char ch); char getObject (int x, int y); bool isEmpty(int x, int y); bool ishill (int x, int y); bool isTrap (int x, int y); bool isInsideMap (int x, int y); int getDimx(); int getDimy(); }; //Map c. Create a class named Rover, which would be used to keep track of the location and heading of the Rover. One possible minimal class declaration is shown below. class Rover private : int x,y; Direction heading; char object Under Rover; Map* p_mars; 1/a pointer to the map for Mars Map mapper; //a map that keeps track of observed cells so far public: Rover(); void land (Map& mars); //links a map of Mars to a Rover bool turn Left(); bool turn Right(); bool move(); void displayMapper(); bool executeCommand (char command); }; //Rover d. The class declarations above are only the bare minimal, you may want to add member functions and data member such as for keeping track of golds collected etc. e. The data type Direction can be defined using enumeration as shown below. Please refer to your textbook on how to use enum. enum Direction north = 0, east = 1, south = 2, west = 3 f. As the Rover moves across the map, it would be able to read the three cells just in front of it. g. There are hills on the map which prevent the Rover from moving to those cells. h. There are traps on the map, if the Rover moves to any of those cells, the mission is failed. i. You are free to design your scoring system and other type of cells, you may also introduce new challenges for the Rover. The GOAL of the game is for the Rover to collect all the golds on Mars. The Mars Rover assumed to be ALWAYS starts at the centre of the map which is ALWAYS an empty space, but the Rover's heading can start at any of the north, east, south or west direction You MUST design your map such that all the golds are reachable from the starting cell and that they can be collected by the Rover. The ALGORITHM TO GENERATE THE MAP would constitute AT LEAST ONE- THIRD OF THE TOTAL MARKS of the assignment, all the cells must be randomly generated with good schemes. FOCUS FIRST on designing the algorithm that generates the map. Use your creativity!! Yes, programming is also a CREATIVE PROCESS. For MAP GENERATION, you may want to make good use of the pseudo-random number generator from the C++ Standard Library. If we want to generate 100 characters with a 10% chance of getting X, 30% chance of getting Y' and 60% chance of getting Z', we can do that with a program such as the below: #include #include #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance