Class RandomPlayer


  • public class RandomPlayer
    extends AIPlayer
    This class represents a player who makes random turns.
    • Constructor Detail

      • RandomPlayer

        public RandomPlayer()
        Creates a new Player.
    • Method Detail

      • calculateTurn

        public Turn calculateTurn​(int gameId,
                                  Board board,
                                  int playerId,
                                  Turn enemyTurn)
        The function returns the random turn which is chosen.
        Specified by:
        calculateTurn in class AIPlayer
        Parameters:
        gameId - the id of the game that is being played
        board - the current board state
        playerId - our player id
        enemyTurn - the turn played by the enemy
        Returns:
        The random turn which is chosen.
      • calculateTurn

        public Turn calculateTurn​(int gameId,
                                  Board board,
                                  int playerId,
                                  Turn enemyTurn,
                                  long maxTurnTime)
        The function returns the random turn which is chosen.
        Specified by:
        calculateTurn in class AIPlayer
        Parameters:
        gameId - the id of the game that is being played
        board - the current board state
        playerId - our player id
        enemyTurn - the turn played by the enemy
        maxTurnTime - the time we are given to calculate the turn in ms
        Returns:
        The random turn which is chosen.