Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ackage cs 1 3 0 2 . game; 2 3 import cs 1 3 0 2 . gameutil.GamePhase; 4 import cs 1 3 0 2
ackage 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
functiona
l
requirements.
@param rows the number of grid rows
UU: F ConnectFour.java Top Gitmain Javal ws Abbrev
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started