Class Player

java.lang.Object
rs.ac.bg.etf.players.Player

public abstract class Player
extends java.lang.Object
Abstract Player class. Represents an agent. Should be subclassed.
Author:
Vladimir, Adrian
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  Player.Move
    Possible moves available for each player in a single match.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.List<Player.Move> opponentMoves
    List of opponent moves.
  • Constructor Summary

    Constructors 
    Constructor Description
    Player()  
  • Method Summary

    Modifier and Type Method Description
    void addOpponentMove​(Player.Move move)
    Adds opponent's move to a opponentMoves list.
    java.lang.String getName()  
    abstract Player.Move getNextMove()
    Abstract method for determining the next player's move.
    Should be overriden.
    void resetPlayerState()
    Clears the opponentMoves list.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • resetPlayerState

      public void resetPlayerState()
      Clears the opponentMoves list. Resets player's state. Invoked by the game engine after each match.
      Should be overriden.
      Must be called by an overriden method.
    • addOpponentMove

      public void addOpponentMove​(Player.Move move)
      Adds opponent's move to the opponentMoves list. Invoked by the Match object.
      Parameters:
      move - move to be added
    • getName

      public java.lang.String getName()
      Returns:
      returns a simple player's name
    • getNextMove

      public abstract Player.Move getNextMove()
      Abstract method for determining the next player's move.
      Should be overriden.
      Returns:
      returns the player's next move