Class FastSimpleGame

java.lang.Object
net.royalur.rules.simple.fast.FastSimpleGame

public class FastSimpleGame extends Object
A simple game that is optimised for speed. This speed comes at the cost of error checking, convenience, and tracking of game history.
  • Field Details

    • MOVE_STATUS_INTRODUCED

      public static final int MOVE_STATUS_INTRODUCED
      See Also:
    • MOVE_STATUS_SCORED

      public static final int MOVE_STATUS_SCORED
      See Also:
    • MOVE_STATUS_CAPTURED

      public static final int MOVE_STATUS_CAPTURED
      See Also:
    • MOVE_STATUS_GRANTED_EXTRA_ROLL

      public static final int MOVE_STATUS_GRANTED_EXTRA_ROLL
      See Also:
    • settings

      public final GameSettings settings
    • areRosettesSafe

      public final boolean areRosettesSafe
    • rosettesGrantExtraRoll

      public final boolean rosettesGrantExtraRoll
    • capturesGrantExtraRoll

      public final boolean capturesGrantExtraRoll
    • startingPieceCount

      public final int startingPieceCount
    • board

      public final FastSimpleBoard board
    • light

      public final FastSimplePlayer light
    • dark

      public final FastSimplePlayer dark
    • isLightTurn

      public boolean isLightTurn
    • rollValue

      public int rollValue
    • isFinished

      public boolean isFinished
  • Constructor Details

    • FastSimpleGame

      public FastSimpleGame(GameSettings settings)
  • Method Details

    • getPlayer

      public FastSimplePlayer getPlayer(boolean isLight)
    • getTurnPlayer

      public FastSimplePlayer getTurnPlayer()
    • copyFrom

      public void copyFrom(FastSimpleGame other)
    • copyFrom

      public void copyFrom(GameState state)
    • copyFrom

      public void copyFrom(Game game)
    • isWaitingForRoll

      public boolean isWaitingForRoll()
      Checks whether a roll of the dice is expected. This may return true when the game has already finished. Therefore, if the game may have finished, you should check that first.
      Returns:
      Whether a roll of the dice is expected.
    • isWaitingForMove

      public boolean isWaitingForMove()
      Checks whether moving a piece is expected. This may return true when the game has already finished. Therefore, if the game may have finished, you should check that first.
      Returns:
      Whether moving a piece is expected.
    • findAvailableMoves

      public void findAvailableMoves(FastSimpleMoveList moveList)
      Populates moveList with all available moves in the current state of the game.
    • applyRoll

      public void applyRoll(int rollValue, FastSimpleMoveList moveList)
    • shouldGrantRoll

      public boolean shouldGrantRoll(int destTileIndex, int capturedPiece)
    • applyMove

      public int applyMove(int pathIndex)
    • reversePlayers

      public FastSimpleGame reversePlayers(@Nullable FastSimpleGame output)
      Copies the state of this game with the players swapped. If output is provided, the copy is placed into it. Otherwise, a new game is created.
      Parameters:
      output - An optional game to update with the reversed state of this game, instead of creating a new game.
      Returns:
      A game with the reversed state of this game.
    • didMoveIntroducePiece

      public static boolean didMoveIntroducePiece(int moveStatus)
    • didMoveScorePiece

      public static boolean didMoveScorePiece(int moveStatus)
    • didMoveCapturePiece

      public static boolean didMoveCapturePiece(int moveStatus)
    • didMoveGrantExtraRoll

      public static boolean didMoveGrantExtraRoll(int moveStatus)
    • toString

      public String toString()
      Overrides:
      toString in class Object