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
ConstructorsModifierConstructorDescriptionprotectedGameStats(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 TypeMethodDescriptionbooleanReturns whether the light player won the game.static GameStatsGathers statistics about the gamegame.intgetDrama(PlayerType player) Gets the number of times thatplayertook the lead from behind.intgetDrama(GameStatsTarget target) Gets the drama counted for the targettarget.intgetMoves(PlayerType player) Gets the number of moves made byplayer.intgetMoves(GameStatsTarget target) Gets the number of moves counted for the targettarget.doubleGets the percentage of turns that the winner held the lead before winning.intgetRolls(PlayerType player) Gets the number of rolls performed byplayer.intgetRolls(GameStatsTarget target) Gets the number of rolls counted for the targettarget.intGets the total count of drama in the game.intGets the total number of moves made by both players.intGets the total number of rolls performed by both players.intGets the total number of turns in the game.intgetTurns(PlayerType player) Gets the number of turns thatplayerhad.intgetTurns(GameStatsTarget target) Gets the number of turns counted for the targettarget.intGets the number of turns that the winner held the lead before winning.static GameStatsSummarySummarises 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 thatplayerhad.- Parameters:
player- The player to retrieve the statistic about.- Returns:
- The number of turns that
playerhad.
-
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 thatplayertook the lead from behind.- Parameters:
player- The player to retrieve the statistic about.- Returns:
- The number of times that
playertook 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.
-