|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.ualberta.cs.poker.free.dynamics.PokerDynamics
ca.ualberta.cs.poker.free.server.PokerServer
public class PokerServer
Field Summary | |
---|---|
java.net.ServerSocket |
socket
The socket clients connect to. |
Fields inherited from class ca.ualberta.cs.poker.free.dynamics.PokerDynamics |
---|
amountWon, bettingSequence, board, firstActionOnRound, handNumber, handOver, hole, inPot, roundBets, roundIndex, seatToAct, winnerIndex |
Constructor Summary | |
---|---|
PokerServer(java.security.SecureRandom random,
java.net.InetAddress firstPlayerAddress,
java.net.InetAddress secondPlayerAddress,
int timePerHand)
Initialize a PokerServer. |
Method Summary | |
---|---|
void |
adjustBankrolls()
Adjust the bankrolls according to current hands winnings. |
void |
broadcastMatchState()
Sends the match state as it appears to all players. |
void |
forfeit(int playerIndex,
int numHandsRemaining)
If a player forfeits, he loses all of his blinds for the remainder of the game. |
char |
getActionFromResponse(java.lang.String response)
Gets the last character of a response, which should be 'c', 'r', or 'f' |
void |
incrementSeatBankroll(double amount,
int seat)
Increment the bankroll of the player in seat seat an amount amount. |
boolean |
isAppropriate(java.lang.String response)
Tests if a response is actually a response to the CURRENT action. |
static void |
main(java.lang.String[] args)
Run the server listening for connections from the localhost to test the code. |
int |
playerToSeat(int player)
Which seat is the player in? |
void |
playHand()
Play one hand. |
void |
run()
Run the server. |
int |
seatToPlayer(int seat)
Which player is in the seat? |
void |
setVerbose(boolean verbose)
If setVerbose(true), messages sent/received are printed to standard output. |
void |
verboseMessage(java.lang.String str)
If verbose==true, prints a message to standard output. |
Methods inherited from class ca.ualberta.cs.poker.free.dynamics.PokerDynamics |
---|
addToPot, dealCards, endHand, getCardState, getMatchState, getOtherSeat, getWinner, handleAction, handleCall, handleFold, handleRaise, incrementRound, initializeBets, isFirstSeatVisible, isSecondSeatVisible, setHandNumber, startHand |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.net.ServerSocket socket
Constructor Detail |
---|
public PokerServer(java.security.SecureRandom random, java.net.InetAddress firstPlayerAddress, java.net.InetAddress secondPlayerAddress, int timePerHand)
Method Detail |
---|
public void verboseMessage(java.lang.String str)
public void setVerbose(boolean verbose)
public void run()
run
in interface java.lang.Runnable
public void forfeit(int playerIndex, int numHandsRemaining)
public void broadcastMatchState() throws TimeoutException
TimeoutException
public void playHand() throws TimeoutException
TimeoutException
public boolean isAppropriate(java.lang.String response)
public char getActionFromResponse(java.lang.String response)
public int seatToPlayer(int seat)
public int playerToSeat(int player)
public void incrementSeatBankroll(double amount, int seat)
public void adjustBankrolls()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |