Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private WordPairResult GetOrMakeResult(WordsPair pair)
        {
            WordPairResult result;

            if (_wordToResultDict.ContainsKey(pair))
            {
                result = _wordToResultDict[pair];
            }
            else
            {
                result = new WordPairResult();
                _wordToResultDict.Add(pair, result);
            }
            return(result);
        }
Esempio n. 3
0
        public void AddCorrect(WordsPair pair)
        {
            var result = GetOrMakeResult(pair);

            result.IncCorrect();
        }
Esempio n. 4
0
        public void AddBad(WordsPair pair)
        {
            var result = GetOrMakeResult(pair);

            result.IncBad();
        }