Facebook
From holzbart, 5 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 230
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Random rnd = new Random();
  10.             int width = 100, height = 40;
  11.             string[,] Zeile = new string[height,width];
  12.             bool breakoff = false;
  13.             Console.ForegroundColor = ConsoleColor.Green;
  14.  
  15.             do
  16.             {
  17.                 for (int row = 0; row < height; row++)
  18.                 {
  19.                     for (int chargen = 0; chargen < width; chargen++)
  20.                     {
  21.                         string character = Convert.ToString(rnd.Next(3));
  22.                         if (character == "0")
  23.                         {
  24.                             Zeile[row,chargen] = "0";
  25.                         }
  26.                         else if (character == "1")
  27.                         {
  28.                             Zeile[row,chargen] = "1";
  29.                         }
  30.                         else if (character == "2")
  31.                         {
  32.                             Zeile[row,chargen] = " ";
  33.                         }
  34.                     }
  35.                 }
  36.                 int rowLength = Zeile.GetLength(0);
  37.                 int colLength = Zeile.GetLength(1);
  38.                 string output = "";
  39.                 for (int i = 0; i < rowLength; i++)
  40.                 {
  41.                     if (i > 0)
  42.                     {
  43.                         output += "\n";
  44.                     }
  45.                     for (int j = 0; j < colLength; j++)
  46.                     {
  47.                         output += string.Format("{0}", Zeile[i, j]);
  48.                     }
  49.                 }
  50.  
  51.                 Console.WriteLine(output);
  52.                 Console.Write(Environment.NewLine + Environment.NewLine);
  53.  
  54.                 if (Console.KeyAvailable)
  55.                     if (Console.ReadKey().KeyChar == 'Q')
  56.                         break;
  57.  
  58.                 System.Threading.Thread.Sleep(400);
  59.                 Console.Clear();
  60.             } while (breakoff == false);
  61.             Console.ReadLine();
  62.         }
  63.     }
  64. }
  65.