de.tabacha.cgo
Class AbstractEngine

java.lang.Object
  extended byde.tabacha.cgo.AbstractEngine
All Implemented Interfaces:
Constants, Engine
Direct Known Subclasses:
Dude, HumanPlayer, MikeGo, NoRecursionTemplate

public abstract class AbstractEngine
extends java.lang.Object
implements Engine, Constants

Basic implementation of Engine supports initialization and internationalization.
$Id: AbstractEngine.java,v 1.2 2004/07/30 21:43:34 mk Exp $

Version:
$Revision: 1.2 $

Field Summary
 
Fields inherited from interface de.tabacha.cgo.Constants
BALL, COL_COUNT, DCOL, DOWN, DROW, E, EMPTY, FIRST_DIRECTION, KICK_OFF_FIELD, LAST_DIRECTION, N, NE, NW, OPPOSITE, PIECE, ROW_COUNT, S, SE, SW, UP, UPSIDEDOWN, W
 
Constructor Summary
protected AbstractEngine()
          Constructor.
 
Method Summary
 boolean canPlayBothSides()
          This default implementation always returns false.
 java.lang.String getAuthor()
          Returns the localized version of the author property.
 java.lang.String getDescription()
          Returns the localized version of the description property.
protected  java.lang.String getI18nProperty(java.lang.String name)
          Returns a localized version of the requested property.
 java.lang.String getName()
          Returns the localized version of the name property.
 java.lang.String getVersion()
          Returns the localized version of the version property.
 void initGame(long randSeed)
          Initializes the random number generator.
protected  java.util.Random random()
          Subclasses should use this object for random decisions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.tabacha.cgo.Engine
think
 

Constructor Detail

AbstractEngine

protected AbstractEngine()
Constructor.

Method Detail

getI18nProperty

protected java.lang.String getI18nProperty(java.lang.String name)
Returns a localized version of the requested property.

Throws:
java.util.MissingResourceException - if the property cannot be found.
See Also:
ResourceBundle

getName

public java.lang.String getName()
Returns the localized version of the name property. If this property is the same for all languages or needs special treatment, overwrite this method.

Specified by:
getName in interface Engine
Throws:
java.util.MissingResourceException - if the property cannot be found.
See Also:
Engine.getName()

getVersion

public java.lang.String getVersion()
Returns the localized version of the version property. If this property is the same for all languages or needs special treatment, overwrite this method.

Specified by:
getVersion in interface Engine
Throws:
java.util.MissingResourceException - if the property cannot be found.
See Also:
Engine.getVersion()

getDescription

public java.lang.String getDescription()
Returns the localized version of the description property. If this property is the same for all languages or needs special treatment, overwrite this method.

Specified by:
getDescription in interface Engine
Throws:
java.util.MissingResourceException - if the property cannot be found.
See Also:
Engine.getDescription()

getAuthor

public java.lang.String getAuthor()
Returns the localized version of the author property. If this property is the same for all languages or needs special treatment, overwrite this method.

Specified by:
getAuthor in interface Engine
Throws:
java.util.MissingResourceException - if the property cannot be found.
See Also:
Engine.getAuthor()

canPlayBothSides

public boolean canPlayBothSides()
This default implementation always returns false.

Specified by:
canPlayBothSides in interface Engine
See Also:
Engine.canPlayBothSides()

initGame

public void initGame(long randSeed)
Initializes the random number generator.

Specified by:
initGame in interface Engine
Parameters:
randSeed - For initializing a random number generator. Makes it possible to repeat a game entirely; useful for testing.

random

protected final java.util.Random random()
Subclasses should use this object for random decisions.