Exemplo n.º 1
0
 /*
  * Constructor for the AIPlayer object
  *
  * @param int wordSize
  * @return void
  */
 public AIPlayer(int wordSize)
 {
     // Create a FileController object apon instantiation of the AI Player and get all of the words from the dict that matches the users selected word length
     FileController controller = new FileController();
     controller.PopulateDictionary(wordSize);
     currentWordFamily = controller.GetDictionary();
     currentChosenWord = currentWordFamily[0];
 }
Exemplo n.º 2
0
        /*
         * Gets the word length to be used for the current game
         *
         * @param none
         * @return int
         */
        public int ValidateWordLength()
        {
            int wordLength = GetIntUserInput();

            FileController controller = new FileController();
            controller.PopulateDictionary(wordLength);

            while (controller.GetDictionary().Count == 0)
            {
                Console.WriteLine("Sorry there are no words with length: " + wordLength + ". Please try again.");
                wordLength = GetIntUserInput();
                controller.PopulateDictionary(wordLength);
            }

            return wordLength;
        }