|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.yagurashogi.server.Game
public class Game
Object containing all the information about proposed and started games.
| Field Summary | |
|---|---|
static int |
FINISHED
|
Player |
player1
|
Player |
player2
|
static int |
PROPOSED
|
static int |
STARTED
|
| Constructor Summary | |
|---|---|
Game(ShogiServer shogiServer,
java.lang.String gameName,
Player p1,
Player p2)
Creates new game proposal for two players. |
|
| Method Summary | |
|---|---|
void |
agree(Player who)
One of the players agrees to the conditions. |
void |
claimWin(Player who)
One of the players claims that he has won. |
int |
getByoyomi()
Returns byoyomi (maximum time for one move). |
Player |
getCurrentPlayer()
Returns the player whose turn is now. |
int |
getState()
Returns game's current state. |
long |
getTimeOfStart()
Returns the timestamp of when the game started. |
long |
getTimestamp()
Returns the timestamp of when last move has taken place. |
int |
getTotalTime()
Returns game's maximum time |
boolean |
move(Player who,
java.lang.String what)
One of the players wants to move one of his pieces. |
void |
reject(Player who)
One of the players rejects the conditions. |
void |
remove()
Remove game. |
void |
sendConditions()
Sends game conditions to both players. |
void |
surrender(Player who)
One of the players surrenders. |
void |
timeUp(Player who)
Deals with the situation when the time is up. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Player player1
public Player player2
public static final int PROPOSED
public static final int STARTED
public static final int FINISHED
| Constructor Detail |
|---|
public Game(ShogiServer shogiServer,
java.lang.String gameName,
Player p1,
Player p2)
shogiServer - server on which the game is to be playedgameName - unique game IDp1 - first playerp2 - second player| Method Detail |
|---|
public int getState()
public long getTimeOfStart()
public long getTimestamp()
public int getByoyomi()
public int getTotalTime()
public Player getCurrentPlayer()
public void sendConditions()
public void timeUp(Player who)
who - the player that reached byoyomi or null when the total match time is uppublic void agree(Player who)
who - the player that agreespublic void reject(Player who)
who - the player that rejectspublic void surrender(Player who)
who - the player that surrenderspublic void claimWin(Player who)
who - the player that claims win
public boolean move(Player who,
java.lang.String what)
who - the player that moveswhat - the action, eg. +7776FU
public void remove()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||