ca.ualberta.cs.poker.free.dynamics
Class PokerDynamics

java.lang.Object
  extended by ca.ualberta.cs.poker.free.dynamics.PokerDynamics
Direct Known Subclasses:
ClientPokerDynamics, PokerServer

public class PokerDynamics
extends java.lang.Object


Field Summary
 double[] amountWon
           
 java.lang.String bettingSequence
           
 Card[] board
          Full board (may not have been revealed)
 boolean firstActionOnRound
          The next action will be the first action on the round.
 int handNumber
           
 boolean handOver
          The hand is over
 Card[][] hole
          Cards in the hole
 double[] inPot
          inPot[i] is the contribution to the pot of the player in seat i.
 int roundBets
           
 int roundIndex
          Round index incremented when the cards for that round are dealt.
 int seatToAct
           
 int winnerIndex
           
 
Constructor Summary
PokerDynamics()
           
PokerDynamics(java.security.SecureRandom random)
          Creates a new instance of PokerServer
 
Method Summary
 void addToPot(double amount, int seat)
           
 void dealCards()
          Sets all cards from the SecureRandom device
 void endHand()
          After winnerIndex is set, we can end the hand.
 java.lang.String getCardState(int seat)
          If seat==2, we want all the card info for the logs, this assumes we will only use seat==2 when the server wants logging info, otherwise 0 or 1
 java.lang.String getMatchState(int seat)
           
 int getOtherSeat(int seat)
           
 int getWinner()
          Returns: -1 on a tie, 0 if first seat has a better hand, 1 if second seat has a better hand.
 void handleAction(char action)
           
 void handleCall()
          Updates the state when a call is made.
 void handleFold()
          Updates the state when a (legal) fold is made.
 void handleRaise()
          Updates the state when a (legal) raise is made.
 void incrementRound()
           
 void initializeBets()
           
 boolean isFirstSeatVisible(int seat)
          The first player's hole cards are visible to the first player always and to everyone at the showdown.
 boolean isSecondSeatVisible(int seat)
           
 void setHandNumber(int handNumber)
           
 void startHand()
           
 void startHand(java.io.BufferedReader cardFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inPot

public double[] inPot
inPot[i] is the contribution to the pot of the player in seat i.


amountWon

public double[] amountWon

roundBets

public int roundBets

bettingSequence

public java.lang.String bettingSequence

seatToAct

public int seatToAct

roundIndex

public int roundIndex
Round index incremented when the cards for that round are dealt. Preflop is 0, Showdown is 4.


firstActionOnRound

public boolean firstActionOnRound
The next action will be the first action on the round.


handOver

public boolean handOver
The hand is over


winnerIndex

public int winnerIndex

hole

public Card[][] hole
Cards in the hole


board

public Card[] board
Full board (may not have been revealed)


handNumber

public int handNumber
Constructor Detail

PokerDynamics

public PokerDynamics(java.security.SecureRandom random)
Creates a new instance of PokerServer


PokerDynamics

public PokerDynamics()
Method Detail

startHand

public void startHand()

startHand

public void startHand(java.io.BufferedReader cardFile)

dealCards

public void dealCards()
Sets all cards from the SecureRandom device


getOtherSeat

public int getOtherSeat(int seat)

addToPot

public void addToPot(double amount,
                     int seat)

initializeBets

public void initializeBets()

incrementRound

public void incrementRound()

getMatchState

public java.lang.String getMatchState(int seat)

isFirstSeatVisible

public boolean isFirstSeatVisible(int seat)
The first player's hole cards are visible to the first player always and to everyone at the showdown.


isSecondSeatVisible

public boolean isSecondSeatVisible(int seat)

getCardState

public java.lang.String getCardState(int seat)
If seat==2, we want all the card info for the logs, this assumes we will only use seat==2 when the server wants logging info, otherwise 0 or 1

Parameters:
seat -
Returns:

handleCall

public void handleCall()
Updates the state when a call is made.


handleRaise

public void handleRaise()
Updates the state when a (legal) raise is made.


handleFold

public void handleFold()
Updates the state when a (legal) fold is made.


handleAction

public void handleAction(char action)

getWinner

public int getWinner()
Returns: -1 on a tie, 0 if first seat has a better hand, 1 if second seat has a better hand.


endHand

public void endHand()
After winnerIndex is set, we can end the hand.


setHandNumber

public void setHandNumber(int handNumber)