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); }
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 }); }
public RoundResults() { Winners = new Population(); Scores = new SeriesResults(); }