import java.util.Set;
import java.util.TreeSet;

/**
 * Class that provides the basic functionality needed to play Boggle.
 *   @author Dave Reed
 *   @version 10/27/13
 */
public class BoggleGame {
    private String DICT_FILE = "dictionary.txt";
        
    private BoggleBoard board;
    private Set<String> boardWords;
    
    /**
     * Costructs a Boggle board and initializes the game (using "dictionary.txt").
     */
    public BoggleGame() {
        this.board = new BoggleBoard(DICT_FILE);
        this.boardWords = board.allWords();
    }
    
    /**
     * Tries to identify a word on the board.
     *   @param word the word being tried
     *   @return true if that word is on the board and has not been guessed already;
     *           otherwise, false
     */
    public boolean tryWord(String word) {
        return this.boardWords.remove(word);
    }
    
    /**
     * Identifies the words on the Boggle board that have not been guessed.
     *   @return the Set of words not yet guessed
     */
    public Set<String> missedWords() {
        return this.boardWords;
    }
    
    /**
     * Extracts a printable representation of the Boggle board.
     *   @return the board as a String
     */
    public String getBoard() {
        return this.board.toString();
    }
}
