Beispiel #1
0
        public string ExecuteRound()
        {
            int playerOneChoice = playerOne.DetermineGesture();
            int playerTwoChoice = playerTwo.DetermineGesture();

            int roundValue = (5 + playerOneChoice - playerTwoChoice) % 5;

            if (roundValue == 1 || roundValue == 3)
            {
                Console.WriteLine("Player One Wins!");
                string winner = "Player One Wins!";
                return(winner);
            }
            else if (roundValue == 2 || roundValue == 4)
            {
                Console.WriteLine("Player Two Wins!");
                string winner = "Player Two Wins!";
                return(winner);
            }
            else
            {
                Console.WriteLine("It's a tie!");
                return(null);
            }
        }
Beispiel #2
0
 //member methods(Can Do)
 public void RunGame()
 {
     DisplayInstructions();
     DetermineNumberOfPlayers();
     CreatePlayers();
     player1.ChooseName();
     player2.ChooseName();
     DisplayPlayerNames();
     while (player1.score < 2 && player2.score < 2)
     {
         player1.DetermineGesture();
         player2.DetermineGesture();
         CompareGestures();
     }
     DisplayWinner();
 }