Class AlphaBetaSearchTreeWithTranspositionTables


  • public class AlphaBetaSearchTreeWithTranspositionTables
    extends AlphaBetaSearchTree
    Implements the negamax search algorithm with alpha beta pruning and transposition table optimization.
    • Field Detail

      • transCount

        public final java.util.concurrent.atomic.AtomicLong transCount
    • Constructor Detail

      • AlphaBetaSearchTreeWithTranspositionTables

        public AlphaBetaSearchTreeWithTranspositionTables​(Evaluator evaluator,
                                                          int parallelism)
        Creates a search tree instance of negamax search with alpha beta pruning and transposition table optimization.
        Parameters:
        evaluator - the evaluator to use to evaluate board positions
        parallelism - see AlphaBetaPlayer.parallelism
    • Method Detail

      • negamax

        public ValuedTurn negamax​(Board board,
                                  int player,
                                  int depth,
                                  boolean presort,
                                  java.util.List<Turn> blacklist)
        Searches for the best turn using negamax search with alpha beta pruning and transposition tables.
        Overrides:
        negamax in class AlphaBetaSearchTree
        Parameters:
        board - the current state of the board
        player - the id (0 or 1) of the player on this layer
        depth - the maximum depth to be considered
        presort - whether to presort the moves and cut off
        blacklist - moves that should never be considered
        Returns:
        best possible turn with its evaluation
      • negamax

        protected ValuedTurn negamax​(Board board,
                                     int player,
                                     int depth,
                                     boolean presort,
                                     float alpha,
                                     float beta,
                                     java.util.List<Turn> blacklist)
        Searches for the best turn using negamax search with alpha beta pruning and transposition tables.
        Overrides:
        negamax in class AlphaBetaSearchTree
        Parameters:
        board - the current state of the board
        player - the id (0 or 1) of the player on this layer
        depth - the maximum depth to be considered
        presort - whether to presort the moves and cut off
        alpha - to determine whether better moves can be found
        beta - to determine whether better moves can be found
        blacklist - moves that should never be considered
        Returns:
        best possible turn with its evaluation
      • clearTranspositionTable

        public void clearTranspositionTable()