Question: Implement the C4Board method plz /** * Represents the state of a Connect Four board on which multiple games can be played. The board consists

Implement the C4Board method plz

/** * Represents the state of a Connect Four board on which multiple games can be played. The board consists of a * rectangular grid of squares in which playing pieces can be placed. Squares are identified by their zero-based row and * column numbers, where rows are numbered starting with the bottom row, and columns are numbered by starting from the * leftmost column. * * Multiple games can be played on a single board. Whenever a new game begins, the board is empty. There are two * players, identified by the constants P1 (Player 1) and P2 (Player 2). P1 moves first in the first game, P2 moves * first in the second game, and so on in alternating fashion. * * A C4Board also keeps track of the outcomes of the games that have been played on it. It tracks the number of wins by * P1, the number of wins by P2, and the number of ties. It does not track games that were abandoned before being * completed. */ public class C4Board { /** The number used to indicate Player 1 */ public static final int P1 = 1;

/** The number used to indicate Player 2 */ public static final int P2 = 2;

/** The number used to indicate a tie */ public static final int TIE = 3;

/** * Creates a C4Board with the specified number of rows and columns. There should be no pieces on the board and it * should be player 1's turn to move. * * However, if either rows or cols is less than four, throws an IllegalArgumentException. */ public C4Board (int rows, int cols)

{

}

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!