public async Task <GuessLetter> CreateGuessLetter(GuessWord guessWord, string guessLetter) { var newGuessLetter = new GuessLetter() { GuessWord = guessWord, GuessWordId = guessWord.Id, Letter = guessLetter }; await _repositoryGuessLetter.Save(newGuessLetter); return(newGuessLetter); }
public Word(string word) { FindedLetters = 0; if (String.IsNullOrWhiteSpace(word)) { throw new Exception("Wrong Word!"); } for (int i = 0; i < word.Length; i++) { GuessWord.Add(word[i]); } }
public void guessWord(GuessWord command) { if (this.GameOver) { throw new DomainException( $"[{this.gameId.ToString()}] Failed to apply GuessWord command! {this.gameEndReason}"); } if (command.Word == this.word) { this.Record(new WordGuessed(command.Word)); this.Record(new GameWon("Word guessed")); } else { this.Record(new WordNotGuessed(command.Word)); this.Record(new GameLost("Word not guessed")); } }
public IEnumerable <string> GetGuessWordStateSoFar(GuessWord guessWord) { var allGuessedLetters = guessWord.GuessLetters.Select(letter => letter.Letter); return(_gameLogic.GetGuessWordSoFar(allGuessedLetters, guessWord.Word)); }