Package org.swtpra1.random
Class RandomPlayer
- java.lang.Object
-
- org.swtpra1.AIPlayer
-
- org.swtpra1.random.RandomPlayer
-
public class RandomPlayer extends AIPlayer
This class represents a player who makes random turns.
-
-
Field Summary
-
Fields inherited from class org.swtpra1.AIPlayer
BUFFER_TIME, DEFAULT_MAX_TURN_TIME
-
-
Constructor Summary
Constructors Constructor Description RandomPlayer()
Creates a new Player.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Turn
calculateTurn(int gameId, Board board, int playerId, Turn enemyTurn)
The function returns the random turn which is chosen.Turn
calculateTurn(int gameId, Board board, int playerId, Turn enemyTurn, long maxTurnTime)
The function returns the random turn which is chosen.-
Methods inherited from class org.swtpra1.AIPlayer
generateQueensMoves, getAllPossibleTurns, newGame
-
-
-
-
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 classAIPlayer
- Parameters:
gameId
- the id of the game that is being playedboard
- the current board stateplayerId
- our player idenemyTurn
- 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 classAIPlayer
- Parameters:
gameId
- the id of the game that is being playedboard
- the current board stateplayerId
- our player idenemyTurn
- the turn played by the enemymaxTurnTime
- the time we are given to calculate the turn in ms- Returns:
- The random turn which is chosen.
-
-