Othello 1.0

edu.drexel.cs.ai.othello
Class Othello

java.lang.Object
  extended by edu.drexel.cs.ai.othello.Othello

public class Othello
extends java.lang.Object

A class for playing the game Othello.

Author:
Evan A. Sultanik

Field Summary
static java.lang.String REV_DATE
          The release date of this code.
static java.lang.String VERSION
          The release version of this code.
 
Constructor Summary
Othello(OthelloPlayer player1, OthelloPlayer player2, UserInterface ui)
          Constructs a new othello game with the random number generator seeded randomly.
Othello(OthelloPlayer player1, OthelloPlayer player2, UserInterface ui, long seed)
          Constructs a new othello game with a specific seed to the random number generator.
 
Method Summary
static OthelloPlayer instantiatePlayer(java.lang.String className, java.lang.String playerName)
          Attempts to instantiate a new OthelloPlayer with the given playerName from the given class.
 void log(java.lang.Object message)
          Logs a message to the user interface.
 void log(java.lang.String message)
          Logs a message to the user interface.
static void main(java.lang.String[] args)
          Instantiates the players, loads the user interface, and plays the game until completion.
 OthelloPlayer play()
          Causes this othello game instance to play until completion, returning the winner.
static void printUsage()
          Prints command line usage information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
The release version of this code.

See Also:
Constant Field Values

REV_DATE

public static final java.lang.String REV_DATE
The release date of this code.

See Also:
Constant Field Values
Constructor Detail

Othello

public Othello(OthelloPlayer player1,
               OthelloPlayer player2,
               UserInterface ui,
               long seed)
Constructs a new othello game with a specific seed to the random number generator.


Othello

public Othello(OthelloPlayer player1,
               OthelloPlayer player2,
               UserInterface ui)
Constructs a new othello game with the random number generator seeded randomly.

Method Detail

instantiatePlayer

public static OthelloPlayer instantiatePlayer(java.lang.String className,
                                              java.lang.String playerName)
                                       throws java.lang.InstantiationException,
                                              java.lang.IllegalAccessException,
                                              java.lang.IllegalArgumentException,
                                              java.lang.reflect.InvocationTargetException,
                                              java.lang.NoSuchMethodException,
                                              java.lang.ClassNotFoundException,
                                              java.lang.ClassCastException
Attempts to instantiate a new OthelloPlayer with the given playerName from the given class.

Throws:
java.lang.ClassNotFoundException - if the class named className was not found in the current classpath.
java.lang.NoSuchMethodException - if the given class does not have a constructor that takes a single String argument.
java.lang.InstantiationException - if className represents an abstract class.
java.lang.IllegalAccessException - if the constructor of className enforces Java language access control and the underlying constructor is inaccessible.
java.lang.IllegalArgumentException - if an unwrapping conversion for primitive arguments of the class' constructor fails.
java.lang.reflect.InvocationTargetException - if the constructor of className throws an exception.
java.lang.ClassCastException - if className does not extend OthelloPlayer.

play

public OthelloPlayer play()
Causes this othello game instance to play until completion, returning the winner. null is returned if the game resulted in a tie.


log

public void log(java.lang.Object message)
Logs a message to the user interface.


log

public void log(java.lang.String message)
Logs a message to the user interface.


main

public static void main(java.lang.String[] args)
Instantiates the players, loads the user interface, and plays the game until completion.


printUsage

public static void printUsage()
Prints command line usage information.


Othello 1.0

Copyright 2006–2007 Evan A. Sultanik