Class ConnectXController
java.lang.Object
cpsc2150.extendedConnectX.controllers.ConnectXController
The controller class will handle communication between our View and our Model (
IGameBoard)
This is where you will write code
You will need to include your BoardPosition class, IGameBoard interface
and both of the IGameBoard implementations from Project 4.
If your code was correct you will not need to make any changes to your IGameBoard implementation class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant for the maximum number of players. -
Constructor Summary
ConstructorsConstructorDescriptionConnectXController(IGameBoard model, ConnectXView view, int np) This creates a controller for running the Extended ConnectX game -
Method Summary
Modifier and TypeMethodDescriptionvoidprocessButtonClick(int col) This processes a button click from the view.
-
Field Details
-
MAX_PLAYERS
public static final int MAX_PLAYERSConstant for the maximum number of players.
- See Also:
-
-
Constructor Details
-
ConnectXController
This creates a controller for running the Extended ConnectX game
- Parameters:
model- The board implementationview- The screen that is shownnp- The number of players for this game.- Post:
- [ the controller will respond to actions on the view using the model. ]
-
-
Method Details
-
processButtonClick
public void processButtonClick(int col) This processes a button click from the view.
- Parameters:
col- The column of the activated button- Post:
- [ will allow the player to place a token in the column if it is not full, otherwise it will display an error and allow them to pick again. Will check for a win as well. If a player wins it will allow for them to play another game hitting any button ]
-