Пример #1
0
 /// <summary>
 /// This above method checks the string values playerChoice and computerChoice and subsequently
 /// displays a message saying whether or not the player has won whilst also increasing the
 /// value of either ComputerScore or PlayerScore. If it is a win, the score is incremented by 2
 /// if it is a draw, both scores are incremented by 1.
 /// </summary>
 private void drawPlayerChoice()
 {
     if (playerChoice == "SCISSORS")
     {
         DrawImages.drawScissors(10, 5);
     }
     else if (playerChoice == "PAPER")
     {
         DrawImages.drawPaper(10, 5);
     }
     else if (playerChoice == "STONE")
     {
         DrawImages.drawStone(10, 5);
     }
 }
Пример #2
0
        /// <summary>
        /// This gets the player choice and saves it within the playerChoice string. Whether or not the user
        /// types in lowercase or uppercase, the players choice is made uppercase using .ToUpper
        /// </summary>
        ///
        private void getComputerChoice()
        {
            int num;

            num = randomGenerator.Next(3);  // pick a random number (0, 1 or 2)
            if (num == 0)
            {
                computerChoice = "SCISSORS";
                DrawImages.drawScissors(10, 20);
            }
            if (num == 1)
            {
                computerChoice = "PAPER";
                DrawImages.drawPaper(10, 20);
            }
            if (num == 2)
            {
                computerChoice = "STONE";
                DrawImages.drawStone(10, 20);
            }
        }