server
Interface RemoteGame

All Known Implementing Classes:
GameProxy

public abstract interface RemoteGame
extends java.rmi.Remote

Remote interface for TicTacToe and Gomoku. This interface adapts the BoardGame interface. All RemoteGame methods throw RemoteException, and none of them throws an AssertionException. BoardGame methods that return a Player are adapted here so they return a char representing the Player (since a Player is not a remote object). This interface also allows a client to register as a RemoteObserver of the game.

Version:
3.0 1999-04-02
Author:
Oscar.Nierstrasz@acm.org
See Also:
GameProxy

Method Summary
 void addObserver(RemoteObserver o)
          Register as a RemoteObserver of the game.
 int cols()
           
 char currentPlayer()
           
 char join()
          A client connected to the game must join the game to know what its mark is (X or O).
 boolean move(Move move)
          Attempt to move to the given square.
 boolean notOver()
           
 boolean ready()
          The game is ready to be played.
 int rows()
           
 java.lang.String winner()
           
 

Method Detail

ready

public boolean ready()
              throws java.rmi.RemoteException
The game is ready to be played. (There are two connected clients.)

join

public char join()
          throws java.rmi.RemoteException
A client connected to the game must join the game to know what its mark is (X or O).

move

public boolean move(Move move)
             throws java.rmi.RemoteException
Attempt to move to the given square. Called by a remote client. The RemoteGame will check if move.mark corresponds to the current Player, and then call BoardGame.move().
Returns:
true if move is ok

cols

public int cols()
         throws java.rmi.RemoteException
Returns:
the number of columns of this game

rows

public int rows()
         throws java.rmi.RemoteException
Returns:
the number of rows

currentPlayer

public char currentPlayer()
                   throws java.rmi.RemoteException
Returns:
the mark of the Player whose turn it is.

winner

public java.lang.String winner()
                        throws java.rmi.RemoteException
Returns:
the name of winner of the game (possibly "nobody")

notOver

public boolean notOver()
                throws java.rmi.RemoteException
Returns:
whether the game is over

addObserver

public void addObserver(RemoteObserver o)
                 throws java.rmi.RemoteException
Register as a RemoteObserver of the game.
See Also:
RemoteObserver, GameObserver