private void CheckLetter(string letter) { var found = false; for (int i = 0; i < word.Length; i++) { if (word[i].ToString() == letter) { found = true; SecretWord[i] = letter; } } if (!found) { errors += 1; HangmanImage = $".\\images\\{errors}.png"; if (errors == 6) { MessageBox.Show("You Lose!!!", "Nooo!!!"); ResetGame(); } } else { if (SecretWord.All(x => x != "?")) { MessageBox.Show("You Win!!!", "Yes!!!"); ResetGame(); } } }
public bool Won() { return(SecretWord.All(letter => GuessLetters.Contains(letter))); }