|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgame.Player
public class Player
Contains all information about the current state of a player.
"Note: this class has a natural ordering that is inconsistent with equals."
| Field Summary | |
|---|---|
private int |
bet
Amount of money the player has currently put in the pot |
private int |
cashAtStartOfHand
Amount of cash the player had at the beginning of the hand |
protected int |
cashCurrent
Current cash (current bet is already subtracted) |
protected int |
cashInit
Buy in or if it is doyle's game stack size |
private int |
currentPosition
Position in this hand (0: first player behind the button; 1: second player behind the button; ...) |
private boolean |
folded
If the player is folded |
private Card[] |
holeCards
Hole cards of the player if they are known |
private int |
initPosition
Position of player in the first hand (0: first player behind the button; 1: second player behind the button; ...) |
private java.lang.String |
name
Name of the player |
| Constructor Summary | |
|---|---|
Player(java.lang.String name,
int money)
Creates a new player with the given name. |
|
| Method Summary | |
|---|---|
void |
addBet(int bet)
Adds the given amount of money to the own bet and decreases the current cash accordingly |
void |
addCash(int amount)
Adds the given amount to the player's current cash. |
void |
applyAction(Action action)
Applies action to the player. |
int |
compareTo(Player player)
Compares the player to another by the profit of the players. |
void |
fold()
Marks the player as folded. |
int |
getCashAtStartOfHand()
|
int |
getCurrentBet()
|
int |
getCurrentCash()
|
int |
getCurrentPosition()
|
Card[] |
getHoleCards()
|
int |
getInitCash()
|
int |
getInitPosition()
|
java.lang.String |
getName()
|
boolean |
isActive()
Returns if the player isn't folded AND isn't all in. |
boolean |
isAllIn()
Returns if the player's current cash is equals 0. |
boolean |
isFolded()
Returns if the player is folded |
void |
printPlayerData()
Prints the player's data to the console. |
void |
reset()
Resets the player for a new hand. |
void |
setCashAtStartOfHand(int cash)
|
void |
setCurrentPosition(int position)
|
void |
setHoleCards(Card[] cards)
|
void |
setInitPosition(int initPosition)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String name
protected int cashInit
private int initPosition
private int cashAtStartOfHand
protected int cashCurrent
private int currentPosition
private int bet
private boolean folded
private Card[] holeCards
| Constructor Detail |
|---|
public Player(java.lang.String name,
int money)
name - players namemoney - initial cash of the player| Method Detail |
|---|
public java.lang.String getName()
public void setInitPosition(int initPosition)
initPosition - The position of the player in the first hand
(0: first player behind the button; 1: second player behind the button; ...)public int getInitPosition()
public void setCashAtStartOfHand(int cash)
cash - Amount of cash at the beginning of the handpublic int getCashAtStartOfHand()
public void setCurrentPosition(int position)
position - Position of the player in this hand
(0: first player behind the button; 1: second player behind the button; ...)public int getCurrentPosition()
public int getCurrentCash()
public void addBet(int bet)
bet - Amount of bet increasingpublic int getCurrentBet()
public void setHoleCards(Card[] cards)
cards - The hole cards of the playerpublic Card[] getHoleCards()
public boolean isActive()
public boolean isAllIn()
public boolean isFolded()
public void reset()
public void applyAction(Action action)
action - The action which is to be appliedpublic void addCash(int amount)
amount - Amount of cash which is to be addedpublic void fold()
public int compareTo(Player player)
compareTo in interface java.lang.Comparable<Player>public void printPlayerData()
public int getInitCash()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||