Class Generator

  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
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


public Generator()
Method Detail


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

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


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

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


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