|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglassfrog.players.Player
glassfrog.players.AAAIPlayer
public class AAAIPlayer
A player used to connect the AAAI bots to the server. This class acts as an interface for the bots to connect into the code. They are invoked by a BotManager and thier parameters are specified in a config file that the server parses. This is to get around setting things like the name, seat and buyin from the bot's perspective, but rather the config file handles all of that information and simple adds the AAAIPlayer to the room and the AAAIPlayer opens a port to the bot through which the Room is able to send and recieve messages
Field Summary | |
---|---|
private java.io.BufferedReader |
br
|
private java.lang.String |
location
|
private java.lang.String |
logPrefix
|
private int |
port
|
private java.io.PrintWriter |
pw
|
private java.io.File |
script
|
private java.net.Socket |
socket
|
private java.net.ServerSocket |
ss
|
Constructor Summary | |
---|---|
AAAIPlayer(java.lang.String name,
int buyIn,
java.lang.String location,
java.lang.String scriptPath,
int portBase,
java.lang.String logPrefix)
Invoke the super constructor, set up the server socket, get the port, and then run the script associated with the bot |
Method Summary | |
---|---|
java.lang.String |
getAction()
Gets the action of the player through the BufferedReader |
java.lang.String |
getLocation()
Return the machine location of the player |
int |
getPort()
Get the port the player is associated with |
java.lang.String |
getScriptPath()
Get the path the bot is running on |
java.net.Socket |
getSocket()
Get the @Socket the player is connected on |
void |
initTimeout(int timeout)
Used to set the player timeout to 60s per hand |
boolean |
isAAAIPlayer()
Overrides the @Player call to this method and returns True |
void |
reconnect(java.net.Socket s,
java.lang.String location,
java.lang.String scriptPath)
Used to reconnect a player upon dealer reloads. |
void |
run()
Runs the script associated with this player. |
void |
shutdown()
Override's the @Player implementation of this method and closes the @Socket the @PrintWriter and the @BufferedReader down |
java.lang.String |
toString()
Returns AAAI appended to the @Player representation of the object |
void |
update(java.lang.String gamestate)
Send the gamestate to the player through the PrintWriter |
Methods inherited from class glassfrog.players.Player |
---|
addToScore, bet, call, compareTo, fold, getBuyIn, getCardString, getCurrentBet, getHandRank, getHandString, getName, getPosition, getScore, getSeat, getStack, getTotalCommitedToPot, isActed, isAllIn, isFolded, isGuiPlayer, isSocketPlayer, payout, postBlind, resetHand, resetPlayer, resetRound, resetStack, setBuyIn, setCardString, setHandRank, setHandString, setName, setPosition, setScore, setSeat, setStack, subtractTotalCommitedToPot, toShortString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private transient java.net.ServerSocket ss
private transient java.net.Socket socket
private transient java.io.PrintWriter pw
private transient java.io.BufferedReader br
private transient int port
private transient java.lang.String location
private transient java.lang.String logPrefix
private transient java.io.File script
Constructor Detail |
---|
public AAAIPlayer(java.lang.String name, int buyIn, java.lang.String location, java.lang.String scriptPath, int portBase, java.lang.String logPrefix) throws java.io.IOException
name
- The players namebuyIn
- The buyIn amount to play the gamelocation
- portBase
- The portBase used by the serverscriptPath
- A path to the shell scriptlogPrefix
- A string telling the bot what to append to the out and error logs
java.io.IOException
Method Detail |
---|
public java.lang.String getAction()
getAction
in class Player
public void update(java.lang.String gamestate)
update
in class Player
gamestate
- The gamestate to sendpublic int getPort()
public java.lang.String getLocation()
public java.lang.String getScriptPath()
public void run()
run
in interface java.lang.Runnable
public boolean isAAAIPlayer()
isAAAIPlayer
in class Player
public void reconnect(java.net.Socket s, java.lang.String location, java.lang.String scriptPath) throws java.io.IOException
s
- a socket to reconnect tolocation
- a location to reconnect toscriptPath
- a path where the bot executeable is located
java.io.IOException
public java.net.Socket getSocket()
public void shutdown()
shutdown
in class Player
public java.lang.String toString()
toString
in class Player
public void initTimeout(int timeout)
initTimeout
in class Player
timeout
- A timeout for the bot
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |