using System;
using System.Timers;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
//defining variables and references
Random rnd
= new Random
();
const string pool = " 0123456789!$%&~#";
int width, height, timeinput;
decimal time = 0;
bool breakoff = false;
Console.ForegroundColor = ConsoleColor.DarkGreen;
//userinput
Console.WriteLine("Enter Width: (in characters)");
width = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Height: (in characters)");
height = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Runtime in min:");
timeinput = Convert.ToInt32(Console.ReadLine());
Console.Clear();
//setting up array for matrix
string[,
] Zeile
= new string[height, width
];
int[] Indexspeicher
= new int[width
];
do //endless loop (timer, forcequit)
{
if (time%5 == 0)
{
for (int indexgen = 0; indexgen < width; indexgen++)
{
Indexspeicher[indexgen] = rnd.Next(2);
}
}
//fill matrix with random chars
for (int row = 0; row < height; row++)
{
for (int chargen = 0; chargen < width; chargen++)
{
if(Indexspeicher[chargen] == 1)
{
var c = pool[rnd.Next(0, pool.Length)];
Zeile[row, chargen] = Convert.ToString(c);
}
}
}
//write matrix to string, less vsync
int rowLength = Zeile.GetLength(0);
int colLength = Zeile.GetLength(1);
string output = "";
for (int i = 0; i < rowLength; i++)
{
if (i > 0)
{
output += "\n";
}
for (int j = 0; j < colLength; j++)
{
output += string.Format("{0} ", Zeile[i, j]);
}
}
//format and output
Console.WriteLine(output);
Console.Write(Environment.NewLine + Environment.NewLine);
//forcequit
if (Console.KeyAvailable)
if (Console.ReadKey().KeyChar == 'Q')
break;
//timer
System.Threading.Thread.Sleep(1000);
Console.Clear();
time += 1;
if (time >= (timeinput * 60))
{
breakoff = true;
}
} while (breakoff == false);
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}