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

public class Player extends Object
Represents a player in a poker game.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Player(Card... cards)
    Constructs a player with a hand given by the cards.
    Player(String... cardAliases)
    Constructs a player with a hand given by the aliases of the cards.
    Player(List<Card> cards)
    Constructs a player with a hand given by the cards.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Increments the number of ties (splits) for the player.
    void
    Increments the number of wins for the player.
    Returns the cards held by the player.
    int
    Returns the number of ties (splits) for the player.
    int
    Returns the number of wins for the player.
    double
    Returns the tie probability of the player.
    double
    Returns the win probability of the player.
    void
    setTieProbability(int numberOfHands)
    Sets the tie probability of the player based on the total number of hands.
    void
    setWinProbability(int numberOfHands)
    Sets the win probability of the player based on the total number of hands.
    Returns a string representation of the player's cards.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Player

      public Player(String... cardAliases) throws IllegalArgumentException
      Constructs a player with a hand given by the aliases of the cards.
      Parameters:
      cardAliases - the aliases of the cards
      Throws:
      IllegalArgumentException - if the card aliases are invalid
    • Player

      public Player(Card... cards)
      Constructs a player with a hand given by the cards.
      Parameters:
      cards - the cards held by the player
    • Player

      public Player(List<Card> cards)
      Constructs a player with a hand given by the cards.
      Parameters:
      cards - the list of cards held by the player
  • Method Details

    • addWin

      public void addWin()
      Increments the number of wins for the player.
    • addTie

      public void addTie()
      Increments the number of ties (splits) for the player.
    • getNumberOfWins

      public int getNumberOfWins()
      Returns the number of wins for the player.
      Returns:
      the number of wins
    • getNumberOfTies

      public int getNumberOfTies()
      Returns the number of ties (splits) for the player.
      Returns:
      the number of ties
    • getCards

      public Card[] getCards()
      Returns the cards held by the player.
      Returns:
      the cards held by the player
    • getWinProbability

      public double getWinProbability()
      Returns the win probability of the player.
      Returns:
      the win probability
    • setWinProbability

      public void setWinProbability(int numberOfHands)
      Sets the win probability of the player based on the total number of hands.
      Parameters:
      numberOfHands - the total number of hands played
    • getTieProbability

      public double getTieProbability()
      Returns the tie probability of the player.
      Returns:
      the tie probability
    • setTieProbability

      public void setTieProbability(int numberOfHands)
      Sets the tie probability of the player based on the total number of hands.
      Parameters:
      numberOfHands - the total number of hands played
    • toString

      public String toString()
      Returns a string representation of the player's cards.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the cards