org.xistrat.net
Class F4Daemon

java.lang.Object
  extended by org.xistrat.net.F4Daemon
All Implemented Interfaces:
java.lang.Runnable

public class F4Daemon
extends java.lang.Object
implements java.lang.Runnable

F4 Daemon Daemon to run the game

This class is instantiated from F4Server and its helper class Game when a user logs in a game/match. This class handles all messages during a single match. Once the match aborts, or someone wins, it terminates its existance. The client logs out and reconnects to the F4Server.

Since:
0.5.42

Field Summary
 java.util.LinkedList<FigurData[]> _allFig
           
 java.util.LinkedList<StonesBean> _allStones
           
 java.util.LinkedList<java.lang.Integer> _allTurns
           
static int MAX_NUMBER_OF_PLAYERS
           
 
Method Summary
 void closeSockets()
          Tells every PlayerServer output stream to inform its clients the game has ended and that they should reconnect to their original adx:port to regain proper socket.
 boolean[] getAlive()
          in Chess the king counts, in Reversi you can be annihilated, in Go not
 int getCurrPlayers()
           
 java.lang.String[] getGameList()
           
 int getNumPlayers()
           
 java.lang.String[] getPositionList()
           
 void run()
          run
 void sendNewGame()
          notify various game servers there is a new game on line
 void startSocketAndLogin(java.net.Socket playerSocket, java.lang.String alias)
          Called by F4Server, when there is a real login.
 void terminate()
          gracefully terminates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NUMBER_OF_PLAYERS

public static final int MAX_NUMBER_OF_PLAYERS
See Also:
Constant Field Values

_allFig

public java.util.LinkedList<FigurData[]> _allFig

_allTurns

public java.util.LinkedList<java.lang.Integer> _allTurns

_allStones

public java.util.LinkedList<StonesBean> _allStones
Method Detail

startSocketAndLogin

public void startSocketAndLogin(java.net.Socket playerSocket,
                                java.lang.String alias)
Called by F4Server, when there is a real login. Accepts a Socket, and it also does a login automatically.


sendNewGame

public void sendNewGame()
notify various game servers there is a new game on line


run

public void run()
run

Specified by:
run in interface java.lang.Runnable

closeSockets

public void closeSockets()
Tells every PlayerServer output stream to inform its clients the game has ended and that they should reconnect to their original adx:port to regain proper socket. Their current socket is invalid


terminate

public void terminate()
gracefully terminates


getGameList

public java.lang.String[] getGameList()

getPositionList

public java.lang.String[] getPositionList()

getAlive

public boolean[] getAlive()
in Chess the king counts, in Reversi you can be annihilated, in Go not

Returns:
array of alive status for each party

getNumPlayers

public int getNumPlayers()

getCurrPlayers

public int getCurrPlayers()