Interface GameStateEncoding

All Known Implementing Classes:
FinkelGameStateEncoding, SimpleGameStateEncoding

public interface GameStateEncoding
Encodes the state of a game to a small binary key.
  • Method Details

    • encodeGameState

      long encodeGameState(FastSimpleGame game)
      Encode the given game state to a binary key.
      Parameters:
      game - The game to encode.
      Returns:
      The game state encoded as a binary key.
    • encodeSymmetricalGameState

      default long encodeSymmetricalGameState(FastSimpleGame game, @Nullable FastSimpleGame tempGame)
      Encode the given game state to a binary key that is always encoded as the light player. States where it is the dark player's turn will be reversed before being encoded. If a temp game is not provided, and it is the dark player's turn, then a temp game will be constructed.
      Parameters:
      game - The game to encode.
      tempGame - An optional temporary game to use to reverse the players in game.
      Returns:
      The game state encoded as a symmetrical binary key.
    • calcUpperKey

      static int calcUpperKey(long key)
      Gets the upper 32 bits of the given key.
    • calcLowerKey

      static int calcLowerKey(long key)
      Gets the lower 32 bits of the given key.
    • createSimple

      static GameStateEncoding createSimple(GameSettings settings)
      Creates an encoding for a simple set of rules.