import java.io.*;
import java.util.Random;

public class WordList
{
	private GameWord myWords[];
	private int myCurrentWord;
	private int myNumberOfWords;
	
	public WordList() throws IOException
	{
		String inputLine;
		//store words in an array of strings
		//myWords = new GameWord[30];
		
		//set up file reader
		FileReader reader = new FileReader("words.txt");
		BufferedReader in = new BufferedReader(reader);
		
		inputLine = in.readLine();
		myNumberOfWords = new Integer(inputLine).intValue();
		myWords = new GameWord[myNumberOfWords+1];		
		for (int i=0; i<myNumberOfWords; i++)
		{
			myWords[i] = new GameWord(in.readLine());
			//System.out.println(i+": "+myWords[i]);
		}
		
	}
	
	public GameWord getTestWord(int x)
	//returns the xth word in the wordlist
	{
		myCurrentWord = x;
		return myWords[x];
	}
	public GameWord getNewWord()
	//returns a random word from the wordlist
	{
		Random rnd = new Random();
		myCurrentWord =  rnd.nextInt(myNumberOfWords);
		return myWords[myCurrentWord];
	}
}
