Example #1
0
        public List <IGame> GetGamesInString(string scores)
        {
            Queue <int>  scoresQueue   = new Queue <int>(scores.Split(',').Select(int.Parse).ToList());
            List <IGame> gamesInString = new List <IGame>();

            while (scoresQueue.Count > 0)
            {
                IGame newGame = _gameFactory.BuildGame();
                gamesInString.Add(newGame);
                while (newGame.IsFinished == false)
                {
                    if (scoresQueue.Count == 0)
                    {
                        break;
                    }
                    newGame.AddScore(scoresQueue.Dequeue());
                }
            }
            return(gamesInString);
        }