Class StateSpeller

java.lang.Object
  extended by StateSpeller

public class StateSpeller
extends java.lang.Object

This class contains methods for solving The following puzzle, presented by Will Shortz on NPR's weekend edition on February 19th, 2012:

 The word marten, as in the animal, consists of the beginning 
 letters of Mississippi, Arkansas, Texas, and New Mexico. And 
 you can actually drive from Mississippi to Arkansas to Texas 
 to New Mexico, in that order. What is the longest common 
 English word you can spell by taking the beginning letters 
 of consecutive states in order, as you travel through them? 
 My answer has eight letters. Maybe you can better mine. 
 The longest answer will win. 
 

Version:
V1.0, 03/2012
Author:
Nathan Sprague and ??

Constructor Summary
StateSpeller(WordTree wordTree, StateGraph stateGraph)
          Construct a StateSpeller.
 
Method Summary
 java.util.ArrayList<java.lang.String> anyWords(int minLength)
          Return an ArrayList of solution strings where each string represents a word that can be created by driving from one state to the next using the beginning letters of each state name.
 java.util.ArrayList<java.lang.String> firstLetterWords(int minLength)
          Return an ArrayList of solution strings where each string represents a word that can be created by driving from one state to the next using the first letter of each state name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateSpeller

public StateSpeller(WordTree wordTree,
                    StateGraph stateGraph)
Construct a StateSpeller.

Parameters:
wordTree - Initialized word tree.
stateGraph - Initialized state graph.
Method Detail

firstLetterWords

public java.util.ArrayList<java.lang.String> firstLetterWords(int minLength)
Return an ArrayList of solution strings where each string represents a word that can be created by driving from one state to the next using the first letter of each state name. States may not be revisited. The format for each solution string is:
word length [state1, state2, ... , stateN]
Where word is an English word and length is the number of letters in that word. All solutions at least as long as minLength will be returned.

Parameters:
minLength - The minimum solution length
Returns:
ArrayList of solution strings.

anyWords

public java.util.ArrayList<java.lang.String> anyWords(int minLength)
Return an ArrayList of solution strings where each string represents a word that can be created by driving from one state to the next using the beginning letters of each state name. States may not be revisited. The format for each solution string is:
word length [state1, state2, ... , stateN]
Where word is an English word and length is the number of letters in that word. All solutions at least as long as minLength will be returned.

Parameters:
minLength - The minimum solution length
Returns:
ArrayList of solution strings.