示例#1
0
        public Member GetWinner()
        {
            //Kan bara få fram vinnare om man kört 3ggr
            if (GameSeries.Count() != 3)
            {
                return(null);
            }
            int player1ScoreNum = 0;
            int player2ScoreNum = 0;

            //Loppar alla serier
            foreach (GameSerie serie in GameSeries)
            {
                //Sumemrar ihop bådas score från alla serier o i slutet if ...
                player1ScoreNum += serie.Player1Score;
                player2ScoreNum += serie.Player2Score;
            }

            if (player1ScoreNum > player2ScoreNum)
            {
                return(Player1);
            }
            if (player2ScoreNum > player2ScoreNum)
            {
                return(Player2);
            }
        }
示例#2
0
        public Member GetWinner()
        {
            if (GameSeries.Count() < 3)
            {
                return(null);
            }
            int player1ScoreNum = 0;
            int player2ScoreNum = 0;

            foreach (GameSerie serie in GameSeries)
            {
                player1ScoreNum += serie.Player1Score;
                player2ScoreNum += serie.Player2Score;
            }
            if (player1ScoreNum > player2ScoreNum)
            {
                return(Player1);
            }
            if (player1ScoreNum < player2ScoreNum)
            {
                return(Player2);
            }
            return(null);
        }