Advertisement
Emerald_

Untitled

Jul 19th, 2019
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.85 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace ConsoleApp4
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. Console.CursorVisible = false;
  11. char[,] map1 =
  12. {
  13. {'#','#','#','#','#','#','#','#','#','#',' ',' ',' ',' ',' ', },
  14. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  15. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  16. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  17. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  18. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  19. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  20. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  21. {'#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  22. {'#','#','#','#','#','#','#','#','#','#',' ',' ',' ',' ',' ', },
  23. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  24. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  25. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  26. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  27. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', }
  28.  
  29. };
  30.  
  31. char[,] map3 =
  32. {
  33. {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#',' ',' ',' ',' ' },
  34. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  35. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  36. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  37. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  38. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#' ,' ',' ',' ',' '},
  39. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#' ,' ',' ',' ',' '},
  40. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  41. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  42. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  43. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  44. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  45. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  46. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  47. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  48. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#' ,' ',' ',' ',' '},
  49. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  50. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  51. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  52. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  53. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  54. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  55. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  56. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  57. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  58. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  59. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  60. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  61. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ' },
  62. {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#',' ',' ',' ',' ' },
  63. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  64. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  65. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  66. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  67. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  68. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  69. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  70. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' },
  71. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' }
  72.  
  73. };
  74.  
  75. char[,] map2 =
  76. {
  77. {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#',' ',' ',' ',' ',' ', },
  78. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  79. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  80. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  81. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  82. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  83. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  84. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  85. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  86. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  87. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  88. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  89. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  90. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  91. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  92. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  93. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  94. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  95. {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ', },
  96. {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#',' ',' ',' ',' ',' ', },
  97. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  98. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  99. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  100. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  101. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  102. {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', },
  103.  
  104. };
  105.  
  106. string[] MenuItems = { "30 на 30", "20 на 20", "10 на 10" };
  107. int MenuPos = 0;
  108. char[,] c4 = new char[0,0];
  109.  
  110. Console.WriteLine("Это классическая змейка");
  111.  
  112. Menu(MenuItems, MenuPos);
  113. PickOut(MenuPos, MenuItems, c4, ref map2, ref map1, ref map3);
  114.  
  115. }
  116. static void Menu(string[] MenuItems, int MenuPos)
  117. {
  118. Console.Clear();
  119.  
  120. for (int i = 0; i < MenuItems.Length; i++)
  121. {
  122. if (i == MenuPos)
  123. {
  124. Console.ForegroundColor = ConsoleColor.Red;
  125. Console.WriteLine(MenuItems[i]);
  126. Console.ForegroundColor = ConsoleColor.White;
  127. }
  128. else
  129. Console.WriteLine(MenuItems[i]);
  130. }
  131. }
  132. static void Switch(int MenuPos, char[,] c4, ref char[,] map2, ref char[,] map1, ref char[,] map3)
  133. {
  134. switch (MenuPos)
  135. {
  136. case 0:
  137. Ten(c4, ref map3);
  138. break;
  139. case 1:
  140. Twenty(c4, ref map2);
  141. break;
  142. case 2:
  143. Thirty(c4, ref map1);
  144. break;
  145. default:
  146. Switch(MenuPos, c4, ref map2, ref map1, ref map3);
  147. break;
  148. }
  149. }
  150. static void PickOut(int MenuPos, string[] MenuItems, char[,] c4, ref char[,] map2, ref char[,] map1, ref char[,] map3)
  151. {
  152. while (true)
  153. {
  154. var key = Console.ReadKey().Key;
  155. switch (key)
  156. {
  157. case ConsoleKey.UpArrow:
  158. if (MenuPos > 0)
  159. {
  160. MenuPos--;
  161. Menu(MenuItems, MenuPos);
  162. }
  163. break;
  164. case ConsoleKey.DownArrow:
  165. if (MenuPos < MenuItems.Length - 1)
  166. {
  167. MenuPos++;
  168. Menu(MenuItems, MenuPos);
  169. }
  170. break;
  171. case ConsoleKey.Enter:
  172. {
  173. Switch(MenuPos, c4, ref map2, ref map1, ref map3);
  174. break;
  175. }
  176. default:
  177. Menu(MenuItems, MenuPos);
  178. break;
  179. }
  180. Console.SetCursorPosition(0, 3);
  181. }
  182. }
  183. static void Twenty(char[,] c4, ref char[,] map2)
  184. {
  185. Game(c4 = map2, 19, 19);
  186. }
  187. static void Ten(char[,] c4, ref char[,] map3)
  188. {
  189. Game(c4 = map3, 29, 29);
  190.  
  191. }
  192. static void Thirty(char[,] c4, ref char[,] map1)
  193. {
  194. Game(c4 = map1, 9, 9);
  195. }
  196. static void Game(char[,] c4, int c1, int c2)
  197. {
  198. Console.CursorVisible = false;
  199. Console.Clear();
  200. int userY = 6, userX = 6;
  201. c4[userX, userY] = '@';
  202. int k = 0;
  203. int v = 0;
  204. int s = 0;
  205. Random(ref c4, k, c1 , c2, ref s);
  206.  
  207. while (true)
  208. {
  209.  
  210. Console.SetCursorPosition(userY, userX);
  211. Console.Write('@');
  212. ConsoleKeyInfo NumKey = Console.ReadKey();
  213. link4:
  214. do
  215. {
  216. do
  217. {
  218.  
  219. switch (NumKey.Key)
  220. {
  221. case ConsoleKey.UpArrow:
  222. if (c4[userX - 1, userY] != '#' && c4[userX - 1, userY] != '@')
  223. {
  224. c4[userX, userY] = ' ';
  225. Tail(userX, userY, ref c4, NumKey, ref v, ref k, c1, c2, ref s);
  226. userX--;
  227. Thread.Sleep(200);
  228. Govno(ref c4, userX, userY, ref v);
  229. c4[userX, userY] = '@';
  230. }
  231. break;
  232. case ConsoleKey.DownArrow:
  233. if (c4[userX + 1, userY] != '#' && c4[userX + 1, userY] != '@')
  234. {
  235. c4[userX, userY] = ' ';
  236. Tail(userX, userY, ref c4, NumKey, ref v, ref k, c1, c2, ref s);
  237. userX++;
  238. Thread.Sleep(200);
  239. Govno(ref c4, userX, userY, ref v);
  240. c4[userX, userY] = '@';
  241. }
  242.  
  243. break;
  244. case ConsoleKey.LeftArrow:
  245. if (c4[userX, userY - 1] != '#' && c4[userX, userY - 1] != '@')
  246. {
  247. c4[userX, userY] = ' ';
  248. Tail(userX, userY, ref c4, NumKey, ref v, ref k, c1, c2, ref s);
  249. userY--;
  250. Thread.Sleep(200);
  251. Govno(ref c4, userX, userY, ref v);
  252. c4[userX, userY] = '@';
  253. }
  254. break;
  255. case ConsoleKey.RightArrow:
  256. if (c4[userX, userY + 1] != '#' && c4[userX, userY + 1] != '@')
  257. {
  258. c4[userX, userY] = ' ';
  259. Tail(userX, userY, ref c4, NumKey, ref v, ref k, c1, c2, ref s);
  260. userY++;
  261. Thread.Sleep(200);
  262. Govno(ref c4, userX, userY, ref v);
  263. c4[userX, userY] = '@';
  264. }
  265. break;
  266. default:
  267. NumKey = Console.ReadKey();
  268. goto link4;
  269.  
  270. }
  271.  
  272. Console.SetCursorPosition(0, 0);
  273. for (int i = 0; i < c4.GetLength(0); i++)
  274. {
  275. for (int j = 0; j < c4.GetLength(1); j++)
  276. {
  277. Console.Write(c4[i, j]);
  278. }
  279. Console.WriteLine();
  280. }
  281.  
  282. Console.SetCursorPosition(0, 35);
  283. Console.Write("Вы съели следующее число какашек: " + v);
  284.  
  285. } while (!Console.KeyAvailable);
  286.  
  287. NumKey = Console.ReadKey();
  288.  
  289. } while (NumKey.Key != ConsoleKey.UpArrow || NumKey.Key != ConsoleKey.UpArrow ||
  290. NumKey.Key != ConsoleKey.UpArrow || NumKey.Key != ConsoleKey.UpArrow);
  291.  
  292. goto link4;
  293. }
  294. }
  295. static void Tail(int userX, int userY, ref char[,] c4, ConsoleKeyInfo NumKey, ref int v, ref int k, int c1, int c2, ref int s)
  296. {
  297. int h = v;
  298. Console.CursorVisible = false;
  299. if (NumKey.Key == ConsoleKey.UpArrow)
  300. {
  301. while (v != 0)
  302. {
  303. if (c4[userX + v, userY] == '@')
  304. c4[userX + v, userY] = ' ';
  305. if (c4[userX, userY + v] == '@')
  306. c4[userX, userY + v] = ' ';
  307. if (c4[userX - v, userY] == '@')
  308. c4[userX - v, userY] = ' ';
  309. if (c4[userX, userY - v] == '@')
  310. c4[userX, userY - v] = ' ';
  311. c4[userX, userY] = '@';
  312. v--;
  313. }
  314. }
  315. if (NumKey.Key == ConsoleKey.DownArrow)
  316. {
  317. while (v != 0)
  318. {
  319. if (c4[userX - v, userY] == '@')
  320. c4[userX - v, userY] = ' ';
  321. if (c4[userX, userY - v] == '@')
  322. c4[userX, userY - v] = ' ';
  323. if (c4[userX, userY + v] == '@')
  324. c4[userX, userY + v] = ' ';
  325. if (c4[userX + v, userY] == '@')
  326. c4[userX + v, userY] = ' ';
  327. c4[userX, userY] = '@';
  328. v--;
  329. }
  330. }
  331. if (NumKey.Key == ConsoleKey.LeftArrow)
  332. {
  333. while (v != 0)
  334. {
  335. if (c4[userX, userY + v] == '@')
  336. c4[userX, userY + v] = ' ';
  337. if (c4[userX + v, userY] == '@')
  338. c4[userX + v, userY] = ' ';
  339. if (c4[userX - v, userY] == '@')
  340. c4[userX - v, userY] = ' ';
  341. if (c4[userX, userY - v] == '@')
  342. c4[userX, userY - v] = ' ';
  343. c4[userX, userY] = '@';
  344. v--;
  345. }
  346. }
  347. if (NumKey.Key == ConsoleKey.RightArrow)
  348. {
  349. while (v != 0)
  350. {
  351. if (c4[userX - v, userY] == '@')
  352. c4[userX - v, userY] = ' ';
  353. if (c4[userX, userY - v] == '@')
  354. c4[userX, userY - v] = ' ';
  355. if (c4[userX + v, userY] == '@')
  356. c4[userX + v, userY] = ' ';
  357. if (c4[userX, userY + v] == '@')
  358. c4[userX, userY + v] = ' ';
  359. c4[userX, userY] = '@';
  360. v--;
  361. }
  362. }
  363.  
  364. v = h;
  365.  
  366. for (int i = 1; i < 4; i++)
  367. {
  368. if (v == i && s == 0)
  369. {
  370. Random(ref c4, k, c1, c2, ref s);
  371. s++;
  372. }
  373. }
  374. if(v == 2 && s == 1)
  375. {
  376. Random(ref c4, k, c1, c2, ref s);
  377. s = 10;
  378. }
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385. }
  386. static void Random(ref char[,] c4, int k, int c1, int c2, ref int s)
  387. {
  388. Console.CursorVisible = false;
  389. Console.SetCursorPosition(0, 0);
  390. for (int i = 0; i < c4.GetLength(0); i++)
  391. {
  392. for (int j = 0; j < c4.GetLength(1); j++)
  393. {
  394. Random rnd = new Random();
  395. int a = rnd.Next(100);
  396. if (a == 16 && k == 0 && c4[i, j] != '#' && i <= c1 && j <= c2)
  397. {
  398. c4[i, j] = '*';
  399. Console.Write(c4[i, j]);
  400. k++;
  401. s = 0;
  402. }
  403. else
  404. Console.Write(c4[i, j]);
  405. }
  406. Console.WriteLine();
  407. }
  408. if (k == 0)
  409. {
  410. Console.Clear();
  411. Random(ref c4, k, c1, c2, ref s);
  412. }
  413. }
  414. static void Govno(ref char[,] c4, int userX, int userY, ref int v)
  415. {
  416. Console.CursorVisible = false;
  417. if (c4[userX, userY] == '*')
  418. v++;
  419. }
  420. }
  421. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement