Record Class TurnContext

java.lang.Object
java.lang.Record
lv.id.jc.dicechess.runtime.TurnContext
Record Components:
gameId - the game's id — lets a strategy keep per-game state (a search tree, a transposition table) or tag its own logs
dfen - the position plus the rolled dice for the side to move
clock - the game clock as of this turn, or null for an untimed game — see TurnContext.Clock, whose presence is itself the "is this game timed?" answer
legalMoves - every complete legal turn, each as its sequence of UCI micro-moves — the server's prefix tree, already walked root-to-leaf, so a strategy with no engine of its own can play by picking one of these directly. An empty list is a genuine auto-pass (the roll has no legal move); null means the legal moves are not known — either the envelope omitted them (past the server's inline cap) and this handler was not given a play-api base URL to fetch the fallback from, or that fetch failed

public record TurnContext(String gameId, String dfen, TurnContext.Clock clock, List<List<String>> legalMoves) extends Record
What a strategy is told about the turn it must play — everything the webhook envelope's state carries that a move-choosing function plausibly needs, beyond the position itself.
  • Constructor Details

    • TurnContext

      public TurnContext(String gameId, String dfen, TurnContext.Clock clock, List<List<String>> legalMoves)
      Creates an instance of a TurnContext record class.
      Parameters:
      gameId - the value for the gameId record component
      dfen - the value for the dfen record component
      clock - the value for the clock record component
      legalMoves - the value for the legalMoves record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • gameId

      public String gameId()
      Returns the value of the gameId record component.
      Returns:
      the value of the gameId record component
    • dfen

      public String dfen()
      Returns the value of the dfen record component.
      Returns:
      the value of the dfen record component
    • clock

      public TurnContext.Clock clock()
      Returns the value of the clock record component.
      Returns:
      the value of the clock record component
    • legalMoves

      public List<List<String>> legalMoves()
      Returns the value of the legalMoves record component.
      Returns:
      the value of the legalMoves record component