public PlayResult Play(IWordDict words) { var results = new PlayResult(); IsExit = false; while (!IsExit) { _currentWordsPair = words.GetPair(); bool isExit; var pairResult = _playStrategy.PlayOnePair(_currentWordsPair, new IsExitEnums(), out isExit); if (pairResult) { results.AddCorrect(_currentWordsPair); } else { results.AddBad(_currentWordsPair); } IsExit = isExit; } return(results); }
private WordPairResult GetOrMakeResult(WordsPair pair) { WordPairResult result; if (_wordToResultDict.ContainsKey(pair)) { result = _wordToResultDict[pair]; } else { result = new WordPairResult(); _wordToResultDict.Add(pair, result); } return(result); }
public void AddCorrect(WordsPair pair) { var result = GetOrMakeResult(pair); result.IncCorrect(); }
public void AddBad(WordsPair pair) { var result = GetOrMakeResult(pair); result.IncBad(); }