Example #1
0
 private void initGame(int i_NumberOfGuesses)
 {
     m_Board = new Board(i_NumberOfGuesses);
     m_Board.PrintBoard();
     m_Letters = new RangeOfLetters();
     setRandomSolution();
     m_NewUserGuess = new UserGuess(k_SizeOfGuesses, m_Letters.m_ListOfLetterToChoose);
 }
Example #2
0
        private void setRandomSolution()
        {
            string chars = "ABCDEFGH";

            char[] solution = new char[k_SizeOfGuesses];
            m_RandomSolution = new char[k_SizeOfGuesses];
            Random random = new Random();

            for (int i = 0; i < k_SizeOfGuesses; i++)
            {
                int sizeOfList = m_Letters.m_ListOfLetterToChoose.Count;
                // check if the range of the letters is correct
                m_RandomSolution[i] = chars[random.Next(sizeOfList)];

                m_Letters.m_ListOfLetterToChoose.Remove(solution[i]);
            }

            m_Letters = new RangeOfLetters();
        }