here is the C# version
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
static class Module1
{
public static void Main(string[] args)
{
Console.Title = "MatriX Console";
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WindowLeft = InlineAssignHelper(ref Console.WindowTop, 0);
Console.WindowHeight = InlineAssignHelper(ref Console.BufferHeight, Console.LargestWindowHeight);
Console.WindowWidth = InlineAssignHelper(ref Console.BufferWidth, Console.LargestWindowWidth);
Console.WriteLine("Hello maxcheaters nabs , press any key to go on");
Console.ReadKey();
int width = 0;
int height = 0;
int[] y = null;
int[] l = null;
Initialize(ref width, ref height, ref y, ref l);
int ms = 0;
while (true) {
DateTime t1 = DateTime.Now;
MatrixStep(width, height, y, l);
ms = 10 - Convert.ToInt32(((TimeSpan)(DateTime.Now - t1)).TotalMilliseconds);
if (ms > 0) {
System.Threading.Thread.Sleep(ms);
}
if (Console.KeyAvailable) {
if (Console.ReadKey().Key == ConsoleKey.F5) {
Initialize(ref width, ref height, ref y, ref l);
}
}
}
}
static bool thistime = false;
public static void MatrixStep(int width, int height, int[] y, int[] l)
{
int x = 0;
thistime = !thistime;
for (x = 0; x <= width - 1; x++) {
if (x % 11 == 10) {
if (!thistime) {
continue;
}
Console.ForegroundColor = ConsoleColor.Red;
} else {
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.SetCursorPosition(x, inBoxY(Convert.ToInt32(y[x] - 2 - (l[x] / 40 * 2)), height));
Console.Write(R);
Console.ForegroundColor = ConsoleColor.Green;
}
Console.SetCursorPosition(x, y[x]);
Console.Write(R);
y[x] = inBoxY(y[x] + 1, height);
Console.SetCursorPosition(x, inBoxY(y[x] - l[x], height));
Console.Write(' ');
}
}
private static void Initialize(ref int width, ref int height, ref int[] y, ref int[] l)
{
int h1 = 0;
int h2 = Convert.ToInt32((InlineAssignHelper(ref h1, Convert.ToInt32((InlineAssignHelper(ref height, Console.WindowHeight)) / 2))) / 2);
width = Console.WindowWidth - 1;
y = new int[width];
l = new int[width];
int x = 0;
Console.Clear();
for (x = 0; x <= width - 1; x++) {
y[x] = m_r.Next(height);
l[x] = m_r.Next(h2 * ((x % 11 != 10) ? 2 : 1), h1 * ((x % 11 != 10) ? 2 : 1));
}
}
static Random m_r = new Random();
private static char R {
get {
int t = m_r.Next(10);
if (t <= 2) {
return Convert.ToChar(('0' + m_r.Next(10)));
} else if (t <= 4) {
return Convert.ToChar(('a' + m_r.Next(27)));
} else if (t <= 6) {
return Convert.ToChar(('A' + m_r.Next(27)));
} else {
return Convert.ToChar(Convert.ToChar(Convert.ToString((m_r.Next(32, 255)))));
}
}
}
public static int inBoxY(int n, int height)
{
n = n % height;
if (n < 0) {
return n + height;
} else {
return n;
}
}
private static T InlineAssignHelper<T>(ref T target, T value)
{
target = value;
return value;
}
}