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 logsdfen- the position plus the rolled dice for the side to moveclock- the game clock as of this turn, ornullfor an untimed game — seeTurnContext.Clock, whose presence is itself the "is this game timed?" answerlegalMoves- 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);nullmeans 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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe game clock as of this turn. -
Constructor Summary
ConstructorsConstructorDescriptionTurnContext(String gameId, String dfen, TurnContext.Clock clock, List<List<String>> legalMoves) Creates an instance of aTurnContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionclock()Returns the value of theclockrecord component.dfen()Returns the value of thedfenrecord component.final booleanIndicates whether some other object is "equal to" this one.gameId()Returns the value of thegameIdrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thelegalMovesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TurnContext
public TurnContext(String gameId, String dfen, TurnContext.Clock clock, List<List<String>> legalMoves) Creates an instance of aTurnContextrecord class.- Parameters:
gameId- the value for thegameIdrecord componentdfen- the value for thedfenrecord componentclock- the value for theclockrecord componentlegalMoves- the value for thelegalMovesrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
gameId
-
dfen
-
clock
-
legalMoves
Returns the value of thelegalMovesrecord component.- Returns:
- the value of the
legalMovesrecord component
-