|
|||||||||
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. |
|
PokerServer(java.lang.String firstPlayerAddress,
java.lang.String secondPlayerAddress,
int timePerHand,
java.io.FileReader cardFileReader,
java.io.BufferedWriter logFileWriter,
java.lang.String resultFile)
Initialize a PokerServer with logging and card reading capabilities. |
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 |
closeLogFile()
|
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' |
java.lang.String |
getBankrollString()
Get the bankroll information for the log |
void |
incrementSeatBankroll(double amount,
int seat)
Increment the bankroll of the player in seat seat an amount amount. |
void |
initialiseLogFile(java.lang.String filename)
Create file to write the log into Initialise/close is so that one file descriptor can be used instead of re-creating it each round |
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. |
void |
writeLog()
Write the necessary logging information to a file |
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, 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)
public PokerServer(java.lang.String firstPlayerAddress, java.lang.String secondPlayerAddress, int timePerHand, java.io.FileReader cardFileReader, java.io.BufferedWriter logFileWriter, java.lang.String resultFile) throws java.net.UnknownHostException
java.net.UnknownHostException
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
public void initialiseLogFile(java.lang.String filename)
public void closeLogFile()
public java.lang.String getBankrollString()
public void writeLog()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |