Question: Java !! question about the C4Board method. I need to create specific number of rows and columns but I have no idea how. can you
Java !! question about the C4Board method.
I need to create specific number of rows and columns but I have no idea how.
can you help me with this method?
package C4; /kok k 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 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 * players, identified by the constants P1 (Player 1) and P2 (Player 2). P1 moves first in the first game, P2 moves * 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 PI = 1; /The number used to indicate Player 2/ public static final int P22; 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 sgls is less than four, throws an IllegalArgumentException. public C4Board (int rows, int cols) package C4; /kok k 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 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 * players, identified by the constants P1 (Player 1) and P2 (Player 2). P1 moves first in the first game, P2 moves * 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 PI = 1; /The number used to indicate Player 2/ public static final int P22; 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 sgls is less than four, throws an IllegalArgumentException. public C4Board (int rows, int cols)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
