コード例 #1
0
        static void Main(string[] args)
        {
            Random random         = new Random();
            var    rdmnumber      = random.Next(3);
            var    playerRock     = new PlayerRock();
            var    playerPaper    = new PlayerPaper();
            var    playerScissors = new PlayerScissors();

            for (var i = 0; i <= 99; i++)
            {
                rdmnumber = random.Next(3);

                if (rdmnumber == 0)
                {
                    Fight(playerRock, playerPaper);
                }
                else if (rdmnumber == 1)
                {
                    Fight(playerRock, playerScissors);
                }
                else if (rdmnumber == 2)
                {
                    Fight(playerScissors, playerPaper);
                }
            }
            Console.WriteLine(playerRock.NumberOfWins + " Rock");
            Console.WriteLine(playerPaper.NumberOfWins + " Paper");;
            Console.WriteLine(playerScissors.NumberOfWins + " Scissors");
            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Random random = new Random();
            var rdmnumber = random.Next(3);
            var playerRock = new PlayerRock();
            var playerPaper = new PlayerPaper();
            var playerScissors = new PlayerScissors();
            for (var i = 0; i <= 99; i++)
            {
                 rdmnumber = random.Next(3);

                if (rdmnumber == 0)
                {
                    Fight(playerRock, playerPaper);
                }
               else if (rdmnumber == 1)
                {
                    Fight(playerRock, playerScissors);
                }
                else if (rdmnumber == 2)
                {
                    Fight(playerScissors, playerPaper);
                }
            }
            Console.WriteLine(playerRock.NumberOfWins +  " Rock");
            Console.WriteLine(playerPaper.NumberOfWins + " Paper"); ;
            Console.WriteLine(playerScissors.NumberOfWins + " Scissors");
            Console.ReadLine();
        }