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
Modifier and TypeFieldDescriptionfinal boolean
final FastSimpleBoard
final boolean
final FastSimplePlayer
boolean
boolean
final FastSimplePlayer
static final int
static final int
static final int
static final int
int
final boolean
final GameSettings
final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
applyMove
(int pathIndex) void
applyRoll
(int rollValue, FastSimpleMoveList moveList) void
void
copyFrom
(FastSimpleGame other) void
static boolean
didMoveCapturePiece
(int moveStatus) static boolean
didMoveGrantExtraRoll
(int moveStatus) static boolean
didMoveIntroducePiece
(int moveStatus) static boolean
didMoveScorePiece
(int moveStatus) void
findAvailableMoves
(FastSimpleMoveList moveList) PopulatesmoveList
with all available moves in the current state of the game.getPlayer
(boolean isLight) boolean
Checks whether moving a piece is expected.boolean
Checks whether a roll of the dice is expected.reversePlayers
(FastSimpleGame output) Copies the state of this game with the players swapped.boolean
shouldGrantRoll
(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
PopulatesmoveList
with 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
-