Exemplo n.º 1
0
        public new void PlayGame(Func <string, string, string> inputWinner)
        {
            if (RoundBracket == null || GameIndex >= RoundBracket.Count / 2)
            {
                OrganizeLowerBracketRound();
            }

            var leftParticipant  = RoundBracket[GameIndex * 2];
            var rightParticipant = RoundBracket[GameIndex * 2 + 1];
            var game             = new Game(leftParticipant, rightParticipant);

            game.PlayGame(inputWinner, out string winner, out string loser);

            if (_isPlayingLastRound)
            {
                UpperBracketParticipants[GameIndex].SetName(winner);
            }
            else if (_isPlayingUpperBracket)
            {
                UpperBracketParticipants[GameIndex].SetName(winner);
                if (_lowerBracketParticipants?.Count < GameIndex * 2)
                {
                    _lowerBracketParticipants?.Insert(GameIndex, new Participant(loser));
                }
                else
                {
                    _lowerBracketParticipants?.Insert(GameIndex * 2, new Participant(loser));
                }
            }
            else
            {
                _lowerBracketParticipants[GameIndex].SetName(winner);
            }

            GameIndex++;
            BinarySaver.SaveDoubleToBinnary(this);
        }
Exemplo n.º 2
0
 public void PlayGame(Side side)
 {
     SetWinnersName(UpperBracketParticipants[GameIndex], side);
     GameIndex++;
     BinarySaver.SaveSingleToBinnary(this);
 }