Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Diagnostics.Eventing.Reader;
  5. using System.Linq;
  6. using System.Net;
  7. using System.Security.Policy;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10.  
  11. namespace RPSSS
  12. {
  13. class Program
  14. {
  15. static void Main(string[] args)
  16. {
  17. bool continuePlaying = true;
  18. int playerScore = 0;
  19. int computerScore = 0;
  20.  
  21. // THE GAME \\
  22. while (continuePlaying)
  23. {
  24. Console.WriteLine("Player Score:" + playerScore);
  25. Console.WriteLine("Computer Score:" + computerScore);
  26.  
  27. //player Score
  28. Random random = new Random();
  29. Hand hand = new Hand();
  30. Hand butt = new Hand();
  31. Console.WriteLine("Please enter your attacking super mind blown hand...fart");
  32. Console.WriteLine("Choose either an 'r' or 'p' or 's' ");
  33. var playerInput = Console.ReadLine();
  34.  
  35. //Computer Score
  36. string computerMove = butt.GetHand(random.Next(0, 3));
  37. Console.WriteLine(computerMove);
  38.  
  39. // Evaluate
  40. switch (playerInput)
  41. {
  42. case "r":
  43. switch (computerMove)
  44. {
  45. case "s":
  46. playerScore++;
  47. break;
  48. case "p":
  49. computerScore++;
  50. break;
  51. case "r":
  52. break;
  53. }
  54. break;
  55. case "p":
  56. switch (computerMove)
  57. {
  58. case "s":
  59. computerScore++;
  60. break;
  61. case "p":
  62. break;
  63. case "r":
  64. playerScore++;
  65. break;
  66. }
  67. break;
  68. case "s":
  69. switch (computerMove)
  70. {
  71. case "s":
  72. break;
  73. case "p":
  74. playerScore++;
  75. break;
  76. case "r":
  77. computerScore++;
  78. break;
  79. }
  80. break;
  81. }
  82.  
  83. if (playerScore > computerScore)
  84. {
  85. Console.WriteLine("You won with a score of " + playerScore);
  86. }
  87. else
  88. {
  89. Console.WriteLine("computer won with a score of " + computerScore);
  90. }
  91.  
  92. Console.WriteLine("Would you like to continue?---enter(y) or (n)");
  93. var reply = Console.ReadLine();
  94. if (reply == "n")
  95. {
  96. continuePlaying = false;
  97. }
  98. }
  99. }
  100. }
  101. public class Hand
  102. {
  103.  
  104. public string GetHand(int random)
  105. {
  106. var rpc = new List<String> { "r", "p", "s" };
  107. var attack = rpc[random];
  108. return attack;
  109. }
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement