Program that use classes game-arena-robot and player

Assignment Help C/C++ Programming
Reference no: EM13762817

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.

Reference no: EM13762817

Questions Cloud

Indifferent between accepting the project and rejecting : A project that provides annual cash flows of $28,500 for nine years costs $138,000 today. If the required return is 8 percent, the NPV for the project is $_____ . If the required return is 20 percent, the NPV is $______. At a discount rate of ___perc..
Shawshank redemption : The name of the movie is ShawShank Redemption. Please look at the movie and find 3 people who have started enterprise like business, services and one more enterprise person.
Create an order application : Create an Order application that prompts the employee for the number of burgers, fries, and sodas and then display the total, the tax (6.5%), and the final cost.
Duties in an actual crime scene : What materials will you use to lift these molds from the ground.
Program that use classes game-arena-robot and player : 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;
Provide a physical design that will meet the specifications : System design will include visual presentations of each of the following: modeling for specifications, data design, and user interface design. Each of the diagrams will visually represent your design - Provide a physical design that will meet the s..
Modify the inventory program to include an add button : Modify the Inventory Program to include an add button, a delete button, and a modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each ..
Journal entry to record depreciation expense-robillard inc : (a) Prepare the journal entry to record depreciation expense for the equipment in 2012. (b) Prepare the journal entry to record depreciation expense for the building in 2012.
Issues based on world health organization who : How do the causes of death in that country deteriorate one's health?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd