s3games.player

## Class MiniMaxPlayer

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

- Direct Known Subclasses:
    MiniMaxStochasticPlayer

      public class MiniMaxPlayer
      extends Player

  Minimax player searches the game tree in a breadth-first search manner, taking the best result on the players move and the worst result on the opponent move into account.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `MiniMaxPlayer.Leaf` leaf that is waiting to be opened
    `class` | `MiniMaxPlayer.Node` holds the information about the state, the best/worst value (depending on the node type, and the depth that is used when propagating the values from the leaf nodes up the search tree
    `static class` | `MiniMaxPlayer.NodeType` opened nodes are MAX if it is this player's turn, states when it is opponent's turn are MIN

    - ### Nested classes/interfaces inherited from class s3games.player.Player

      `Player.boardType, Player.playerType`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `mmRatio` the percentage each of the moves will be used

    - ### Fields inherited from class s3games.player.Player

      `maxNodes, number`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MiniMaxPlayer(GameSpecification specs, Heuristic heuristic)` create a minimax player for the specified game with the heuristic provided

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.HashMap<Move,GameState>` | `expand(GameState state, java.util.HashSet<Move> moves, double ratio)` the only difference to standard minimax player is that here we ignore some of the moves when we expand a move
    `Move` | `move(GameState state, java.util.ArrayList<Move> allowedMoves)` make one minimax move: try to expand the game tree as far as it gets, evaluating the rest with the heuristic when the time is used up
    `MiniMaxPlayer.Node` | `newNode(MiniMaxPlayer.Node previous, GameState gs)` creates a new node that was reached by performing some move from the previous node.

    - ### Methods inherited from class s3games.player.Player

      `isComputer, otherMoved, ratioTimeLeft, setMaximumNumberOfNodes, setMaxTime, setPlayerNumber, startMove, timeUsed`

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

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

- - ### Field Detail

    - #### mmRatio

          public static double mmRatio

      the percentage each of the moves will be used

  - ### Constructor Detail

    - #### MiniMaxPlayer

          public MiniMaxPlayer(GameSpecification specs,
                       Heuristic heuristic)

      create a minimax player for the specified game with the heuristic provided

  - ### Method Detail

    - #### newNode

          public MiniMaxPlayer.Node newNode(MiniMaxPlayer.Node previous,
                                   GameState gs)
                                     throws java.lang.Exception

      creates a new node that was reached by performing some move from the previous node. the method opens the nodes and adds all resulting states to the leaves list
      Throws:
        `java.lang.Exception`

    - #### expand

          public java.util.HashMap<Move,GameState> expand(GameState state,
                                                 java.util.HashSet<Move> moves,
                                                 double ratio)
                                                   throws java.lang.Exception

      the only difference to standard minimax player is that here we ignore some of the moves when we expand a move
      Throws:
        `java.lang.Exception`

    - #### move

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

      make one minimax move: try to expand the game tree as far as it gets, evaluating the rest with the heuristic when the time is used up
      Specified by:
        `move` in class `Player`
      Throws:
        `java.lang.Exception`