Advertisement
Grimmjow1

RockPaperScissors

Feb 15th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace RockPaperScissors1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. string imputPlayer;
  13. string imputCPU;
  14. int randomInt;
  15. int scoreCPU = 0;
  16. int scorePlyer = 0;
  17. bool oneMore = true;
  18.  
  19. while (oneMore)
  20. {
  21.  
  22.  
  23.  
  24. while (scoreCPU < 3 && scorePlyer < 3)
  25. {
  26.  
  27.  
  28. Console.Write("Choose between Rock,Paper and Scissors: ");
  29. imputPlayer = Console.ReadLine();
  30. Random rng = new Random();
  31. randomInt = rng.Next(1, 4);
  32.  
  33. switch (randomInt)
  34. {
  35. case 1:
  36. imputCPU = "Rock";
  37.  
  38. Console.WriteLine("COMPUTER CHOSE ROCK");
  39. if (imputPlayer == "Rock")
  40. {
  41. Console.WriteLine(" DRAW!\n");
  42. }
  43. else if (imputPlayer == "Paper")
  44. {
  45. Console.WriteLine(" PLAYER WIN!\n");
  46. scorePlyer++;
  47. }
  48. else if (imputPlayer == "Scissors")
  49. {
  50. Console.WriteLine(" COMPUTER WIN!\n");
  51. scoreCPU++;
  52. }
  53. break;
  54. case 2:
  55. imputCPU = "Paper";
  56.  
  57. Console.WriteLine("COMPUTER CHOSE PAPER");
  58. if (imputPlayer == "Rock")
  59. {
  60. Console.WriteLine(" COMPUTER WIN!\n");
  61. scoreCPU++;
  62. }
  63. else if (imputPlayer == " Paper")
  64. {
  65. Console.WriteLine(" DRAW!\n");
  66. }
  67. else if (imputPlayer == "Scissors")
  68. {
  69. Console.WriteLine(" PLAYER WIN!\n");
  70. scorePlyer++;
  71. }
  72. break;
  73. case 3:
  74. imputCPU = "Scissors";
  75.  
  76. Console.WriteLine("COMPUTER CHOSE SCISSORS");
  77. if (imputPlayer == "Rock")
  78. {
  79. Console.WriteLine(" PLAYER WIN!\n");
  80. scorePlyer++;
  81. }
  82. else if (imputPlayer == "Paper")
  83. {
  84. Console.WriteLine(" COMPUTER WIN!\n");
  85. scoreCPU++;
  86. }
  87. else if (imputPlayer == "Scissors")
  88. {
  89. Console.WriteLine(" DRAW!/n");
  90. }
  91. break;
  92.  
  93. }
  94.  
  95. Console.WriteLine("Player score :{0}\n\n", scorePlyer);
  96.  
  97. Console.WriteLine("Computer score :{0}\n\n", scoreCPU);
  98.  
  99.  
  100. }
  101. scoreCPU = 0;
  102. scorePlyer = 0;
  103. Console.WriteLine("One More Game? Y/N ");
  104. string playAgain = Console.ReadLine();
  105. if (playAgain == "Y")
  106. {
  107.  
  108. }
  109. else if (playAgain == "N")
  110. {
  111. oneMore = false;
  112. }
  113. Console.Clear();
  114. }
  115.  
  116.  
  117. }
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement