Package net.royalur.rules.simple.fast
Class FastSimpleGame
java.lang.Object
net.royalur.rules.simple.fast.FastSimpleGame
A simple game that is optimised for speed.
This speed comes at the cost of error checking,
convenience, and tracking of game history.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanfinal FastSimpleBoardfinal booleanfinal FastSimplePlayerbooleanbooleanfinal FastSimplePlayerstatic final intstatic final intstatic final intstatic final intintfinal booleanfinal GameSettingsfinal int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintapplyMove(int pathIndex) voidapplyRoll(int rollValue, FastSimpleMoveList moveList) voidvoidcopyFrom(FastSimpleGame other) voidstatic booleandidMoveCapturePiece(int moveStatus) static booleandidMoveGrantExtraRoll(int moveStatus) static booleandidMoveIntroducePiece(int moveStatus) static booleandidMoveScorePiece(int moveStatus) voidfindAvailableMoves(FastSimpleMoveList moveList) PopulatesmoveListwith all available moves in the current state of the game.getPlayer(boolean isLight) booleanChecks whether moving a piece is expected.booleanChecks whether a roll of the dice is expected.reversePlayers(FastSimpleGame output) Copies the state of this game with the players swapped.booleanshouldGrantRoll(int destTileIndex, int capturedPiece) toString()
-
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
-
areRosettesSafe
public final boolean areRosettesSafe -
rosettesGrantExtraRoll
public final boolean rosettesGrantExtraRoll -
capturesGrantExtraRoll
public final boolean capturesGrantExtraRoll -
startingPieceCount
public final int startingPieceCount -
board
-
light
-
dark
-
isLightTurn
public boolean isLightTurn -
rollValue
public int rollValue -
isFinished
public boolean isFinished
-
-
Constructor Details
-
FastSimpleGame
-
-
Method Details
-
getPlayer
-
getTurnPlayer
-
copyFrom
-
copyFrom
-
copyFrom
-
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
PopulatesmoveListwith all available moves in the current state of the game. -
applyRoll
-
shouldGrantRoll
public boolean shouldGrantRoll(int destTileIndex, int capturedPiece) -
applyMove
public int applyMove(int pathIndex) -
reversePlayers
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
-