Class ConnectXController

java.lang.Object
cpsc2150.extendedConnectX.controllers.ConnectXController

public class ConnectXController extends Object
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 Details

    • MAX_PLAYERS

      public static final int MAX_PLAYERS

      Constant for the maximum number of players.

      See Also:
  • Constructor Details

    • ConnectXController

      public ConnectXController(IGameBoard model, ConnectXView view, int np)

      This creates a controller for running the Extended ConnectX game

      Parameters:
      model - The board implementation
      view - The screen that is shown
      np - 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 ]