s3games.player

## Class Player

- java.lang.Object
- - s3games.player.Player

- Direct Known Subclasses:
    AbstractMonteCarloPlayer, AStarPlayer, BreadthFirstSearchPlayer, CameraPlayer, DepthFirstSearchPlayer, MiniMaxPlayer, MousePlayer, RandomGeneralPlayer

      public abstract class Player
      extends java.lang.Object

  A general super-class for all player types. They should all provide move() method.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Player.boardType` the type of game board where the game can be played
    `static class` | `Player.playerType` the types of players

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `maxNodes` how many nodes at most are allowed to be opened
    `protected int` | `number` the player number (1,2,...)

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Player()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isComputer()` those players that are not computer players should override this
    `abstract Move` | `move(GameState state, java.util.ArrayList<Move> allowedMoves)` make a single move
    `void` | `otherMoved(Move move, GameState newState)` information about the move made by another player - override if needed
    `double` | `ratioTimeLeft()` what is the ratio of the remaining time, i.e.
    `void` | `setMaximumNumberOfNodes(long maxNodes)` the number of nodes that can be opened in one move
    `void` | `setMaxTime(long maxTime)` configure the maximum time available for one move
    `void` | `setPlayerNumber(int pn)` store the player number
    `void` | `startMove()` record the time when the move is starting
    `long` | `timeUsed()` how much time has been used since the start of this move

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### number

          protected int number

      the player number (1,2,...)

    - #### maxNodes

          protected long maxNodes

      how many nodes at most are allowed to be opened

  - ### Constructor Detail

    - #### Player

          public Player()

  - ### Method Detail

    - #### move

          public abstract Move move(GameState state,
                  java.util.ArrayList<Move> allowedMoves)
                             throws java.lang.Exception

      make a single move
      Throws:
        `java.lang.Exception`

    - #### otherMoved

          public void otherMoved(Move move,
                        GameState newState)

      information about the move made by another player - override if needed

    - #### startMove

          public void startMove()

      record the time when the move is starting

    - #### setMaxTime

          public void setMaxTime(long maxTime)

      configure the maximum time available for one move

    - #### timeUsed

          public long timeUsed()

      how much time has been used since the start of this move

    - #### ratioTimeLeft

          public double ratioTimeLeft()

      what is the ratio of the remaining time, i.e. 0.2 if only 1/5th time is remaining

    - #### isComputer

          public boolean isComputer()

      those players that are not computer players should override this

    - #### setPlayerNumber

          public void setPlayerNumber(int pn)

      store the player number

    - #### setMaximumNumberOfNodes

          public void setMaximumNumberOfNodes(long maxNodes)

      the number of nodes that can be opened in one move