private void hardDiff_Click(object sender, EventArgs e) { difficulty diff = new difficulty(); word word = new word(); // Sets the count to 0. count = 0; // Sets the string displayWord to the returned value from getWord_hard. String displayWord = word.getWord_hard(count); // Displays the word to the user. guessWordBox.Text = displayWord; // Shows the correct label for the difficulty chosen. easyDiffLabel.Show(); medDiffLabel.Hide(); hardDiffLabel.Hide(); // Shows the new word button. newWordButton.Show(); // Sets the difficulty variable to 3 (hard) difficulty = 3; //WB Tetsing Console.WriteLine("Hard Button Press"); Console.WriteLine("Expected difficulty HARD"); Console.WriteLine("Difficulty: " + difficulty); Console.WriteLine("Count: " + count); Console.WriteLine("Current Word: " + displayWord); }
private void submitWord_Click(object sender, EventArgs e) { difficulty diff = new difficulty(); word word = new word(); // Gets user input and stores in String variable userAnswer. String userAnswer = answerWordBox.Text; // If difficulty is easy. if (difficulty == 1) { // Sets vaiable result with returned value from compareWord method. bool result = word.compareWord_easy(userAnswer, count); // If result is true. if (result == true) { // New Word // Increase count. count++; // Get new word. String displayWord = word.getWord_easy(count); // Display new word to user. guessWordBox.Text = displayWord; // Increase Score. score++; //WB Testing Console.WriteLine("Submit Button Press"); Console.WriteLine("Returned value: " + result); Console.WriteLine("New Count: " + count); Console.WriteLine("New Score: " + score); } else { // Minus one from score. score--; // Show message box containing error message. MessageBox.Show("Thats Incorrect -1 Point"); //WB Testing Console.WriteLine("Submit Button Press"); Console.WriteLine("Returned value: " + result); Console.WriteLine("New Count: " + count); Console.WriteLine("New Score: " + score); } scoreLabel.Text = score.ToString(); } // If difficulty is medium. if (difficulty == 2) { bool result = word.compareWord_med(userAnswer, count); if (result == true) { // New Word // Increase count. count++; // Get new word. String displayWord = word.getWord_med(count); // Display new word to user. guessWordBox.Text = displayWord; // Increase Score. score++; //WB Testing Console.WriteLine("Submit Button Press"); Console.WriteLine("Returned value: " + result); Console.WriteLine("New Count: " + count); Console.WriteLine("New Score: " + score); } else { // Minus one from score. score--; // Show message box containing error message. MessageBox.Show("Thats Incorrect -1 Point"); //WB Testing Console.WriteLine("Submit Button Press"); Console.WriteLine("Returned value: " + result); Console.WriteLine("New Count: " + count); Console.WriteLine("New Score: " + score); } scoreLabel.Text = score.ToString(); } // If difficulty is hard. if (difficulty == 3) { bool result = word.compareWord_hard(userAnswer, count); if (result == true) { // New Word // Increase count. count++; // Get new word. String displayWord = word.getWord_hard(count); // Display new word to user. guessWordBox.Text = displayWord; // Increase Score. score++; //WB Testing Console.WriteLine("Submit Button Press"); Console.WriteLine("Returned value: " + result); Console.WriteLine("New Count: " + count); Console.WriteLine("New Score: " + score); } else { // Minus one from score. score--; // Show message box containing error message. MessageBox.Show("Thats Incorrect -1 Point"); //WB Testing Console.WriteLine("Submit Button Press"); Console.WriteLine("Returned value: " + result); Console.WriteLine("New Count: " + count); Console.WriteLine("New Score: " + score); } scoreLabel.Text = score.ToString(); } }
private void newWordButton_Click(object sender, EventArgs e) { difficulty diff = new difficulty(); // Increase Count. count++; // If difficulty is easy. if (difficulty == 1) { word word = new word(); // Get easy word from file. String displayWord = word.getWord_easy(count); // Display word to user. guessWordBox.Text = displayWord; //WB Testing Console.WriteLine("New Word Button Press"); Console.WriteLine("Expected Difficulty EASY"); Console.WriteLine("Difficulty: " + difficulty); Console.WriteLine("New word displayed: " + displayWord); } // If difficulty is medium. if (difficulty == 2) { word word = new word(); // Get medium word from file. String displayWord = word.getWord_med(count); // Display word to user. guessWordBox.Text = displayWord; //WB Testing Console.WriteLine("New Word Button Press"); Console.WriteLine("Expected Difficulty MEDIUM"); Console.WriteLine("Difficulty: " + difficulty); Console.WriteLine("New word displayed: " + displayWord); } // If difficulty is hard. if (difficulty == 3) { word word = new word(); // Get hard word from file. String displayWord = word.getWord_hard(count); // Display word to user. guessWordBox.Text = displayWord; //WB Testing Console.WriteLine("New Word Button Press"); Console.WriteLine("Expected Difficulty HARD"); Console.WriteLine("Difficulty: " + difficulty); Console.WriteLine("New word displayed: " + displayWord); } //WB Testing Console.WriteLine("New Count: " + count); }