Advertisement
kurec

Untitled

Feb 17th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.Title = "tH3 M7tr1x 3ff3";
  14. Console.ForegroundColor = ConsoleColor.DarkBlue;
  15. Console.WindowLeft = Console.WindowTop = 0;
  16. Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
  17. Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;
  18.  
  19. #if readkey
  20. Console.WriteLine("H1T 7NY K3Y T0 C0NT1NU3 =/");
  21. Console.ReadKey();
  22. #endif
  23.  
  24. Console.CursorVisible = false;
  25. int width, height;
  26. int[] y;
  27. int[] l;
  28. Initialize(out width, out height, out y, out l);
  29. int ms;
  30.  
  31. while (true)
  32. {
  33. DateTime t1 = DateTime.Now;
  34. MatrixStep(width, height, y, l);
  35. ms = 10 - (int)((TimeSpan)(DateTime.Now - t1)).TotalMilliseconds;
  36.  
  37. if (ms > 0)
  38. System.Threading.Thread.Sleep(ms);
  39.  
  40. if (Console.KeyAvailable)
  41. if (Console.ReadKey().Key == ConsoleKey.F5)
  42. Initialize(out width, out height, out y, out l);
  43. }
  44. }
  45.  
  46. static bool thistime = false;
  47.  
  48. private static void MatrixStep(int width, int height, int[] y, int[] l)
  49. {
  50. int x;
  51. thistime = !thistime;
  52.  
  53. for (x = 0; x < width; ++x)
  54. {
  55. if (x % 11 == 10)
  56. {
  57. if (!thistime)
  58. continue;
  59.  
  60. Console.ForegroundColor = ConsoleColor.White;
  61. }
  62. else
  63. {
  64. Console.ForegroundColor = ConsoleColor.DarkGreen;
  65. Console.SetCursorPosition(x, inBoxY(y[x] - 2 - (l[x] / 40 * 2), height));
  66. Console.Write(R);
  67. Console.ForegroundColor = ConsoleColor.Green;
  68. }
  69. Console.SetCursorPosition(x, y[x]);
  70. Console.Write(R);
  71. y[x] = inBoxY(y[x] + 1, height);
  72. Console.SetCursorPosition(x, inBoxY(y[x] - l[x], height));
  73. Console.Write(" ");
  74. }
  75. }
  76.  
  77. private static void Initialize(out int width, out int height, out int[] y, out int[] l)
  78. {
  79. int h1;
  80. int h2 = (h1 = (height = Console.WindowHeight) / 2) / 2;
  81. width = Console.WindowWidth - 1;
  82. y = new int[width];
  83. l = new int[width];
  84. int x;
  85. Console.Clear();
  86. for (x = 0; x < width; ++x)
  87. {
  88. y[x] = r.Next(height);
  89. l[x] = r.Next(h2 * ((x % 11 != 10) ? 2 : 1), h1 * ((x % 11 != 10) ? 2 : 1));
  90. }
  91. }
  92.  
  93. static Random r = new Random();
  94.  
  95. static char R
  96. {
  97. get
  98. {
  99. int t = r.Next(10);
  100. if (t <= 2)
  101. return (char)('0' + r.Next(10));
  102. else if (t <= 4)
  103. return (char)('a' + r.Next(27));
  104. else if (t <= 6)
  105. return (char)('A' + r.Next(27));
  106. else
  107. return (char)(r.Next(32, 255));
  108. }
  109. }
  110.  
  111. public static int inBoxY(int n, int height)
  112. {
  113. n = n % height;
  114. if (n < 0)
  115. return n + height;
  116. else
  117. return n;
  118. }
  119. }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement