Class GameStats

java.lang.Object
net.royalur.stats.GameStats

public class GameStats extends Object
Statistics about a game of the Royal Game of Ur.
  • 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 of GameStatsTarget.
      moves - The number of moves made in the game, indexed by the ordinal of an element of GameStatsTarget.
      turns - The number of turns in the game, indexed by the ordinal of an element of GameStatsTarget.
      drama - The number of times the lead player swapped during each game, indexed by the ordinal of an element of GameStatsTarget.
      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

      public int getRolls(GameStatsTarget target)
      Gets the number of rolls counted for the target target.
      Parameters:
      target - The target to retrieve the statistic about.
      Returns:
      The number of rolls counted for the target target.
    • getRolls

      public int getRolls(PlayerType player)
      Gets the number of rolls performed by player.
      Parameters:
      player - The player to retrieve the statistic about.
      Returns:
      The number of rolls performed by player.
    • getMoves

      public int getMoves(GameStatsTarget target)
      Gets the number of moves counted for the target target.
      Parameters:
      target - The target to retrieve the statistic about.
      Returns:
      The number of moves counted for the target target.
    • getMoves

      public int getMoves(PlayerType player)
      Gets the number of moves made by player.
      Parameters:
      player - The player to retrieve the statistic about.
      Returns:
      The number of moves made by player.
    • getTurns

      public int getTurns(GameStatsTarget target)
      Gets the number of turns counted for the target target.
      Parameters:
      target - The target to retrieve the statistic about.
      Returns:
      The number of turns counted for the target target.
    • getTurns

      public int getTurns(PlayerType player)
      Gets the number of turns that player had.
      Parameters:
      player - The player to retrieve the statistic about.
      Returns:
      The number of turns that player had.
    • getDrama

      public int getDrama(GameStatsTarget target)
      Gets the drama counted for the target target.
      Parameters:
      target - The target to retrieve the statistic about.
      Returns:
      The drama counted for the target target.
    • getDrama

      public int getDrama(PlayerType player)
      Gets the number of times that player 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

      public static GameStats gather(Game game)
      Gathers statistics about the game game.
      Parameters:
      game - The game to gather statistics about.
      Returns:
      The statistics gathered about the game.
    • summarise

      public static GameStatsSummary summarise(GameStats... stats)
      Summarises the statistics of all the given game statistics from stats. 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.