tictactoe
Interface BoardGame
- All Known Implementing Classes:
- AbstractBoardGame
- public abstract interface BoardGame
Interface for TicTacToe and Gomoku.
- Version:
- 2.0 1999-03-26
- Author:
- Oscar.Nierstrasz@acm.org
- See Also:
AbstractBoardGame
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.
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(java.util.Observer o)
- Subclasses should implement this method of java.util.Observable.