|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglassfrog.players.Player
public abstract class Player
The Player class represents the players in the game. They are given attribures such as thier current bet, score, how much they have commited to the pot, thier seat, hand rank, stack size. They also keep track of the actions of the player, such as if the player has acted in a particular round or if they have folded in a hand The Player class is also responsible for keeping track of the socket to which each player connects (The Buffered reader and the Print Writer of each as well)
Field Summary | |
---|---|
private boolean |
acted
|
private int |
buyIn
|
private java.lang.String |
cardString
|
private int |
currentBet
|
private boolean |
folded
|
private int |
handRank
|
private java.lang.String |
handString
|
private java.lang.String |
name
|
private int |
position
|
private int |
score
|
private int |
seat
|
private int |
stack
|
private int |
totalCommitedToPot
|
Constructor Summary | |
---|---|
Player()
Default Player constructor |
|
Player(java.lang.String name,
int buyIn)
A constructor for a Player object that only takes a name, buyIn |
Method Summary | |
---|---|
void |
addToScore(int score)
Add a value to the player's score |
int |
bet(int betSize)
Make a bet of the passed in size. |
int |
call(int currentBet)
Have the player call the current bet This will take the player's current bet and figure out how much more the player has to bet to call, make that bet then return the amount it cost to make the bet since there will be some cases where a call will be more that the player's stack and the player will then be all in for less than the amount needed to call |
int |
compareTo(Player o)
Compare the stack size of one player to another. |
void |
fold()
Set the player's fold flag to true |
abstract java.lang.String |
getAction()
GetAction is the method that all the inherited classes of the bot must implement. |
int |
getBuyIn()
Get the amount the player bought in for |
java.lang.String |
getCardString()
Get a string representation of thier best 5 card hand |
int |
getCurrentBet()
Get the player's current betsize |
int |
getHandRank()
Get the hand rank of the player's current hand |
java.lang.String |
getHandString()
Get the @String representation of the player's cards. |
java.lang.String |
getName()
Get the name of the player |
int |
getPosition()
Get the players position relative to the button |
int |
getScore()
Get the current score of the player |
int |
getSeat()
Get the player's seat |
int |
getStack()
Get the current stack size of the player |
int |
getTotalCommitedToPot()
Get the total amount the player has committed to the pot |
private void |
initializePlayer()
Set up all the defaults for the player, such as the acted and folded flags to false, the bets and scores to 0 and set the stack to the buyin value |
void |
initTimeout(int timeout)
Set timeout, used for socket players |
boolean |
isAAAIPlayer()
Check to see if this player is a AAAIPlayer |
boolean |
isActed()
Check whether or not the player has acted in this round |
boolean |
isAllIn()
Check to see if the player is all in. |
boolean |
isFolded()
Check to see if the player has folded |
boolean |
isGuiPlayer()
Check to see if the player is a GUIPlayer. |
boolean |
isSocketPlayer()
Check to see if this player is a SocketPlayer |
void |
payout(int pay)
Payout the player. |
int |
postBlind(int blindSize)
A special type of bet where the player is considered not to have acted for the round |
void |
resetHand()
Reset all of the per/hand values for the player, such as the acted and folded flags, the current bet, and the amount the player has commited to the pot so far |
void |
resetPlayer(boolean doylesGame)
Reset the Player. |
void |
resetRound()
Reset the per/round attributes such as the acted flag and currentBet for the player. |
void |
resetStack()
Set the Player's stack back to the starting size. |
void |
setBuyIn(int buyIn)
Set the buying amount for the player |
void |
setCardString(java.lang.String cardString)
Set a string representing the players best 5 card poker hand |
void |
setHandRank(int handRank)
Set the hand rank for the player |
void |
setHandString(java.lang.String handString)
Set the string value of the player's current hand. |
void |
setName(java.lang.String name)
Set the player's name |
void |
setPosition(int position)
Set the players position relative to the button |
void |
setScore(int score)
Set the current score for the player |
void |
setSeat(int seat)
Set the player's seat |
void |
setStack(int stack)
Set the current stack size for the player |
abstract void |
shutdown()
All players must implement a shutdown routine |
void |
subtractTotalCommitedToPot(int amount)
Subtract the amount from the Player's totalCommitedToPot value |
java.lang.String |
toShortString()
A compact string representation of a Player object (name:stack:score:seat) |
java.lang.String |
toString()
A string representation of a Player object |
abstract void |
update(java.lang.String gamestate)
update is called by dealer to transmit the current gamestate in String representation to the player. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String name
private java.lang.String handString
private java.lang.String cardString
private int stack
private int buyIn
private int currentBet
private int score
private int totalCommitedToPot
private int seat
private int handRank
private int position
private boolean acted
private boolean folded
Constructor Detail |
---|
public Player()
public Player(java.lang.String name, int buyIn)
name
- A String representing the namebuyIn
- An int representing the buyin value for the playerMethod Detail |
---|
public int getBuyIn()
public void setBuyIn(int buyIn)
buyIn
- an int representing the amount the player bought in forpublic int getScore()
public void setScore(int score)
score
- an int representing the player's scorepublic void addToScore(int score)
score
- an int representing the amount to increment the score bypublic boolean isActed()
public boolean isFolded()
public boolean isGuiPlayer()
public boolean isSocketPlayer()
public boolean isAAAIPlayer()
public int getCurrentBet()
public int getTotalCommitedToPot()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- a @String representing the player's namepublic int getStack()
public void setStack(int stack)
stack
- an int representing the stack size to setpublic int getSeat()
public void setSeat(int seat)
seat
- an int representing which seat the player is to be assignedpublic int getHandRank()
public void setHandRank(int handRank)
handRank
- an int representing the hand rank as calculated by the @Dealerpublic java.lang.String getHandString()
public void setHandString(java.lang.String handString)
handString
- The string that represents the players handpublic java.lang.String getCardString()
public void setCardString(java.lang.String cardString)
cardString
- A string that represents the players 5 best cardspublic int getPosition()
public void setPosition(int position)
position
- The position the player is in. 0 is the button.public abstract void shutdown()
public void subtractTotalCommitedToPot(int amount)
amount
- Amount to subtractprivate void initializePlayer()
public int bet(int betSize)
betSize
-
public int postBlind(int blindSize)
blindSize
- The size of bet that the player makes
public void fold()
public abstract java.lang.String getAction()
public abstract void update(java.lang.String gamestate)
gamestate
- The AAAI competition formated string representation of the
gamestatepublic int call(int currentBet)
currentBet
- The size of the bet that the player needs to call
public boolean isAllIn()
public void payout(int pay)
pay
- The amount to increase the player's stack bypublic void resetRound()
public void resetHand()
public void resetStack()
public void resetPlayer(boolean doylesGame)
doylesGame
- public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toShortString()
public int compareTo(Player o)
compareTo
in interface java.lang.Comparable<Player>
o
- The player to compare this player to.
public void initTimeout(int timeout)
timeout
- Timeout for the player's actions
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |