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

    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

    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

    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

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

  • Constructor Details

    • Calculator

      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

      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

      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

      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

      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

    • main

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

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

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

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

      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

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