Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace MatrixRevolution
- {
- class Program
- {
- private static readonly int MatrixWidth = Console.LargestWindowWidth;
- private static readonly int MatrixHeight = Console.LargestWindowHeight;
- private static char[,] matrix;
- private static Random rand = new Random();
- static void Main(string[] args)
- {
- Console.WindowHeight = Console.BufferHeight = MatrixHeight;
- Console.WindowWidth = Console.BufferWidth = MatrixWidth;
- Console.ForegroundColor = ConsoleColor.DarkGreen;
- Console.WindowLeft = Console.WindowTop = 0;
- int[] y = new int[MatrixWidth];
- int[] length = new int[MatrixWidth];
- for (int x = 0; x < MatrixWidth; x++)
- {
- y[x] = rand.Next(1, MatrixHeight);
- length[x] = rand.Next(1, MatrixHeight - y[x]);
- }
- for (int x= 0; x < MatrixWidth; x++)
- for (int i = 0; i < length[x]; i++)
- {
- Console.CursorVisible = false;
- Console.SetCursorPosition(x, y[x] + i);
- Console.Write((char)rand.Next(32, 125));
- }
- int l = 0;
- while(true)
- {
- for (int x = 0; x < MatrixWidth-1; x++)
- {
- y[x] = y[x] < MatrixHeight ? y[x] : 0;
- Console.SetCursorPosition(x, y[x]++);
- Console.Write(' ');
- int newY = y[x] + length[x] < MatrixHeight ? y[x] + length[x] : (y[x] + length[x]) - MatrixHeight;
- Console.SetCursorPosition(x, newY++);
- Console.Write((char)rand.Next(32, 125));
- x = l % 2 == 0 ? x : x + 1;
- x = l++ % 3 == 0 ? x : x + 2;
- }
- System.Threading.Thread.Sleep(40);
- }
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment