p2.tictactoe
Interface BoardGame

All Known Implementing Classes:
AbstractBoardGame, Gomoku, TicTacToe

public interface BoardGame

Interface for TicTacToe and Gomoku.

Version:
$Version$
Author:
$Author: oscar $

Method Summary
 void addObserver(java.util.Observer o)
          Add an Observer to be notified of updates.
 Player currentPlayer()
          Returns which Player must play now.
 int get_cols()
          Number of columns in this game.
 int get_rows()
          Number of rows in this game.
 Player get(int col, int row)
          Returns the Player who has played at the given position.
 boolean inRange(int col, int row)
          The given position is valid.
 Player join()
          Join this game to play as the returned Player.
 void move(int col, int row, Player p)
          Player p attempts to play at position (col,row).
 java.lang.String name()
          Return the name of the game.
 boolean notOver()
          The game is not over.
 boolean ready()
          Two Players have joined.
 void restart()
          Restart the game, initializing the state.
 int squaresLeft()
          The number of squares left unplayed.
 Player winner()
          Returns the winner of the game.
 

Method Detail

get_cols

int get_cols()
Number of columns in this game.


get_rows

int get_rows()
Number of rows in this game.


join

Player join()
Join this game to play as the returned Player. Must be called twice.


ready

boolean ready()
Two Players have joined.


currentPlayer

Player currentPlayer()
Returns which Player must play now.


move

void move(int col,
          int row,
          Player p)
          throws InvalidMoveException
Player p attempts to play at position (col,row).

Throws:
InvalidMoveException

winner

Player winner()
Returns the winner of the game.


get

Player get(int col,
           int row)
Returns the Player who has played at the given position.


notOver

boolean notOver()
The game is not over. (There is no winner and there are still empty squares.)


squaresLeft

int squaresLeft()
The number of squares left unplayed.


inRange

boolean inRange(int col,
                int row)
The given position is valid.


addObserver

void addObserver(java.util.Observer o)
Add an Observer to be notified of updates.


restart

void restart()
Restart the game, initializing the state.


name

java.lang.String name()
Return the name of the game.