Class Calculator

java.lang.Object
cz.matfyz.rudad.joker.calculator.Calculator

public class Calculator extends Object
The main class that performs the odds calculations for the Joker calculator application.
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Creates a Calculator object based on the specified CalculatorArgs object.
    Creates a Calculator object with the specified players.
    Calculator(List<Player> players, ArrayList<Card> board)
    Creates a Calculator object with the specified players and board cards.
    Calculator(List<Player> players, List<Card> deadCards)
    Creates a Calculator object with the specified players and dead cards.
    Calculator(List<Player> players, List<Card> board, List<Card> deadCards)
    Creates a Calculator object with the specified players, board cards, and dead cards.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    Performs the calculation of the probabilities of winning and tying for each player.
    Returns the array of board cards in the calculator.
    Returns the array of dead cards in the calculator.
    Returns the array of players in the calculator.
    static void
    main(String[] args)
    The entry point for the Joker Calculator application.
    void
    Prints a summary of the odds of winning and tying for each player.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

  • Constructor Details Link icon

    • Calculator Link icon

      public Calculator(List<Player> players) throws IllegalArgumentException
      Creates a Calculator object with the specified players.
      Parameters:
      players - the list of players
      Throws:
      IllegalArgumentException - if the number of players is invalid
    • Calculator Link icon

      public Calculator(List<Player> players, ArrayList<Card> board) throws IllegalArgumentException
      Creates a Calculator object with the specified players and board cards.
      Parameters:
      players - the list of players
      board - the list of board cards
      Throws:
      IllegalArgumentException - if the number of players or board cards is invalid
    • Calculator Link icon

      public Calculator(List<Player> players, List<Card> deadCards) throws IllegalArgumentException
      Creates a Calculator object with the specified players and dead cards.
      Parameters:
      players - the list of players
      deadCards - the list of dead cards
      Throws:
      IllegalArgumentException - if the number of players or dead cards is invalid
    • Calculator Link icon

      public Calculator(CalculatorArgs args) throws IllegalArgumentException
      Creates a Calculator object based on the specified CalculatorArgs object.
      Parameters:
      args - the CalculatorArgs object containing the command-line arguments
      Throws:
      IllegalArgumentException - if the arguments are invalid
    • Calculator Link icon

      public Calculator(List<Player> players, List<Card> board, List<Card> deadCards) throws IllegalArgumentException
      Creates a Calculator object with the specified players, board cards, and dead cards.
      Parameters:
      players - the list of players
      board - the list of board cards
      deadCards - the list of dead cards
      Throws:
      IllegalArgumentException - if the number of players, board cards, or dead cards is invalid, or if the cards are not unique
  • Method Details Link icon

    • main Link icon

      public static void main(String[] args)
      The entry point for the Joker Calculator application.
      Parameters:
      args - the command-line arguments
    • getPlayers Link icon

      public Player[] getPlayers()
      Returns the array of players in the calculator.
      Returns:
      an array of players
    • getBoard Link icon

      public Card[] getBoard()
      Returns the array of board cards in the calculator.
      Returns:
      an array of board cards
    • getDeadCards Link icon

      public Card[] getDeadCards()
      Returns the array of dead cards in the calculator.
      Returns:
      an array of dead cards
    • calculate Link icon

      public Calculator calculate()
      Performs the calculation of the probabilities of winning and tying for each player.
      Returns:
      the Calculator object for method chaining
      Throws:
      IllegalStateException - if the number of board cards is invalid
    • printOdds Link icon

      public void printOdds()
      Prints a summary of the odds of winning and tying for each player.