Esempio n. 1
0
        private void WinnerDecleration()
        {
            StringBuilder outputMess = new StringBuilder();
            int           scorePlayer1, scorePlayer2;
            string        namePlayer1, namePlayer2;

            m_PlayGame.GetScore(out scorePlayer1, out scorePlayer2);
            m_PlayGame.GetPlayersNames(out namePlayer1, out namePlayer2);
            outputMess.Append(String.Format(@"Game has ended, score sheet is:
{0} has {1} points,
{2} has {3} points", namePlayer1, scorePlayer1, namePlayer2, scorePlayer2));
            outputMess.AppendLine();
            if (scorePlayer1 > scorePlayer2)
            {
                outputMess.AppendLine("The winner is: " + namePlayer1);
            }
            else if (scorePlayer2 > scorePlayer1)
            {
                outputMess.AppendLine("The winner is: " + namePlayer2);
            }
            else
            {
                outputMess.AppendLine("This is a tie ");
            }
            Console.WriteLine(outputMess);
        }