1 | using System; |
---|
2 | using System.Text; |
---|
3 | |
---|
4 | class Program |
---|
5 | { |
---|
6 | static int w, h; static int[] hs; |
---|
7 | static Random r = new Random(); |
---|
8 | |
---|
9 | static void Main() |
---|
10 | { |
---|
11 | Console.CursorVisible = false; Console.OutputEncoding = Encoding.UTF8; |
---|
12 | h = Console.WindowHeight = 50; w = Console.WindowWidth = 150; |
---|
13 | |
---|
14 | hs = new int[w]; |
---|
15 | for (int i = 0; i < w; i++) hs[i] = r.Next(h); |
---|
16 | |
---|
17 | int col = 0; |
---|
18 | while (true) Update(col++ % w); |
---|
19 | } |
---|
20 | |
---|
21 | static char Rand() => (char)r.Next(0x01F8, 0x0248); |
---|
22 | |
---|
23 | static void Update(int col) |
---|
24 | { |
---|
25 | int t = hs[col]; |
---|
26 | |
---|
27 | Console.SetCursorPosition(col, t++ % h); |
---|
28 | Console.Write(' '); |
---|
29 | |
---|
30 | Console.ForegroundColor = ConsoleColor.DarkGreen; |
---|
31 | for (int i = 0; i < 8; i++) |
---|
32 | { |
---|
33 | Console.SetCursorPosition(col, t++ % h); |
---|
34 | Console.Write(Rand()); |
---|
35 | } |
---|
36 | |
---|
37 | Console.ForegroundColor = ConsoleColor.Green; |
---|
38 | for (int i = 0; i < 2; i++) |
---|
39 | { |
---|
40 | Console.SetCursorPosition(col, t++ % h); |
---|
41 | Console.Write(Rand()); |
---|
42 | } |
---|
43 | |
---|
44 | Console.SetCursorPosition(col, t++ % h); |
---|
45 | Console.ForegroundColor = ConsoleColor.White; |
---|
46 | Console.Write(Rand()); |
---|
47 | |
---|
48 | if (hs[col] < h) hs[col]++; |
---|
49 | else hs[col] = 0; |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | |
---|
56 | //class Program |
---|
57 | //{ |
---|
58 | // static int w, h; |
---|
59 | // static Random r = new Random(); |
---|
60 | // static ConsoleColor[,] sms; |
---|
61 | |
---|
62 | // static void Main(string[] args) |
---|
63 | // { |
---|
64 | // Console.CursorVisible = false; |
---|
65 | // Console.OutputEncoding = Encoding.UTF8; |
---|
66 | // sms = new ConsoleColor[h = Console.WindowHeight, w = Console.WindowWidth]; |
---|
67 | |
---|
68 | // for (int i = 0; i < w; i+=2) |
---|
69 | // { |
---|
70 | // int j = r.Next(h); |
---|
71 | |
---|
72 | // for (int l = 0; l < 10; l++) sms[j++ % h, i] = ConsoleColor.DarkGreen; |
---|
73 | // for (int k = 0; k < 3; k++) sms[j++ % h, i] = ConsoleColor.Green; |
---|
74 | // sms[j % h,i] = ConsoleColor.White; |
---|
75 | // } |
---|
76 | |
---|
77 | // while (true) Update(); |
---|
78 | |
---|
79 | // //Timer timer = new Timer(300); |
---|
80 | // //timer.Elapsed += Update; |
---|
81 | // //timer.Start(); |
---|
82 | // //Console.Read(); |
---|
83 | // } |
---|
84 | |
---|
85 | // static void Update() |
---|
86 | // { |
---|
87 | // //Console.Clear(); |
---|
88 | // //StringBuilder sb = new StringBuilder(new string(' ', w)); // miks tää on homo |
---|
89 | // // //sb.Insert(0, 'A'); |
---|
90 | // //for (int i = 0; i < w / 10; i++) |
---|
91 | // // sb[r.Next(w)] = (char)r.Next(65, 91); |
---|
92 | // //Console.Write(sb); |
---|
93 | |
---|
94 | // //for (int x = 0; x < sms.GetLength(0); x++) |
---|
95 | // // for (int y = 0; y < sms.GetLength(1); y++) |
---|
96 | // // { |
---|
97 | |
---|
98 | // // } |
---|
99 | |
---|
100 | |
---|
101 | // for (int i = sms.GetLength(0)-1; i >= 0; i--) |
---|
102 | // for (int j = sms.GetLength(1)-1; j >= 0; j--) |
---|
103 | // { |
---|
104 | // Console.ForegroundColor = sms[i, j]; |
---|
105 | // Console.SetCursorPosition(j, i); |
---|
106 | // Console.Write((char)r.Next(0x01F8, 0x0248)); |
---|
107 | |
---|
108 | // sms[i, j] = sms[(i-1) < 0 ? h-1 : i-1, j/*(i - 1) % h, j % w*/]; |
---|
109 | // //sms[i % sms.GetLength(0), j % sms.GetLength(1)].c = (char)r.Next(0x01F8, 0x0248); |
---|
110 | // } |
---|
111 | |
---|
112 | // //GC.Collect(); |
---|
113 | // } |
---|
114 | |
---|
115 | // //struct Symbol |
---|
116 | // //{ |
---|
117 | // // public ConsoleColor color; |
---|
118 | |
---|
119 | // // public Symbol(char sym, ConsoleColor col) { c = sym; color = col; } |
---|
120 | // //} |
---|
121 | //} |
---|