Skip to content

Instantly share code, notes, and snippets.

@cybrox
Created March 13, 2014 09:37
Show Gist options
  • Save cybrox/9525169 to your computer and use it in GitHub Desktop.
Save cybrox/9525169 to your computer and use it in GitHub Desktop.
Matix, cuz matrix.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace m4trx {
class Program {
static bool x0tkr = false;
static Random x0ur = new Random();
static void Main(string[] args) {
int x0wd, x0hg, x0cn, x0cm, x0ms, x0ha, x0hb, x03c, x0fg = 0;
int[] x0my, x0ml;
bool x0cl = false;
Console.Clear();
Console.CursorVisible = false;
Console.SetWindowPosition(0, 0);
Console.WindowLeft = Console.WindowTop = 0;
Console.ForegroundColor = ConsoleColor.DarkBlue;
Console.WindowWidth = Console.BufferWidth = Console.LargestWindowWidth;
Console.WindowHeight = Console.BufferHeight = Console.LargestWindowHeight;
Console.Title = "^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$";
x0hb = (x0ha = (x0hg = Console.WindowHeight) / 2) / 2;
x0wd = Console.WindowWidth - 1;
x0cn = Console.WindowHeight;
x0cm = Console.WindowWidth;
x0my = new int[x0wd];
x0ml = new int[x0wd];
for (x03c = 0; x03c < x0wd; ++x03c) {
x0my[x03c] = x0ur.Next(x0hg);
x0ml[x03c] = x0ur.Next(x0hb * ((x03c % 11 != 10) ? 3 : 1), x0ha * ((x03c % 11 != 10) ? 2 : 1));
}
while (true) {
if (Console.WindowHeight != x0cn || Console.WindowWidth != x0cm) {
if (!x0cl) {
Console.Clear();
Console.ForegroundColor = ConsoleColor.White;
Console.Write("cR1t1c4l 3rr0r ~ c4nT t0uCh Th15, fgg7\n");
System.Threading.Thread.Sleep(1000);
x0cl = true;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(x0cr);
} else {
d0m4trx(x0wd, x0hg, x0my, x0ml);
DateTime x0tm = DateTime.Now;
x0ms = 10 - (int)((TimeSpan)(DateTime.Now - x0tm)).TotalMilliseconds;
if (x0ms > 0) System.Threading.Thread.Sleep(x0ms);
}
}
}
private static void d0m4trx(int x0wd, int x0hg, int[] x0my, int[] x0ml) {
x0tkr = !x0tkr;
int x03c;
for (x03c = 0; x03c < x0wd; ++x03c) {
if (x03c % 15 == 8) {
if (!x0tkr) continue;
Console.ForegroundColor = ConsoleColor.White;
} else {
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.SetCursorPosition(x03c, x0by(x0my[x03c] - 2 - (x0ml[x03c] / 40 * 2), x0hg));
Console.Write(x0cr);
Console.ForegroundColor = ConsoleColor.Green;
}
Console.SetCursorPosition(x03c, x0my[x03c]);
Console.Write(x0cr);
x0my[x03c] = x0by(x0my[x03c] + 1, x0hg);
Console.SetCursorPosition(x03c, x0by(x0my[x03c] - x0ml[x03c], x0hg));
Console.Write(" ");
}
}
private static char x0cr {
get {
int[] x0st = {'0','a','A'};
int x0qt = x0ur.Next(10);
for (int x03c = 1; x03c < 4; x03c++) {
if (x0qt <= (x03c*2)) return (char)(x0st[(x03c-1)] + x0ur.Next(10));
}
return (char)(x0ur.Next(32, 255));
}
}
private static int x0by(int x0bn, int x0hg) {
x0bn %= x0hg;
if (x0bn < 0) return x0bn + x0hg;
return x0bn;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment