tictactoe
Interface BoardGame

All Known Implementing Classes:
AbstractBoardGame

public abstract interface BoardGame

Interface for TicTacToe and Gomoku.

Version:
3.0 1999-03-26
Author:
Oscar.Nierstrasz@acm.org
See Also:
AbstractBoardGame

Method Summary
 void addObserver(RemoteObserver remote)
          Used by GameProxy to connect RemoteObservers to a game.
 int cols()
           
 Player currentPlayer()
           
 Player get(int col, int row)
           
 boolean inRange(int col, int row)
           
 void move(int col, int row, Player p)
          Attempt to move to the given square
 boolean notOver()
           
 Player player(int n)
          Return Player #n (0 or 1), else Player "nobody".
 int rows()
           
 int squaresLeft()
           
 void test()
          Run a generic test suite.
 Player winner()
           
 

Method Detail

cols

public int cols()
Returns:
the number of columns of this game

rows

public int rows()
Returns:
the number of rows

move

public void move(int col,
                 int row,
                 Player p)
          throws AssertionException
Attempt to move to the given square

currentPlayer

public Player currentPlayer()
Returns:
the Player whose turn it is.

player

public Player player(int n)
Return Player #n (0 or 1), else Player "nobody".

winner

public Player winner()
Returns:
the winner of the game (possibly nobody)

get

public Player get(int col,
                  int row)
           throws AssertionException
Returns:
the Player at the given square (possibly blank)

notOver

public boolean notOver()
Returns:
whether the game is over

squaresLeft

public int squaresLeft()
Returns:
how many squares have no yet been played on

inRange

public boolean inRange(int col,
                       int row)
Returns:
whether the arguments specify a valid square

test

public void test()
Run a generic test suite.

addObserver

public void addObserver(RemoteObserver remote)
Used by GameProxy to connect RemoteObservers to a game.