Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Game
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double money = 100; // това са пари, които ще ги взимаме от Main метода!!
  10. int numbersBet = 0;
  11. double moneyForBet = 0;
  12. int number = 0;
  13. int[] number0_36 = new int[37];
  14. int r = 0;
  15. double[] betNumber0_36 = new double[37];
  16. bool winOrNo = false;
  17. bool YNA = false;
  18. bool RTY = false;
  19.  
  20. while (true)
  21. {
  22. Console.WriteLine("What will you bet on?");
  23. Console.Write("|For numbers, press 1| ");
  24. Console.Write("|For sectors, press 2| ");
  25. Console.Write("|For quiting the game, press 3| \n");
  26.  
  27. int n = int.Parse(Console.ReadLine()); // избираш на какво да залагаш дали на числа или на сектори!!
  28.  
  29. if (n == 1)
  30. {
  31. while (true)
  32. {
  33. YNA = false;
  34.  
  35. Console.WriteLine("How much money you bet on a number?");
  36. Console.WriteLine("The game has accepted bets from:");
  37. Console.WriteLine("|0.1| |0.2| |0.5| |1.0| |5.0| |10|");
  38.  
  39. moneyForBet = double.Parse(Console.ReadLine()); // избираш с колко ще залагаш на число!!
  40.  
  41. if (moneyForBet != 0.1 && moneyForBet != 0.2 && moneyForBet != 0.5 && moneyForBet != 1
  42. && moneyForBet != 5 && moneyForBet != 10)
  43. {
  44. Console.WriteLine("The game does not work with that amount");
  45. Console.WriteLine("Please enter new bet\n");
  46. continue;
  47. }
  48.  
  49. if (moneyForBet > money)
  50. {
  51. Console.WriteLine("You don't have enough money");
  52.  
  53. while (true)
  54. {
  55. Console.WriteLine("You want to make a new bet |Y| or quit this game |N|");
  56.  
  57. string continueYN = Console.ReadLine();
  58.  
  59. if (continueYN == "Y")
  60. {
  61. break;
  62. }
  63. else if (continueYN == "N")
  64. {
  65. Console.WriteLine("Thanks for playing!");
  66. return;
  67. }
  68. else
  69. {
  70. Console.WriteLine("Invalid command");
  71. continue;
  72. }
  73. }
  74. }
  75.  
  76. while (true)
  77. {
  78. Console.WriteLine("What number do you want to bet on?");
  79.  
  80. number = int.Parse(Console.ReadLine()); // числото на което изкаш да залагаш!!
  81. number0_36[r] = number;
  82.  
  83. if (number > 36 || number < 0)
  84. {
  85. Console.WriteLine("Invalid number");
  86. Console.WriteLine("You can only bet from [0-36] !!");
  87.  
  88. continue;
  89. }
  90. else
  91. {
  92. break;
  93. }
  94. }
  95.  
  96. while (true)
  97. {
  98. Console.WriteLine("How many times you bet on that number?");
  99.  
  100. numbersBet = int.Parse(Console.ReadLine()); // колко пъти искаш да заложиш на това число!!
  101.  
  102. if (numbersBet * moneyForBet > money)
  103. {
  104. Console.WriteLine("You don't have enough money");
  105.  
  106. while (true)
  107. {
  108. Console.WriteLine("You want to make a new times bet |Y| or quit this game |N|");
  109.  
  110. string continueYN = Console.ReadLine();
  111.  
  112. if (continueYN == "Y")
  113. {
  114. break;
  115. }
  116. else if (continueYN == "N")
  117. {
  118. Console.WriteLine("Thanks for playing!");
  119. return;
  120. }
  121. else
  122. {
  123. Console.WriteLine("Invalid command");
  124. continue;
  125. }
  126. }
  127. }
  128. else
  129. {
  130. break;
  131. }
  132. }
  133.  
  134. money -= numbersBet * moneyForBet;
  135. betNumber0_36[r] = numbersBet * moneyForBet;
  136.  
  137. int g = 0;
  138. while (g == 0)
  139. {
  140. Console.WriteLine("Do you want to bet on another number or start spining?");
  141. Console.WriteLine("|Y| |N|");
  142.  
  143. string anotherBet = Console.ReadLine(); // дали искаш да залагаш на други числа!!
  144.  
  145. if (anotherBet == "Y")
  146. {
  147. r++;
  148. YNA = true;
  149. break;
  150. }
  151. else if (anotherBet != "N")
  152. {
  153. Console.WriteLine("Invalid command");
  154. continue;
  155. }
  156. else
  157. {
  158. Console.WriteLine("Your bet is accepted");
  159. g++;
  160. }
  161. }
  162.  
  163. if (YNA)
  164. {
  165. continue;
  166. }
  167.  
  168. Random rnd = new Random();
  169. int numberInTheRoulette = rnd.Next(37);
  170.  
  171. Console.WriteLine($"The number is {numberInTheRoulette}!!");
  172.  
  173. for (int i = 0; i <= r; i++)
  174. {
  175. if (number0_36[r] == numberInTheRoulette)
  176. {
  177. Console.WriteLine("You win congratulations!");
  178. money += betNumber0_36[r] * 36;
  179. Console.WriteLine($"Your profit is {betNumber0_36[r] * 36} lv!!");
  180. winOrNo = true;
  181. }
  182. }
  183.  
  184. if (!winOrNo)
  185. {
  186. Console.WriteLine("No luck next time D:");
  187. }
  188.  
  189. winOrNo = false;
  190.  
  191. while (true)
  192. {
  193. Console.WriteLine("Do you wana play agin? |Y| or |N|");
  194.  
  195. string YN = Console.ReadLine();
  196.  
  197. if (YN == "Y")
  198. {
  199. RTY = true;
  200. break;
  201. }
  202.  
  203. if (YN == "N")
  204. {
  205. Console.WriteLine("Thanks for playing!");
  206. return;
  207. }
  208. else
  209. {
  210. Console.WriteLine("invalid command!");
  211. }
  212. }
  213.  
  214. if (RTY)
  215. {
  216. RTY = false;
  217. break;
  218. }
  219. }
  220.  
  221. }
  222.  
  223. else if (n == 2)
  224. {
  225.  
  226. }
  227. else if (n == 3)
  228. {
  229. Console.WriteLine("Thanks for playing!");
  230. return;
  231. }
  232. }
  233. }
  234. }
  235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement