private List <Game> BuildCrossoverGames(List <Game> winnersBracketLosers, List <Game> losersBracketWinners)
        {
            if (winnersBracketLosers.Count != losersBracketWinners.Count)
            {
                throw new Exception();
            }
            var games         = new List <Game>();
            var rearrangedWBC = RearrangedWbc(winnersBracketLosers);

            for (int i = 0; i < winnersBracketLosers.Count; i++)
            {
                var p1 = new ParticipantSource
                {
                    GameNumber    = losersBracketWinners[i].GameNumber,
                    WinnerOrLoser = WinnerOrLoser.Winner
                };
                var p2 = new ParticipantSource
                {
                    GameNumber    = rearrangedWBC[i].GameNumber,
                    WinnerOrLoser = WinnerOrLoser.Loser
                };
                games.Add(BuildGame(p1, p2));
            }
            return(games);
        }
        private List <Game> BuildDependentGames(List <Game> prevRoundGames, WinnerOrLoser winnerOrLoser)
        {
            var games = new List <Game>();

            if (prevRoundGames.Count == 2)
            {
                var p1 = new ParticipantSource
                {
                    GameNumber    = prevRoundGames[0].GameNumber,
                    WinnerOrLoser = winnerOrLoser
                };
                var p2 = new ParticipantSource
                {
                    GameNumber    = prevRoundGames[1].GameNumber,
                    WinnerOrLoser = winnerOrLoser
                };
                games.Add(BuildGame(p1, p2));
                return(games);
            }

            var halves = Halves(prevRoundGames);

            games.AddRange(BuildDependentGames(halves.TopHalf, winnerOrLoser));
            games.AddRange(BuildDependentGames(halves.BottomHalf, winnerOrLoser));

            return(games);
        }
        private Game BuildGame(ParticipantSource p1, ParticipantSource p2)
        {
            var game = new Game
            {
                GameNumber = _gameCounter,
                P1Source   = p1,
                P2Source   = p2,
                Round      = _round,
            };

            _gameCounter++;
            return(game);
        }