Class MinimaxComponent

  • Direct Known Subclasses:
    MinimaxLeaf, MinimaxNode

    @Deprecated
    public abstract class MinimaxComponent
    extends java.lang.Object
    Deprecated.
    only used for benchmarking
    MinimaxComponent which has a turn, the resulting board after turn was made, the evaluation of the board. (by min/max of his children or by realtive territoric heuristic
    • Constructor Summary

      Constructors 
      Constructor Description
      MinimaxComponent​(Turn turn, Board board)
      Deprecated.
      Constructor of a MinimaxComponent
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static int[][] copy2dArray​(int[][] array)
      Deprecated.
      Copy a 2-dimensional array because Arrays.copyOf doesn't work with 2d arrays.
      Turn getBestTurn​(int depth, int playerId)
      Deprecated.
      Calls minimax on himself and returns the best turn based on the evaluation values of his children.
      int getBoardValue​(int[][] squares, int playerId)
      Deprecated.
      Calculate the value of a board based on relative territory heuristic.
      abstract java.util.List<MinimaxComponent> getChildren()
      Deprecated.
       
      int getEvaluation()
      Deprecated.
       
      abstract boolean isLeaf()
      Deprecated.
       
      int minimax​(int depth, boolean isMaximizing, int alpha, int beta, int playerId)
      Deprecated.
      Minimax algorithm with Alpha-Beta-pruning to calculate a numeric value for the quality of a sequence of turns.
      void printBoard​(int[][] board)
      Deprecated.
      Prints array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MinimaxComponent

        public MinimaxComponent​(Turn turn,
                                Board board)
        Deprecated.
        Constructor of a MinimaxComponent
        Parameters:
        turn - aa
        board - bb
    • Method Detail

      • isLeaf

        public abstract boolean isLeaf()
        Deprecated.
      • getChildren

        public abstract java.util.List<MinimaxComponent> getChildren()
        Deprecated.
      • getBestTurn

        public Turn getBestTurn​(int depth,
                                int playerId)
        Deprecated.
        Calls minimax on himself and returns the best turn based on the evaluation values of his children. If the evaluation offers multiple best turns we choose one by random
        Parameters:
        depth - depth of tree
        playerId - id of player
        Returns:
        best possible turn based on territory heuristic evaluation
      • minimax

        public int minimax​(int depth,
                           boolean isMaximizing,
                           int alpha,
                           int beta,
                           int playerId)
        Deprecated.
        Minimax algorithm with Alpha-Beta-pruning to calculate a numeric value for the quality of a sequence of turns.
        Parameters:
        depth - allows to limit how deep the tree shall be explored, this is otherwise limited by the generation of the tree itself
        isMaximizing - whether we are looking for the best turn for ourselves or our opponent
        alpha - alpha value
        beta - beta value
        playerId - playerId of player, necessary for getBoardValue
      • getBoardValue

        public int getBoardValue​(int[][] squares,
                                 int playerId)
        Deprecated.
        Calculate the value of a board based on relative territory heuristic.
        Parameters:
        squares - the 'real' playboard
        playerId - the board value is based on the playerId of player
        Returns:
        value of board = number of squares i reach faster - number of squares my enemy reaches faster
      • copy2dArray

        public static int[][] copy2dArray​(int[][] array)
        Deprecated.
        Copy a 2-dimensional array because Arrays.copyOf doesn't work with 2d arrays.
        Parameters:
        array - array to be copied
        Returns:
        copied array
      • printBoard

        public void printBoard​(int[][] board)
        Deprecated.
        Prints array.
        Parameters:
        board - array to be printed
      • getEvaluation

        public int getEvaluation()
        Deprecated.