Пример #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>
        /// Player score and Computer Score and labelled
        /// </summary>

        private void finish()
        {
            Console.Clear();
            Console.WriteLine("Program Over !!!");
            Console.WriteLine("=============");
            Console.WriteLine("Player Score: " + PlayerScore);
            Console.WriteLine("Computer Score: " + ComputerScore);

            if (PlayerScore > ComputerScore)
            {
                DrawImages.drawThumbsUp();
            }
            if (PlayerScore < ComputerScore)
            {
                DrawImages.drawThumbsDown();
            }
            if (PlayerScore == ComputerScore)
            {
                DrawImages.drawSmile();
            }
        }
Пример #3
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);
            }
        }