Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Diagnostics.Eventing.Reader;
- using System.Linq;
- using System.Net;
- using System.Security.Policy;
- using System.Text;
- using System.Threading.Tasks;
- namespace RPSSS
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool continuePlaying = true;
- int playerScore = 0;
- int computerScore = 0;
- // THE GAME \\
- while (continuePlaying)
- {
- Console.WriteLine("Player Score:" + playerScore);
- Console.WriteLine("Computer Score:" + computerScore);
- //player Score
- Random random = new Random();
- Hand hand = new Hand();
- Hand butt = new Hand();
- Console.WriteLine("Please enter your attacking super mind blown hand...fart");
- Console.WriteLine("Choose either an 'r' or 'p' or 's' ");
- var playerInput = Console.ReadLine();
- //Computer Score
- string computerMove = butt.GetHand(random.Next(0, 3));
- Console.WriteLine(computerMove);
- // Evaluate
- switch (playerInput)
- {
- case "r":
- switch (computerMove)
- {
- case "s":
- playerScore++;
- break;
- case "p":
- computerScore++;
- break;
- case "r":
- break;
- }
- break;
- case "p":
- switch (computerMove)
- {
- case "s":
- computerScore++;
- break;
- case "p":
- break;
- case "r":
- playerScore++;
- break;
- }
- break;
- case "s":
- switch (computerMove)
- {
- case "s":
- break;
- case "p":
- playerScore++;
- break;
- case "r":
- computerScore++;
- break;
- }
- break;
- }
- if (playerScore > computerScore)
- {
- Console.WriteLine("You won with a score of " + playerScore);
- }
- else
- {
- Console.WriteLine("computer won with a score of " + computerScore);
- }
- Console.WriteLine("Would you like to continue?---enter(y) or (n)");
- var reply = Console.ReadLine();
- if (reply == "n")
- {
- continuePlaying = false;
- }
- }
- }
- }
- public class Hand
- {
- public string GetHand(int random)
- {
- var rpc = new List<String> { "r", "p", "s" };
- var attack = rpc[random];
- return attack;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement