Package a5.ai

Class TranspositionTable<GameState>

java.lang.Object
a5.ai.TranspositionTable<GameState>
Type Parameters:
GameState - A type representing the state of a game.

public class TranspositionTable<GameState> extends Object
A transposition table for an arbitrary game. It maps a game state to a search depth and a heuristic evaluation of that state to the recorded depth. Unlike a conventional map abstraction, a state is associated with a depth, so that clients can look for states whose entry has at least the desired depth.
  • Method Details

    • size

      public int size()
      The number of entries in the transposition table.
    • getInfo

      public Maybe<TranspositionTable.StateInfo> getInfo(GameState state)
      Returns: the information in the transposition table for a given game state, package in an Optional. If there is no information in the table for this state, returns an empty Optional.
    • add

      public void add(GameState state, int depth, int value)
      Effect: Add a new entry in the transposition table for a given state and depth, or overwrite the existing entry for this state with the new depth and value. Requires: if overwriting an existing entry, the new depth must be greater than the old one.