Class OthelloGame

java.lang.Object
  extended byOthelloGame

public class OthelloGame
extends Object

A game of Othello.

Version:
1.0
Author:
Matt Hoffman

Constructor Summary
OthelloGame()
          Constructor for a default player-vs-player game.
OthelloGame(Player p1)
          Constructor for a one-player, player-vs-computer game.
OthelloGame(Player p1, Player p2)
          Constructor for a no-holds-barred, computer-vs-computer game.
 
Method Summary
 void end()
          End the game.
 OthelloPiece play()
          Play the game.
 void setTimeLimit(long timeLimit)
          Set the time-limit to be used by this game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OthelloGame

public OthelloGame()
Constructor for a default player-vs-player game.


OthelloGame

public OthelloGame(Player p1)
Constructor for a one-player, player-vs-computer game.

Parameters:
p1 - The controller for the computer player.

OthelloGame

public OthelloGame(Player p1,
                   Player p2)
Constructor for a no-holds-barred, computer-vs-computer game.

Parameters:
p1 - The controller for the first computer player.
p2 - The controller for the second computer player.
Method Detail

setTimeLimit

public void setTimeLimit(long timeLimit)
Set the time-limit to be used by this game. Each player will get a maximum of timeLimit milliseconds to use for the game. This will default to 300 seconds.

Parameters:
timeLimit - The time-limit in milliseconds.

play

public OthelloPiece play()
                  throws InvalidMoveException
Play the game. This will throw an InvalidMoveException if either player goes over their time, or makes an invalid move. Using the exception as a string will give details.

Throws:
InvalidMoveException

end

public void end()
End the game. This will destroy the window that the game is being played in.