Ejemplo n.º 1
0
        private static bool CheckForWinner(Player thePlayer, Player Opponent)
        {
            Values playerChoice = thePlayer.GenerateRoShamBo();
            Values oppChoice    = Opponent.GenerateRoShamBo();

            Console.WriteLine($"\n{Opponent.Name}'s Move: {(oppChoice)}");
            Console.WriteLine($"{thePlayer.Name}'s Move: {(playerChoice)}\n");

            if ((oppChoice == Values.ROCK && playerChoice == Values.SCISSORS) || (oppChoice == Values.PAPER && playerChoice == Values.ROCK) ||
                (oppChoice == Values.SCISSORS && playerChoice == Values.PAPER))
            {
                Opponent.Wins++;
                Console.WriteLine($"{Opponent.Name} wins!");
            }
            else if (playerChoice == oppChoice)
            {
                Console.WriteLine("Tie! Nobody wins!");
                return(false);
            }
            else
            {
                thePlayer.Wins++;
                Console.WriteLine($"{thePlayer.Name} wins!");
            }

            return(true);
        }