Class MinMaxAlphaBetaSearch

  • All Implemented Interfaces:
    java.util.concurrent.Callable<java.lang.Integer>

    public class MinMaxAlphaBetaSearch
    extends java.lang.Object
    implements java.util.concurrent.Callable<java.lang.Integer>
    This class represents a Minimax search with alpha-beta pruning to be ran on a game state. It implements Callable in order to allow for asynchronous execution.
    Author:
    Alessandro Buldini, Alessandro Pomponio, Federico Zanini
    See Also:
    AIMA Java
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MinMaxAlphaBetaSearch​(IterativeDeepening strategy, IState state, IAction action, it.unibo.ai.didattica.competition.tablut.domain.State.Turn player)
      Builds a MinMaxAlphaBetaSearch object given the strategy, the current state of the game, the initial action and the player for whom the best decision has to be made
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Integer call()
      Starts searching for the best decision to be made given an initial action
      int maxValue​(IState state, it.unibo.ai.didattica.competition.tablut.domain.State.Turn player, int alpha, int beta, int depth)
      function needed to implement correctly the alpha-beta pruning: detects the maximum value between two possible states and prunes all the sub-trees that won't be explored according to the current heuristic function
      int minValue​(IState state, it.unibo.ai.didattica.competition.tablut.domain.State.Turn player, int alpha, int beta, int depth)
      function needed to implement correctly the alpha-beta pruning: detects the minimum value between two possible states and prunes all the sub-trees that won't be explored according to the current heuristic function
      • Methods inherited from class java.lang.Object

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

      • MinMaxAlphaBetaSearch

        protected MinMaxAlphaBetaSearch​(IterativeDeepening strategy,
                                        IState state,
                                        IAction action,
                                        it.unibo.ai.didattica.competition.tablut.domain.State.Turn player)
        Builds a MinMaxAlphaBetaSearch object given the strategy, the current state of the game, the initial action and the player for whom the best decision has to be made
        Parameters:
        strategy - instance of Iterative Deepening strategy
        state - current state of the game
        action - initial action performed for this thread based on which the function's decision tree is created
        player - player for whom the best decision has to be made
        See Also:
        IterativeDeepening
    • Method Detail

      • maxValue

        public int maxValue​(IState state,
                            it.unibo.ai.didattica.competition.tablut.domain.State.Turn player,
                            int alpha,
                            int beta,
                            int depth)
        function needed to implement correctly the alpha-beta pruning: detects the maximum value between two possible states and prunes all the sub-trees that won't be explored according to the current heuristic function
        Parameters:
        state - current state of the game
        player - player that performs the move
        alpha - alpha value
        beta - beta value
        depth - current depth
        Returns:
        maximum heuristic value between two states within the decision tree
        See Also:
        IState
      • minValue

        public int minValue​(IState state,
                            it.unibo.ai.didattica.competition.tablut.domain.State.Turn player,
                            int alpha,
                            int beta,
                            int depth)
        function needed to implement correctly the alpha-beta pruning: detects the minimum value between two possible states and prunes all the sub-trees that won't be explored according to the current heuristic function
        Parameters:
        state - current state of the game
        player - player that performs the move
        alpha - alpha value
        beta - beta value
        depth - current depth
        Returns:
        minimum heuristic value between two states within the decision tree
        See Also:
        IState
      • call

        public java.lang.Integer call()
        Starts searching for the best decision to be made given an initial action
        Specified by:
        call in interface java.util.concurrent.Callable<java.lang.Integer>
        Returns:
        an integer containing the best heuristic value according to Iterative Deepening MiniMax search with alpha-beta pruning