Example #1
0
        public void PlayGame(IRPSPlayer p1, IRPSPlayer p2)
        {
            Choices p1Choice = p1.GetChoice();
            Choices p2Choice = p2.GetChoice();

            if (p1Choice == p2Choice)
            {
                Console.WriteLine($"{p1.Name} and {p2.Name} have tied");
            }
            else if (p1Choice == Choices.Rock && p2Choice == Choices.Scissors ||
                     p1Choice == Choices.Scissors && p2Choice == Choices.Paper ||
                     p1Choice == Choices.Paper && p2Choice == Choices.Rock)
            {
                Console.WriteLine($"{p1.Name} has defeated {p2.Name}!");
            }
            else
            {
                Console.WriteLine($"{p2.Name} has defeated {p1.Name}!");
            }
        }
Example #2
0
        public void PlayGame(IRPSPlayer p1, IRPSPlayer p2)
        {
            RPSChoice p1Choice = p1.GetChoice();
            RPSChoice p2Choice = p2.GetChoice();

            if (p1Choice == p2Choice)
            {
                ConsoleOutput.TieMessage(p1, p2);
            }
            else if (p1Choice == RPSChoice.Rock && p2Choice == RPSChoice.Scissors ||
                     p1Choice == RPSChoice.Paper && p2Choice == RPSChoice.Rock ||
                     p1Choice == RPSChoice.Scissors && p2Choice == RPSChoice.Paper)
            {
                ConsoleOutput.P1WinMessage(p1);
            }
            //else if(p2Choice == RPSChoice.Nuke)
            //{
            //    ConsoleOutput.P1NukedMessage(p1);
            //}
            else
            {
                ConsoleOutput.P2WinMessage(p2);
            }
        }