Question: C# help with this code... public class Game { public Game(int numPlayers, int numRounds) { /*Game's constructor. This is called with the number of players

C# help with this code...

public class Game {

public Game(int numPlayers, int numRounds) {

/*Game's constructor. This is called with the number of players in the game and the number of rounds that will be played. This method:

+Creates a numPlayers size array of TankController (which is stored as a private field of Game)

+Sets another private field to the number of rounds that will be played

+Creates an array or list collection of Attack (if it's an array, a suitably large array should be created for it, e.g. 100).

No objects of type TankController or Attack should be created here; only the arrays.

-numPlayers will always be between 2 and 8 (inclusive)

-numRounds will always be between 1 and 100 (inclusive)*/

}

public void CreatePlayer(int playerNum, TankController player) {

This method takes a player number (guaranteed to be between 1 and the number of players) and sets the appropriate field in Game's TankController array to player. Note that the value of playerNum is indexed from 1 while arrays are indexed from 0, so CreatePlayer() will need to account for this.

}

public TankController GetPlayerNumber(int playerNum){

//This method takes a player number (playerNum, between 1 and the number of players) and returns the appropriate TankController from the TankController array. Again, note that arrays are indexed from 0 while playerNum is indexed from 1.

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!