org.jscience.computing.game.awari
Class AwariGame

java.lang.Object
  extended by org.jscience.computing.game.AbstractGame
      extended by org.jscience.computing.game.awari.AwariGame
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, GamePlay

public class AwariGame
extends AbstractGame

AwariGame implements an ancient African game (for all I know). The board positions are configured as follows:

   13 12 11 10  9  8
  0                    7    1  2  3  4  5  6

See Also:
Serialized Form

Constructor Summary
AwariGame()
          Creates a new AwariGame object.
 
Method Summary
 java.lang.Object clone()
          DOCUMENT ME!
 int getBaseCount(int player)
          DOCUMENT ME!
 double getLead(int playerRole)
          returns the lead as in difference in number of pegs during the game
 double getResult(int playerRole)
          returns the difference in number of pegs once the game is over
 int[] getWinner()
          if the game is even, all players win
protected  GameMove[] listLegalMoves()
          DOCUMENT ME!
 int nextPlayer()
          DOCUMENT ME!
protected  boolean popMove()
          DOCUMENT ME!
protected  boolean pushMove(GameMove move)
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.computing.game.AbstractGame
clearRedoList, gameOver, getGameName, getLastMove, getLastPlayer, getLegalMoves, getLegalMoves, getMoveHistory, getNumberOfRedoMoves, getRedoList, isLegalMove, isWinner, loadFromFile, makeMove, numberOfMoves, numberOfPlayers, redoMove, resetLegalMoves, resetLists, saveToFile, spawnChild, undoLastMove, undoMoves
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AwariGame

public AwariGame()
Creates a new AwariGame object.

Method Detail

listLegalMoves

protected GameMove[] listLegalMoves()
DOCUMENT ME!

Specified by:
listLegalMoves in class AbstractGame
Returns:
DOCUMENT ME!

pushMove

protected boolean pushMove(GameMove move)
DOCUMENT ME!

Specified by:
pushMove in class AbstractGame
Parameters:
move - DOCUMENT ME!
Returns:
DOCUMENT ME!

popMove

protected boolean popMove()
DOCUMENT ME!

Specified by:
popMove in class AbstractGame
Returns:
DOCUMENT ME!

nextPlayer

public int nextPlayer()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getWinner

public int[] getWinner()
if the game is even, all players win

Returns:
DOCUMENT ME!

getResult

public double getResult(int playerRole)
                 throws GameRuntimeException
returns the difference in number of pegs once the game is over

Specified by:
getResult in interface GamePlay
Overrides:
getResult in class AbstractGame
Parameters:
playerRole - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
GameRuntimeException - DOCUMENT ME!

getLead

public double getLead(int playerRole)
returns the lead as in difference in number of pegs during the game

Parameters:
playerRole - DOCUMENT ME!
Returns:
DOCUMENT ME!

getBaseCount

public int getBaseCount(int player)
DOCUMENT ME!

Parameters:
player - DOCUMENT ME!
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class AbstractGame
Returns:
DOCUMENT ME!

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
DOCUMENT ME!

Specified by:
clone in interface GamePlay
Overrides:
clone in class AbstractGame
Returns:
DOCUMENT ME!
Throws:
java.lang.CloneNotSupportedException - DOCUMENT ME!
See Also:
AbstractGame.spawnChild(GameMove)