becker.xtras.jotto
Class SampleHintConsistentWithGuesses

java.lang.Object
  extended by becker.xtras.jotto.Hint
      extended by becker.xtras.jotto.SampleHintConsistentWithGuesses
All Implemented Interfaces:
IWordPredicate

public class SampleHintConsistentWithGuesses
extends Hint

Provide a hint consisting of words that are consistent with all previous guesses by the user. That is, suppose a word under consideration, w actually were the target. Would all the previous guesses give the same number of partial and exact matches when compared against w as they did when they were compared against the target?

The Hint object will need to be constructed with a list of known words and an evaluator object.

Author:
Byron Weber Becker

Field Summary
 
Fields inherited from class becker.xtras.jotto.Hint
DIFFICULTY, GUESSES, LETTER, LETTERS, NONE
 
Constructor Summary
SampleHintConsistentWithGuesses(IGuessEvaluator eval)
           
 
Method Summary
 Word[] getHintWords(int maxDesired, IHintData hintData)
          Get the words to display as the hint.
 boolean isOK(Word w)
          Override this method to specify whether or not the Word w is an acceptable answer for this hint.
 void setArgument(Guess[] guesses)
           
 
Methods inherited from class becker.xtras.jotto.Hint
getArgumentType, getDescription, main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleHintConsistentWithGuesses

public SampleHintConsistentWithGuesses(IGuessEvaluator eval)
Method Detail

isOK

public boolean isOK(Word w)
Description copied from class: Hint
Override this method to specify whether or not the Word w is an acceptable answer for this hint.

Specified by:
isOK in interface IWordPredicate
Specified by:
isOK in class Hint
Parameters:
w - The word to test.
Returns:
true if the word should be included in the hint's answer; false otherwise.

setArgument

public void setArgument(Guess[] guesses)

getHintWords

public Word[] getHintWords(int maxDesired,
                           IHintData hintData)
Description copied from class: Hint
Get the words to display as the hint.

Specified by:
getHintWords in class Hint
Returns:
the words in the list of known words that satisfies the isOK method.