using System.Collections.Generic;
namespace rock_paper_scissors_acp
public static void Main()
Console.WriteLine("Rock, Paper, Scissors!");
var game = new PlayGame();
_currentPlayerChoice = GameChoice.None;
_currentComputerChoice = GameChoice.None;
{ GameChoice.Rock, _rockGraphic },
{ GameChoice.Paper, _paperGraphic },
{ GameChoice.Scissors, _scissorsGraphic },
private int _playerScore;
private int _computerScore;
private GameChoice _currentPlayerChoice;
private GameChoice _currentComputerChoice;
private readonly string _rockGraphic = @"
private readonly string _paperGraphic = @"
private readonly string _scissorsGraphic = @"
private Dictionary<GameChoice, string> _graphics;
-------------------------------
| Player: {_playerScore} | Computer: {_computerScore} |
-------------------------------
What would you like to throw?
private void GetPlayerInput()
var input = Console.ReadKey().KeyChar.ToString();
if (!String.IsNullOrWhiteSpace(input) && int.TryParse(input, out int inputAsInt))
_currentPlayerChoice = (GameChoice)inputAsInt;
_currentComputerChoice = (GameChoice)(new Random().Next(1, 3));
ShowGraphicsForChoices();
DetermineOutcomeOfRound();
private void ShowGraphicsForChoices()
{_graphics[_currentPlayerChoice]}
{_graphics[_currentComputerChoice]}
Console.WriteLine(graphicResult);
private void DetermineOutcomeOfRound()
switch (_currentPlayerChoice)
switch (_currentComputerChoice)
EndRound(RoundResult.Draw);
EndRound(RoundResult.Lose);
case GameChoice.Scissors:
EndRound(RoundResult.Win);
switch (_currentComputerChoice)
EndRound(RoundResult.Win);
EndRound(RoundResult.Draw);
case GameChoice.Scissors:
EndRound(RoundResult.Lose);
case GameChoice.Scissors:
switch (_currentComputerChoice)
EndRound(RoundResult.Lose);
EndRound(RoundResult.Win);
case GameChoice.Scissors:
EndRound(RoundResult.Draw);
private void EndRound(RoundResult result)
if (_playerScore > 2 || _computerScore > 2)
Console.WriteLine($"You {result}!");
Console.Write("Press any key to play next round...");
private void DisplayFinalMessage()
bool isVictory = _playerScore > _computerScore;
string message = isVictory ? "YOU WIN!!!" : "YOU LOSE!!!";
Console.WriteLine(message);