Class GenerationGame

java.lang.Object
  |
  +--GenerationGame
Direct Known Subclasses:
MasterGame

public abstract class GenerationGame
extends java.lang.Object

A generation game is any game in which there is a game status which changes autonomously in steps, called generations. It must also take a single command-line argument, normally containing a filename describing the initial game status.


Field Summary
protected  java.lang.String gameFile
          the file to be read to establish the initial game position
 
Constructor Summary
(package private) GenerationGame()
          The no-argument constructor should not be used.
(package private) GenerationGame(java.lang.String[] args)
          Creates a game.
 
Method Summary
(package private) abstract  java.lang.String next()
          Run the next generation
(package private) abstract  void play()
          Start the game
(package private) abstract  java.lang.String sendMessage(java.lang.Object recipient, java.lang.String msg)
          Send a message to an object.
(package private) abstract  java.lang.Object spySetup()
          Determine what object to spy on, probably by asking the user
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gameFile

protected java.lang.String gameFile
the file to be read to establish the initial game position
Constructor Detail

GenerationGame

GenerationGame()
The no-argument constructor should not be used.

GenerationGame

GenerationGame(java.lang.String[] args)
Creates a game. With luck, there is exactly one command line argument and we'll make a note of it.
Parameters:
args - the args[] array passed to main
Method Detail

next

abstract java.lang.String next()
Run the next generation
Returns:
a string describing the new status

play

abstract void play()
Start the game

sendMessage

abstract java.lang.String sendMessage(java.lang.Object recipient,
                                      java.lang.String msg)
Send a message to an object.
Parameters:
recipient - the object to receive the message. Defined as Object here, but generally it will be some special type known to the game.
msg - a message string. The format, if any, will depend on the specific game.
Returns:
the answer string

spySetup

abstract java.lang.Object spySetup()
Determine what object to spy on, probably by asking the user
Returns:
an object on which to spy