|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xistrat.net.F4Server
public class F4Server
F4Server is to be run as a daemon. It spawns F4Daemon to handle single games.
This servers is configurable to allow for N games in parallel.
It dispatches game request to the appropriate F4Daemon, depending on a game id.
First: a player decides to setup a new game: It chooses a name (must be unique) and receives a unique ID. Once a game has ended its slot is freed to allow for other games.
Second: A client decides to join a game, selected from a list: from now on it plays with a specific F4Daemon.
It is the main server class, and the one that contains the actual "main".
Field Summary | |
---|---|
static int |
DOUBLE_NAME
|
static int |
PORT
|
static int |
TOO_MANY
|
Constructor Summary | |
---|---|
F4Server(int port,
int maxDaemons,
boolean verbose,
boolean undo)
|
Method Summary | |
---|---|
int |
addGame(java.lang.String gameName,
java.lang.String position,
boolean verbose,
boolean undo,
java.lang.String komi)
add a new match (also called game). |
void |
gameFinish(F4Daemon daemon)
Remove won game from list |
java.lang.String[] |
getGameList()
|
java.lang.String[] |
getPositionList()
|
void |
login(org.xistrat.net.MiniListener ml,
java.lang.String game,
java.lang.String alias)
|
static void |
main(java.lang.String[] args)
Starts the main server: |
void |
notifyNewGame()
|
void |
run()
run sends empty messages to players to unblock socket reading |
void |
startGame(F4Daemon daemon)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PORT
public static final int DOUBLE_NAME
public static final int TOO_MANY
Constructor Detail |
---|
public F4Server(int port, int maxDaemons, boolean verbose, boolean undo)
undo
- true in case undoing is enabledMethod Detail |
---|
public static void main(java.lang.String[] args)
args
- some cmd line optionspublic int addGame(java.lang.String gameName, java.lang.String position, boolean verbose, boolean undo, java.lang.String komi)
gameName
- a game name, any string can beposition
- all the figures to start withverbose
- if much verbose output is desiredundo
- if undoing a move is supported or notkomi
- the komi (only in case of the game of Go)
public java.lang.String[] getGameList()
public java.lang.String[] getPositionList()
public void run()
sends empty messages to players to unblock socket reading
run
in interface java.lang.Runnable
public void notifyNewGame()
public void gameFinish(F4Daemon daemon)
public void login(org.xistrat.net.MiniListener ml, java.lang.String game, java.lang.String alias)
public void startGame(F4Daemon daemon)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |