|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsoc.client.SOCDisplaylessPlayerClient
soc.robot.SOCRobotClient
This is a client that can play Settlers of Catan.
| Field Summary | |
private java.util.Hashtable |
brainQs
the message queues for the different brains |
protected int |
cleanBrainKills
number of clean brain kills |
static java.lang.String |
CURRENT_PLANS
constants for debug recording |
static java.lang.String |
CURRENT_RESOURCES
|
private SOCRobotParameters |
currentRobotParameters
the current robot parameters for robot brains |
protected int |
gamesFinished
number of games finished |
protected int |
gamesPlayed
number of games this bot has played |
protected int |
gamesWon
number of games this bot has won |
private java.lang.Thread |
reader
the thread the reads incomming messages |
(package private) SOCRobotResetThread |
resetThread
used to maintain connection |
private java.util.Hashtable |
robotBrains
the robot's "brains" for diferent games |
private java.util.Hashtable |
seatRequests
a table of requests from the server to sit at games |
protected long |
startTime
start time |
| Fields inherited from class soc.client.SOCDisplaylessPlayerClient |
channels, connected, doc, ex, games, gotPassword, host, in, lastMessage, nickname, out, password, port, rejected, s, sLocal, sLocalVersion, STATSPREFEX, strSocketName, sVersion |
| Constructor Summary | |
SOCRobotClient(java.lang.String h,
int p,
java.lang.String nn,
java.lang.String pw)
Constructor for connecting to the specified host, on the specified port |
|
SOCRobotClient(java.lang.String s,
java.lang.String nn,
java.lang.String pw)
Constructor for connecting to a local game (practice) on a local stringport. |
|
| Method Summary | |
void |
addCleanKill()
add one the the number of clean brain kills |
void |
destroy()
destroy the applet |
void |
disconnectReconnect()
disconnect and then try to reconnect |
protected void |
handleACCEPTOFFER(SOCAcceptOffer mes)
handle the "accept offer" message |
protected void |
handleADMINPING(SOCAdminPing mes)
handle the admin ping message |
protected void |
handleADMINRESET(SOCAdminReset mes)
handle the admin reset message |
protected void |
handleBOARDLAYOUT(SOCBoardLayout mes)
handle the "board layout" message |
protected void |
handleCANCELBUILDREQUEST(SOCCancelBuildRequest mes)
handle the rare "cancel build request" message; usually not sent from server to client. |
protected void |
handleCHANGEFACE(SOCChangeFace mes)
handle the "change face" message |
protected void |
handleCHOOSEPLAYERREQUEST(SOCChoosePlayerRequest mes)
handle the "choose player request" message |
protected void |
handleCLEAROFFER(SOCClearOffer mes)
handle the "clear offer" message |
protected void |
handleCLEARTRADEMSG(SOCClearTradeMsg mes)
handle the "clear trade" message |
protected void |
handleDELETEGAME(SOCDeleteGame mes)
handle the "delete game" message |
protected void |
handleDEVCARD(SOCDevCard mes)
handle the "development card action" message |
protected void |
handleDEVCARDCOUNT(SOCDevCardCount mes)
handle the "development card count" message |
protected void |
handleDICERESULT(SOCDiceResult mes)
handle the "dice result" message |
protected void |
handleDISCARDREQUEST(SOCDiscardRequest mes)
handle the "discard request" message |
protected void |
handleFIRSTPLAYER(SOCFirstPlayer mes)
handle the "set first player" message |
protected void |
handleGAMEMEMBERS(SOCGameMembers mes)
handle the "game members" message |
protected void |
handleGAMESTATE(SOCGameState mes)
handle the "game state" message |
protected void |
handleGAMETEXTMSG(SOCGameTextMsg mes)
handle the "game text message" message |
protected void |
handleJOINGAME(SOCJoinGame mes)
handle the "join game" message |
protected void |
handleJOINGAMEAUTH(SOCJoinGameAuth mes)
handle the "join game authorization" message |
protected void |
handleJOINGAMEREQUEST(SOCJoinGameRequest mes)
handle the "join game request" message. |
protected void |
handleLARGESTARMY(SOCLargestArmy mes)
handle the "largest army" message |
protected void |
handleLEAVEGAME(SOCLeaveGame mes)
handle the "leave game" message |
protected void |
handleLONGESTROAD(SOCLongestRoad mes)
handle the "longest road" message |
protected void |
handleMAKEOFFER(SOCMakeOffer mes)
handle the "make offer" message |
protected void |
handleMOVEROBBER(SOCMoveRobber mes)
handle the "move robber" message |
protected void |
handlePLAYERELEMENT(SOCPlayerElement mes)
handle the "player element" message |
protected void |
handlePOTENTIALSETTLEMENTS(SOCPotentialSettlements mes)
handle the "potential settlements" message |
protected void |
handlePUTPIECE(SOCPutPiece mes)
handle the "put piece" message |
protected void |
handleREJECTOFFER(SOCRejectOffer mes)
handle the "reject offer" message |
protected void |
handleRESETBOARDAUTH(SOCResetBoardAuth mes)
handle board reset (new game with same players, same game name). |
protected void |
handleRESOURCECOUNT(SOCResourceCount mes)
handle "resource count" message |
protected void |
handleROBOTDISMISS(SOCRobotDismiss mes)
handle the "dismiss robot" message |
protected void |
handleSERVERPING(SOCServerPing mes)
handle the server ping message |
protected void |
handleSETPLAYEDDEVCARD(SOCSetPlayedDevCard mes)
handle the "set played development card" message |
protected void |
handleSETTURN(SOCSetTurn mes)
handle the "set turn" message |
protected void |
handleSITDOWN(SOCSitDown mes)
handle the "someone is sitting down" message |
protected void |
handleSTARTGAME(SOCStartGame mes)
handle the "start game" message |
protected void |
handleSTATUSMESSAGE(SOCStatusMessage mes)
handle the "status message" message by printing it to System.err |
protected void |
handleTURN(SOCTurn mes)
handle the "turn" message |
protected void |
handleUPDATEROBOTPARAMS(SOCUpdateRobotParams mes)
handle the update robot params message |
void |
init()
Initialize the robot player; connect to server, send first messages |
void |
leaveGame(SOCGame ga)
the user leaves the given game |
static void |
main(java.lang.String[] args)
for stand-alones |
protected void |
sendRecordsText(SOCGame ga,
java.util.Vector record)
Call sendText on each string element of record. |
void |
treat(SOCMessage mes)
Treat the incoming messages. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String CURRENT_PLANS
public static final java.lang.String CURRENT_RESOURCES
private java.lang.Thread reader
private SOCRobotParameters currentRobotParameters
private java.util.Hashtable robotBrains
private java.util.Hashtable brainQs
private java.util.Hashtable seatRequests
protected int gamesPlayed
protected int gamesFinished
protected int gamesWon
protected int cleanBrainKills
protected long startTime
SOCRobotResetThread resetThread
| Constructor Detail |
public SOCRobotClient(java.lang.String h,
int p,
java.lang.String nn,
java.lang.String pw)
h - hostp - portnn - nickname for robotpw - password for robot
public SOCRobotClient(java.lang.String s,
java.lang.String nn,
java.lang.String pw)
s - the stringport that the server listens onnn - nickname for robotpw - password for robot| Method Detail |
public void init()
public void disconnectReconnect()
public void treat(SOCMessage mes)
SOCMessage.toMsg(String)).
treat in class SOCDisplaylessPlayerClientmes - the messageprotected void handleSERVERPING(SOCServerPing mes)
mes - the messageprotected void handleADMINPING(SOCAdminPing mes)
mes - the messageprotected void handleADMINRESET(SOCAdminReset mes)
mes - the messageprotected void handleUPDATEROBOTPARAMS(SOCUpdateRobotParams mes)
mes - the messageprotected void handleJOINGAMEREQUEST(SOCJoinGameRequest mes)
mes - the messagehandleRESETBOARDAUTH(SOCResetBoardAuth)protected void handleSTATUSMESSAGE(SOCStatusMessage mes)
handleSTATUSMESSAGE in class SOCDisplaylessPlayerClientmes - the messageprotected void handleJOINGAMEAUTH(SOCJoinGameAuth mes)
handleJOINGAMEAUTH in class SOCDisplaylessPlayerClientmes - the messageprotected void handleJOINGAME(SOCJoinGame mes)
handleJOINGAME in class SOCDisplaylessPlayerClientmes - the messageprotected void handleLEAVEGAME(SOCLeaveGame mes)
handleLEAVEGAME in class SOCDisplaylessPlayerClientmes - the messageprotected void handleGAMEMEMBERS(SOCGameMembers mes)
handleGAMEMEMBERS in class SOCDisplaylessPlayerClientmes - the messageprotected void handleGAMETEXTMSG(SOCGameTextMsg mes)
handleGAMETEXTMSG in class SOCDisplaylessPlayerClientmes - the messageprotected void handleSITDOWN(SOCSitDown mes)
handleSITDOWN in class SOCDisplaylessPlayerClientmes - the messageprotected void handleBOARDLAYOUT(SOCBoardLayout mes)
handleBOARDLAYOUT in class SOCDisplaylessPlayerClientmes - the messageprotected void handleSTARTGAME(SOCStartGame mes)
handleSTARTGAME in class SOCDisplaylessPlayerClientmes - the messageprotected void handleDELETEGAME(SOCDeleteGame mes)
handleDELETEGAME in class SOCDisplaylessPlayerClientmes - the messageprotected void handleGAMESTATE(SOCGameState mes)
handleGAMESTATE in class SOCDisplaylessPlayerClientmes - the messageprotected void handleSETTURN(SOCSetTurn mes)
handleSETTURN in class SOCDisplaylessPlayerClientmes - the messageprotected void handleFIRSTPLAYER(SOCFirstPlayer mes)
handleFIRSTPLAYER in class SOCDisplaylessPlayerClientmes - the messageprotected void handleTURN(SOCTurn mes)
handleTURN in class SOCDisplaylessPlayerClientmes - the messageprotected void handlePLAYERELEMENT(SOCPlayerElement mes)
handlePLAYERELEMENT in class SOCDisplaylessPlayerClientmes - the messageprotected void handleRESOURCECOUNT(SOCResourceCount mes)
handleRESOURCECOUNT in class SOCDisplaylessPlayerClientmes - the messageprotected void handleDICERESULT(SOCDiceResult mes)
handleDICERESULT in class SOCDisplaylessPlayerClientmes - the messageprotected void handlePUTPIECE(SOCPutPiece mes)
handlePUTPIECE in class SOCDisplaylessPlayerClientmes - the messageprotected void handleCANCELBUILDREQUEST(SOCCancelBuildRequest mes)
- When sent from client to server, CANCELBUILDREQUEST means the player has changed their mind about spending resources to build a piece. Only allowed during normal game play (PLACING_ROAD, PLACING_SETTLEMENT, or PLACING_CITY).
When sent from server to client:
- During game startup (START1B or START2B):
Sent from server, CANCELBUILDREQUEST means the current player
wants to undo the placement of their initial settlement.
- During piece placement (PLACING_ROAD, PLACING_CITY, PLACING_SETTLEMENT, PLACING_FREE_ROAD1 or PLACING_FREE_ROAD2):
Sent from server, CANCELBUILDREQUEST means the player has sent an illegal PUTPIECE (bad building location). Humans can probably decide a better place to put their road, but robots must cancel the build request and decide on a new plan.
Our robot client sends this to the brain to act on.
handleCANCELBUILDREQUEST in class SOCDisplaylessPlayerClientmes - the messageprotected void handleMOVEROBBER(SOCMoveRobber mes)
handleMOVEROBBER in class SOCDisplaylessPlayerClientmes - the messageprotected void handleDISCARDREQUEST(SOCDiscardRequest mes)
handleDISCARDREQUEST in class SOCDisplaylessPlayerClientmes - the messageprotected void handleCHOOSEPLAYERREQUEST(SOCChoosePlayerRequest mes)
handleCHOOSEPLAYERREQUEST in class SOCDisplaylessPlayerClientmes - the messageprotected void handleMAKEOFFER(SOCMakeOffer mes)
handleMAKEOFFER in class SOCDisplaylessPlayerClientmes - the messageprotected void handleCLEAROFFER(SOCClearOffer mes)
handleCLEAROFFER in class SOCDisplaylessPlayerClientmes - the messageprotected void handleREJECTOFFER(SOCRejectOffer mes)
handleREJECTOFFER in class SOCDisplaylessPlayerClientmes - the messageprotected void handleACCEPTOFFER(SOCAcceptOffer mes)
mes - the messageprotected void handleCLEARTRADEMSG(SOCClearTradeMsg mes)
handleCLEARTRADEMSG in class SOCDisplaylessPlayerClientmes - the messageprotected void handleDEVCARDCOUNT(SOCDevCardCount mes)
handleDEVCARDCOUNT in class SOCDisplaylessPlayerClientmes - the messageprotected void handleDEVCARD(SOCDevCard mes)
handleDEVCARD in class SOCDisplaylessPlayerClientmes - the messageprotected void handleSETPLAYEDDEVCARD(SOCSetPlayedDevCard mes)
handleSETPLAYEDDEVCARD in class SOCDisplaylessPlayerClientmes - the messageprotected void handleROBOTDISMISS(SOCRobotDismiss mes)
mes - the messageprotected void handlePOTENTIALSETTLEMENTS(SOCPotentialSettlements mes)
handlePOTENTIALSETTLEMENTS in class SOCDisplaylessPlayerClientmes - the messageprotected void handleCHANGEFACE(SOCChangeFace mes)
handleCHANGEFACE in class SOCDisplaylessPlayerClientmes - the messageprotected void handleLONGESTROAD(SOCLongestRoad mes)
handleLONGESTROAD in class SOCDisplaylessPlayerClientmes - the messageprotected void handleLARGESTARMY(SOCLargestArmy mes)
handleLARGESTARMY in class SOCDisplaylessPlayerClientmes - the messageprotected void handleRESETBOARDAUTH(SOCResetBoardAuth mes)
handleRESETBOARDAUTH in class SOCDisplaylessPlayerClientmes - the messageSOCServer.resetBoardAndNotify(String, int),
SOCGame.resetAsCopy(),
handleJOINGAMEREQUEST(SOCJoinGameRequest)
protected void sendRecordsText(SOCGame ga,
java.util.Vector record)
ga - Game to sendText torecord - Strings to send, or nullpublic void leaveGame(SOCGame ga)
leaveGame in class SOCDisplaylessPlayerClientga - the gamepublic void addCleanKill()
public void destroy()
destroy in class SOCDisplaylessPlayerClientpublic static void main(java.lang.String[] args)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||