Record Class TurnAction

java.lang.Object
java.lang.Record
com.fortemate.dicechess.runtime.TurnAction
Record Components:
moves - the complete sequence of UCI micro-moves; an empty list plays nothing and is not a forced-pass command
offerDraw - whether to offer a draw together with the completed turn
isResign - whether to resign the game

public record TurnAction(List<String> moves, boolean offerDraw, boolean isResign) extends Record
A bot's response to a yourTurn delivery.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a turn action that does not offer a draw and does not resign.
    TurnAction(List<String> moves, boolean offerDraw)
    Creates a turn action that does not resign.
    TurnAction(List<String> moves, boolean offerDraw, boolean isResign)
    Creates an immutable turn action.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the isResign record component.
    Returns the value of the moves record component.
    boolean
    Returns the value of the offerDraw record component.
    static TurnAction
    Returns a turn action that resigns the game.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TurnAction

      public TurnAction(List<String> moves, boolean offerDraw, boolean isResign)
      Creates an immutable turn action.
      Throws:
      NullPointerException - if moves or one of its elements is null
    • TurnAction

      public TurnAction(List<String> moves)
      Creates a turn action that does not offer a draw and does not resign.
      Parameters:
      moves - the complete sequence of UCI micro-moves
    • TurnAction

      public TurnAction(List<String> moves, boolean offerDraw)
      Creates a turn action that does not resign.
      Parameters:
      moves - the complete sequence of UCI micro-moves
      offerDraw - whether to offer a draw together with the completed turn
  • Method Details

    • resign

      public static TurnAction resign()
      Returns a turn action that resigns the game.
      Returns:
      a resigning turn action
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • moves

      public List<String> moves()
      Returns the value of the moves record component.
      Returns:
      the value of the moves record component
    • offerDraw

      public boolean offerDraw()
      Returns the value of the offerDraw record component.
      Returns:
      the value of the offerDraw record component
    • isResign

      @SerializedName("resign") public boolean isResign()
      Returns the value of the isResign record component.
      Returns:
      the value of the isResign record component