java.lang.Object
cz.matfyz.rudad.joker.calculator.Player
Represents a player in a poker game.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTie()
Increments the number of ties (splits) for the player.void
addWin()
Increments the number of wins for the player.Card[]
getCards()
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.toString()
Returns a string representation of the player's cards.
-
Constructor Details
-
Player
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
Constructs a player with a hand given by the cards.- Parameters:
cards
- the cards held by the player
-
Player
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
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
Returns a string representation of the player's cards.
-