Package b2p.search.aima.minmax
Class MinMaxAlphaBetaSearch
- java.lang.Object
-
- b2p.search.aima.minmax.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 implementsCallablein order to allow for asynchronous execution.- Author:
- Alessandro Buldini, Alessandro Pomponio, Federico Zanini
- See Also:
- AIMA Java
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMinMaxAlphaBetaSearch(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.Integercall()Starts searching for the best decision to be made given an initial actionintmaxValue(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 functionintminValue(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
-
-
-
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 ofIterative Deepeningstrategystate- current state of the gameaction- initial action performed for this thread based on which the function's decision tree is createdplayer- 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 gameplayer- player that performs the movealpha- alpha valuebeta- beta valuedepth- 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 gameplayer- player that performs the movealpha- alpha valuebeta- beta valuedepth- 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:
callin interfacejava.util.concurrent.Callable<java.lang.Integer>- Returns:
- an integer containing the best heuristic value according to Iterative Deepening MiniMax search with alpha-beta pruning
-
-