Record Class DoublingState

java.lang.Object
java.lang.Record
com.fortemate.dicechess.runtime.DoublingState
Record Components:
currency - the stake currency, exactly PLAY_CREDIT
initialStake - the initial stake in whole currency units
currentStake - the current active stake in whole currency units
cubeValue - the doubling cube multiplier (1, 2, 4, 8, 16, 32, 64)
cubeOwner - the seat owning the cube, or null if centered
maximumMultiplier - the configured maximum multiplier cap (2, 4, 8, 16, 32, 64)
mayOfferDouble - whether the current decision actor is eligible to offer a double
turnSeat - the seat whose turn it is (survives out-of-turn response phase)
decision - the pending doubling decision, or null if no decision is pending

public record DoublingState(String currency, long initialStake, long currentStake, int cubeValue, String cubeOwner, int maximumMultiplier, boolean mayOfferDouble, String turnSeat, DoublingDecision decision) extends Record
The doubling state of a staked game.

A centered cube (cubeValue == 1) is unowned (cubeOwner == null); a doubled cube is owned by the seat that last accepted a double.

  • Field Details

    • VALID_CUBE_VALUES

      public static final Set<Integer> VALID_CUBE_VALUES
      Permitted doubling cube values.
    • VALID_MULTIPLIERS

      public static final Set<Integer> VALID_MULTIPLIERS
      Permitted maximum multiplier caps.
    • CURRENCY_PLAY_CREDIT

      public static final String CURRENCY_PLAY_CREDIT
      The required currency name for staked games.
      See Also:
  • Constructor Details

    • DoublingState

      public DoublingState(String currency, long initialStake, long currentStake, int cubeValue, String cubeOwner, int maximumMultiplier, boolean mayOfferDouble, String turnSeat, DoublingDecision decision)
      Creates a validated doubling state.
  • 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. 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.
    • currency

      public String currency()
      Returns the value of the currency record component.
      Returns:
      the value of the currency record component
    • initialStake

      public long initialStake()
      Returns the value of the initialStake record component.
      Returns:
      the value of the initialStake record component
    • currentStake

      public long currentStake()
      Returns the value of the currentStake record component.
      Returns:
      the value of the currentStake record component
    • cubeValue

      public int cubeValue()
      Returns the value of the cubeValue record component.
      Returns:
      the value of the cubeValue record component
    • cubeOwner

      public String cubeOwner()
      Returns the value of the cubeOwner record component.
      Returns:
      the value of the cubeOwner record component
    • maximumMultiplier

      public int maximumMultiplier()
      Returns the value of the maximumMultiplier record component.
      Returns:
      the value of the maximumMultiplier record component
    • mayOfferDouble

      public boolean mayOfferDouble()
      Returns the value of the mayOfferDouble record component.
      Returns:
      the value of the mayOfferDouble record component
    • turnSeat

      public String turnSeat()
      Returns the value of the turnSeat record component.
      Returns:
      the value of the turnSeat record component
    • decision

      public DoublingDecision decision()
      Returns the value of the decision record component.
      Returns:
      the value of the decision record component