Class MinimaxComponent
- java.lang.Object
-
- org.swtpra1.relativeterritoryplayer.MinimaxComponent
-
- Direct Known Subclasses:
MinimaxLeaf
,MinimaxNode
@Deprecated public abstract class MinimaxComponent extends java.lang.Object
Deprecated.only used for benchmarkingMinimaxComponent 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.
-
-
-
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 treeplayerId
- 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 itselfisMaximizing
- whether we are looking for the best turn for ourselves or our opponentalpha
- alpha valuebeta
- beta valueplayerId
- 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' playboardplayerId
- 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.
-
-