org.dolben.MarkN
Class Generator

java.lang.Object
  extended by org.dolben.MarkN.Generator
Direct Known Subclasses:
BruteForceGenerator, MonitorsGenerator

public abstract class Generator
extends java.lang.Object

This is the interface for an N digit number game guess generator. Derive a class from this one with a constructor and the methods given here to implement some algorithm for generating guesses.

A Guesser repeatedly calls nextGuess() to get the next guess and then tellScore() to give the Generator the score for the last guess.


Constructor Summary
Generator()
           
 
Method Summary
abstract  boolean nextGuess(Numbah guess)
          makes the next guess
abstract  void retractScore()
          backs up the generator to the state before the last nextGuess()
abstract  void tellScore(Score score)
          is told a score for the last guess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Generator

public Generator()
Method Detail

nextGuess

public abstract boolean nextGuess(Numbah guess)
makes the next guess

Parameters:
guess - the guess that gets generated, if possible
Returns:
true iff it was possible to generate a next guess, if not, the "guess" does not change, and the previous score is forgotten

tellScore

public abstract void tellScore(Score score)
is told a score for the last guess

Parameters:
score - the score for the last guess - the score must be legit, though may be inconsistent with previous scores in which case nextGuess() will return false

retractScore

public abstract void retractScore()
backs up the generator to the state before the last nextGuess()