private void CreateEncodeWord() { EncodedWord = Word; List <char> goodLetters = GoodGuesses.Select(g => g.Letter).ToList(); foreach (char c in Word.Distinct()) { if (!goodLetters.Contains(c)) { EncodedWord = EncodedWord.Replace(c, '_'); } } }
private void AddCharGuess(CharGuess guess) { AllGuesses.Add(guess); if (guess.IsGoodGuess) { GoodGuesses.Add(guess); CreateEncodeWord(); if (EvaluateWord(EncodedWord)) { FinishGame(true); } } else { BadGuesses.Add(guess); EndGameIfLost(); } UpdateReadOnlyProperties(); }