public static void Main(string[] args) { Console.WriteLine("Welcome to Rock Paper Scissors!\n"); var playGame = new RoshamboApp(); int wins = 0, loss = 0, draw = 0, temp; var player = new PlayerChoice(); player.GetName(); do { temp = playGame.PlayGame(player); if (temp == 1) { wins++; } else if (temp == 2) { loss++; } else { draw++; } Console.WriteLine($"\nWins: {wins} \nLosses: {loss} \nDraws: {draw}"); Console.WriteLine("\nPlay again?"); } while (Console.ReadLine() == "y"); Console.WriteLine("\nThanks for playing!!!"); }
public int PlayGame(PlayerChoice playerChoice) { var playerClass = new Validate().PlayerVS(); playerChoice.GenerateRoshambo(); Console.WriteLine($"{playerChoice.Name} picked: {playerChoice.Roshambo}"); if (playerClass == "1") { //var playerRock = new PlayerRock(); Console.WriteLine($"AI picked: {Roshambo.Rock}\n"); if (playerChoice.Roshambo == Roshambo.Rock) { Console.WriteLine("Draw!!!"); return(0); } else if (playerChoice.Roshambo == Roshambo.Paper) { Console.WriteLine("YOU WIN!!!"); return(1); } else { Console.WriteLine("You suck!!!"); return(2); } } else { var playerRandom = new PlayerRandom(); Console.WriteLine($"AI picked: {playerRandom.Roshambo}\n"); if (playerChoice.Roshambo == Roshambo.Rock) { if (playerRandom.Roshambo == Roshambo.Rock) { Console.WriteLine("Draw"); return(0); } else if (playerRandom.Roshambo == Roshambo.Paper) { Console.WriteLine("You suck!!!"); return(2); } else { Console.WriteLine("YOU WIN!!!"); return(1); } } else if (playerChoice.Roshambo == Roshambo.Paper) { if (playerRandom.Roshambo == Roshambo.Paper) { Console.WriteLine("Draw"); return(0); } else if (playerRandom.Roshambo == Roshambo.Scissors) { Console.WriteLine("You suck!!!"); return(2); } else { Console.WriteLine("YOU WIN!!!"); return(1); } } else if (playerChoice.Roshambo == Roshambo.Scissors) { if (playerRandom.Roshambo == Roshambo.Scissors) { Console.WriteLine("Draw"); return(0); } else if (playerRandom.Roshambo == Roshambo.Rock) { Console.WriteLine("You suck!!!"); return(2); } else { Console.WriteLine("YOU WIN!!!"); return(1); } } return(-1);//required here because visual studios on mac throws error } }