Interface Player

All Known Implementing Classes:
BotPlayer, HumanPlayer

public sealed interface Player permits HumanPlayer, BotPlayer

Tic-tac-toe player interface for all players

// Create a human player
Player player = new HumanPlayer();

// Choose the next valid move on the game board
int validBoardLocation = player.nextMove(gameState);
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    nextMove(GameState gameState)
    Chooses the next valid move on the game board.
  • Method Details

    • nextMove

      int nextMove(GameState gameState)
      Chooses the next valid move on the game board.
      Parameters:
      gameState - the current state of the game
      Returns:
      the index of the next valid move on the board