Package net.royalur.stats
Class GameStats
java.lang.Object
net.royalur.stats.GameStats
Statistics about a game of the Royal Game of Ur.
-
Constructor Summary
ModifierConstructorDescriptionprotected
GameStats
(boolean didLightWin, int[] rolls, int[] moves, int[] turns, int[] drama, int turnsInLead) Instantiates statistics about a game of the Royal Game of Ur. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the light player won the game.static GameStats
Gathers statistics about the gamegame
.int
getDrama
(PlayerType player) Gets the number of times thatplayer
took the lead from behind.int
getDrama
(GameStatsTarget target) Gets the drama counted for the targettarget
.int
getMoves
(PlayerType player) Gets the number of moves made byplayer
.int
getMoves
(GameStatsTarget target) Gets the number of moves counted for the targettarget
.double
Gets the percentage of turns that the winner held the lead before winning.int
getRolls
(PlayerType player) Gets the number of rolls performed byplayer
.int
getRolls
(GameStatsTarget target) Gets the number of rolls counted for the targettarget
.int
Gets the total count of drama in the game.int
Gets the total number of moves made by both players.int
Gets the total number of rolls performed by both players.int
Gets the total number of turns in the game.int
getTurns
(PlayerType player) Gets the number of turns thatplayer
had.int
getTurns
(GameStatsTarget target) Gets the number of turns counted for the targettarget
.int
Gets the number of turns that the winner held the lead before winning.static GameStatsSummary
Summarises the statistics of all the given game statistics fromstats
.
-
Constructor Details
-
GameStats
protected GameStats(boolean didLightWin, int[] rolls, int[] moves, int[] turns, int[] drama, int turnsInLead) Instantiates statistics about a game of the Royal Game of Ur.- Parameters:
didLightWin
- Whether the light player won the game.rolls
- The number of rolls performed in the game, indexed by the ordinal of an element ofGameStatsTarget
.moves
- The number of moves made in the game, indexed by the ordinal of an element ofGameStatsTarget
.turns
- The number of turns in the game, indexed by the ordinal of an element ofGameStatsTarget
.drama
- The number of times the lead player swapped during each game, indexed by the ordinal of an element ofGameStatsTarget
.turnsInLead
- The number of turns that the winner held the lead before winning the game.
-
-
Method Details
-
didLightWin
public boolean didLightWin()Returns whether the light player won the game.- Returns:
- Whether the light player won the game.
-
getRolls
Gets the number of rolls counted for the targettarget
.- Parameters:
target
- The target to retrieve the statistic about.- Returns:
- The number of rolls counted for the target
target
.
-
getRolls
Gets the number of rolls performed byplayer
.- Parameters:
player
- The player to retrieve the statistic about.- Returns:
- The number of rolls performed by
player
.
-
getMoves
Gets the number of moves counted for the targettarget
.- Parameters:
target
- The target to retrieve the statistic about.- Returns:
- The number of moves counted for the target
target
.
-
getMoves
Gets the number of moves made byplayer
.- Parameters:
player
- The player to retrieve the statistic about.- Returns:
- The number of moves made by
player
.
-
getTurns
Gets the number of turns counted for the targettarget
.- Parameters:
target
- The target to retrieve the statistic about.- Returns:
- The number of turns counted for the target
target
.
-
getTurns
Gets the number of turns thatplayer
had.- Parameters:
player
- The player to retrieve the statistic about.- Returns:
- The number of turns that
player
had.
-
getDrama
Gets the drama counted for the targettarget
.- Parameters:
target
- The target to retrieve the statistic about.- Returns:
- The drama counted for the target
target
.
-
getDrama
Gets the number of times thatplayer
took the lead from behind.- Parameters:
player
- The player to retrieve the statistic about.- Returns:
- The number of times that
player
took the lead from behind.
-
getTurnsInLead
public int getTurnsInLead()Gets the number of turns that the winner held the lead before winning.- Returns:
- The number of turns that the winner held the lead before winning.
-
getPercentInLead
public double getPercentInLead()Gets the percentage of turns that the winner held the lead before winning.- Returns:
- The percentage of turns that the winner held the lead before winning.
-
getTotalRolls
public int getTotalRolls()Gets the total number of rolls performed by both players.- Returns:
- The total number of rolls performed by both players.
-
getTotalMoves
public int getTotalMoves()Gets the total number of moves made by both players.- Returns:
- The total number of moves made by both players.
-
getTotalTurns
public int getTotalTurns()Gets the total number of turns in the game.- Returns:
- The total number of turns in the game.
-
getTotalDrama
public int getTotalDrama()Gets the total count of drama in the game.- Returns:
- The total count of drama in the game.
-
gather
Gathers statistics about the gamegame
.- Parameters:
game
- The game to gather statistics about.- Returns:
- The statistics gathered about the game.
-
summarise
Summarises the statistics of all the given game statistics fromstats
. This includes the generation of statistics such as sum, mean, variance, and standard deviation.- Parameters:
stats
- The statistics to summarise.- Returns:
- The summarised statistics of all the statistics in
stats
.
-