예제 #1
0
        public SeriesResults Start()
        {
            var matches = new List <Task <GameScore> >();

            _rounds.Times(() => StartMatch(matches));
            Task.WaitAll(matches.Where(m => m != null).ToArray());
            var seriesResults = new SeriesResults();

            seriesResults.AddRange(matches.Select(m => m.Result));
            return(seriesResults);
        }
예제 #2
0
        public RoundResults Start()
        {
            var winners = new Population();

            var competitors = new Population(_competitors);

            var gameScores = new SeriesResults();

            do
            {
                var playersInCurrentGame = new Population();
                var game       = _gameBuilder.Initialize(MakeGameSpec(competitors, playersInCurrentGame), _gameScopeFactory());
                var gameResult = game.Start();
                gameScores.Add(gameResult);
                var winner = playersInCurrentGame.Single(c => c.Id.ToString() == gameResult.WinningPlayer.Id.ToString());
                winners.Add(winner);
            } while (competitors.Count > 0);

            return(new RoundResults
            {
                Winners = winners,
                Scores = gameScores
            });
        }
예제 #3
0
 public RoundResults()
 {
     Winners = new Population();
     Scores  = new SeriesResults();
 }