Question: What does the final, completed code of this class look like? It is used to compile ConnectFourCLI.java and ConnectFourTester.java package cs 1 3 0 2
What does the final, completed code of this class look like? It is used to compile ConnectFourCLI.java and ConnectFourTester.java
package csgame;
import csgameutil.GamePhase;
import csgameutil.Token;
import csgameutil.TokenGrid;
@code ConnectFour represents a twoplayer connection game involving a twodimensional grid of
@linkplain csgameutil.Token tokens When a @code ConnectFour game object is
constructed, several instance variables representing the game's state are initialized and
subsequently accessible, either directly or indirectly, via "getter" methods. Over time, the
values assigned to these instance variables should change so that they always reflect the
latest information about the state of the game. Most of these changes are described in the
project's
functional requirements.
public class ConnectFour
INSTANCE VARIABLES: You should NOT modify the instance variable declarations below.
You should also NOT add any additional instance variables. Static variables should
also NOT be added.
private int rows; number of grid rows
private int cols; number of grid columns
private Token grid; D array of tokens in the grid
private Token player; D array of player tokens length
private int numDropped; number of tokens dropped so far
private int lastDropRow; row index of the most recent drop
private int lastDropCol; column index of the most recent drop
private GamePhase phase; current game phase
CONSTRUCTOR
Constructs a @link csgame.ConnectFour game with a grid that has @code rowsmany
rows and @code colsmany columns. All of the game's instance variables are expected to
be initialized by this constructor as described in the project's
functional
requirements.
@param rows the number of grid rows
@param cols the number of grid columns
@throws IllegalArgumentException if the value supplied for @code rows or @code cols is
not supported. The following values are supported: @code rows and
@code cols
public ConnectFourint rows, int cols
replace the entire contents of this constructor with your implementation
throw new UnsupportedOperationExceptionconstructor: not yet implemented.";
ConnectFour
INSTANCE METHODS
Return the number of rows in the game's grid.
@return the number of rows
public int getRows
replace the entire contents of this method with your implementation
throw new UnsupportedOperationExceptiongetRows: not yet implemented.";
getRows
Return the number of columns in the game's grid.
@return the number of columns
public int getCols
replace the entire contents of this method with your implementation
throw new UnsupportedOperationExceptiongetCols: not yet implemented.";
getCols
Return whether @code row and @code col specify a location inside this game's grid.
@param row the position's row index
@param col the positions's column index
@return @code true if @code row and @code col specify a location inside this game's
grid and @code false otherwise
public boolean isInBoundsint row, int col
replace the entire contents of this method with your implementation
throw new UnsupportedOperationExceptionisInBounds: not yet implemented.";
isInBounds
Return the grid @linkplain csgameutil.Token token located at the specified position
or @code null if no token has been dropped into that position.
@param row the token's row index
@param col the token's column index
@return the grid token lo
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
