Your assignment is to complete this c program skeleton to


Rage Against the Machines

Your assignment is to complete this C++ program skeleton to produce a program that implements the described behavior. (We've indicated where you have work to do by comments containing the text TODO; remove those comments as you finish each thing you have to do.) The program skeleton you are to flesh out defines four classes that represent the four kinds of objects this program works with: Game, Arena, Robot, and Player. Details of the interface to these classes are in the program skeleton, but here are the essential responsibilities of each class:

Game

To create a Game, you specify a number of rows and columns and the number of robots to start with. The Game object creates an appropriately sized Arena and populates it with the Player and the Robots.
A game may be played.

Arena
When an Arena object of a particular size is created, it has no robots or player. In the Arena coordinate system, row 1, column 1 is the upper-left-most position that can be occupied by a Robot or Player. (If an Arena were created with 10 rows and 20 columns, then the lower-right-most position that could be occupied would be row 10, column 20.)
You may tell the Arena object to create or destroy a Robot at a particular position.
You may tell the Arena object to create a Player at a particular position.
You may tell the Arena object to have all the robots in it make their move.
You may ask the Arena object its size, how many robots are at a particular position, and how many robots altogether are in the Arena.
You may ask the Arena object for access to its player.
An Arena object may be displayed on the screen, showing the locations of the robots and player, along with other status information.

Player
A Player is created at some position (using the Arena coordinate system, where row 1, column 1 is the upper-left-most position, etc.).
You may tell a Player to stand, move in a direction, or shoot in a direction.
You may tell a Player to take an action of its choice.
You may tell a Player it has died.
You may ask a Player for its position, alive/dead status, and age. (The age is the count of how many turns the player has survived.)
Robot
A robot is created at some position (using the Arena coordinate system, where row 1, column 1 is the upper-left-most position, etc.).
You may tell a Robot to move.
You may ask a Robot object for its position.

The skeleton program you are to complete has all of the class definitions and implementations in one source file, which is awkward. Since we haven't yet learned about separate compilation, we'll have to live with it.

Complete the implementation in accordance with the description of the game. You are allowed to make whatever changes you want to the private parts of the classes: You may add or remove private data members or private member functions, or change their types. You must not make any deletions, additions, or changes to the public interface of any of these classes - we're depending on them staying the same so that we can test your programs. You can, of course, make changes to the implementations of public member functions, since the callers of the function wouldn't have to change any of the code they write to call the function. You must not declare any public data members, nor use any global variables other than the global constants already in the skeleton code, except that you may add additional global constants if you wish. You may add additional functions that are not members of any class. The word friend must not appear in your program.

Any member functions you implement must never put an object into an invalid state, one that will cause a problem later on. (For example, bad things could come from placing a robot outside the arena.) Any function that has a reasonable way of indicating failure through its return value should do so. Constructors pose a special difficulty because they can't return a value. If a constructor can't do its job, we have it write an error message and exit the program with failure by calling exit(1);. (We haven't learned about throwing an exception to signal constructor failure.)

What you will turn in for this assignment is a zip file containing this one file and nothing more:

A text file named robots.cpp that contains the source code for the completed C++ program. This program must build successfully, and its correctness must not depend on undefined program behavior. Your program must not leak memory: Any object dynamically allocated during the execution of your program must be deleted (once only, of course) by the time your main routine returns normally.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Your assignment is to complete this c program skeleton to
Reference No:- TGS01032896

Expected delivery within 24 Hours