Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Rock_Paper_Scissors
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int ask = AskRockPaperScissor();
  10. }
  11. static int AskRockPaperScissor()
  12. {
  13.  
  14. int answer = -1;
  15. bool success = false;
  16. int nRounds = -1;
  17. int loss = 0;
  18. int win = 0;
  19. int tie = 0;
  20.  
  21.  
  22. Console.WriteLine("Welcome to play Rock, Paper, Scissors!");
  23. Console.WriteLine("How many round you wanna play?");
  24. int.TryParse(Console.ReadLine().Trim(), out nRounds);
  25.  
  26.  
  27. while (!success)
  28. {
  29.  
  30. Random rnd = new Random();
  31. int computerG = rnd.Next(3);
  32. Console.WriteLine("Okay we play " + nRounds + " more rounds.");
  33. Console.WriteLine("Pick one! Rock 0), Paper 1), and Scissors 2)");
  34. int.TryParse(Console.ReadLine().Trim(), out answer);
  35.  
  36.  
  37. switch (answer)
  38. {
  39. case 0:
  40. Console.WriteLine("You picked Röck Bröther");
  41. if (computerG == 0)
  42. {
  43. Console.WriteLine("I picked Rock too bröther! We tied man, we tied!");
  44. tie++;
  45. }
  46. else if (computerG == 1)
  47. {
  48. Console.WriteLine("I picked Paper, Paper wraps the Rock, I win!");
  49. loss++;
  50. }
  51. else if (computerG == 2)
  52. {
  53. Console.WriteLine("I picked Scissors, Rock breaks Scissors so you win, gratz buddy!");
  54. win++;
  55. }
  56. nRounds--;
  57. break;
  58.  
  59. case 1:
  60. Console.WriteLine("You picked Päper Bröther");
  61. if (computerG == 0)
  62. {
  63. Console.WriteLine("I picked Rock, Paper wraps the Rock so you win! Gratz buddy!");
  64. win++;
  65. }
  66. else if (computerG == 1)
  67. {
  68. Console.WriteLine("I picked Paper too! We tied man, we tied!");
  69. tie++;
  70. }
  71. else if (computerG == 2)
  72. {
  73. Console.WriteLine("I picked Scissors, Scissors cut the Paper, you did not win :(");
  74. loss++;
  75. }
  76. nRounds--;
  77.  
  78. break;
  79.  
  80. case 2:
  81. Console.WriteLine("You picked Scissörs Bröther");
  82. if (computerG == 0)
  83. {
  84. Console.WriteLine("I picked Rock, my Rock breaks your Scissors, I win!");
  85. loss++;
  86. }
  87. else if (computerG == 1)
  88. {
  89. Console.WriteLine("I picked Paper, Scissors cut the Paper, you win...");
  90. win++;
  91. }
  92. else if (computerG == 2)
  93. {
  94. Console.WriteLine("I picked Scissors too, no homo but we scissoring... Let's just say we tied...");
  95. tie++;
  96. }
  97. nRounds--;
  98. break;
  99.  
  100. default:
  101. Console.WriteLine("You bad, You not listen! Try again!");
  102. break;
  103.  
  104.  
  105.  
  106.  
  107.  
  108. }
  109. if (nRounds == 0)
  110. {
  111. int rounds = loss + win + tie;
  112. Console.WriteLine("We have played as long as you wanted and the results are Following: ");
  113. Console.WriteLine("Rounds: " + rounds);
  114. Console.WriteLine("Wins: " + win);
  115. Console.WriteLine("Losses: " + loss);
  116. Console.WriteLine("Ties: " + tie);
  117. Console.Read();
  118. success = true;
  119. }
  120.  
  121.  
  122. }
  123.  
  124.  
  125. return answer;
  126. }
  127.  
  128. }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement