commit f33d84f3f477af8d4f50bb1d28a9c528066eb89d Author: KäseToatz Date: Wed Sep 25 20:04:01 2024 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b803dcb --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.vs +/bin +/obj \ No newline at end of file diff --git a/Matrix.cs b/Matrix.cs new file mode 100644 index 0000000..4ef4bcc --- /dev/null +++ b/Matrix.cs @@ -0,0 +1,57 @@ +namespace Matrix +{ + public class Matrix + { + private Random random; + private List lengths; + + public Matrix() + { + random = new(); + SetLengths(); + Console.ForegroundColor = ConsoleColor.Green; + Console.BackgroundColor = ConsoleColor.Black; + } + + void SetLengths() + { + List newLengths = []; + for (int i = 0; i < Console.WindowWidth; i++) + { + newLengths.Add(random.Next(0, Console.WindowHeight)); + } + lengths = newLengths; + } + + string GetRow(int row) + { + string curRow = ""; + for (int column = 0; column < lengths.Count; column++) + { + if (row < lengths[column]) + { + curRow += (char)random.Next(33, 127); + } + else + { + curRow += ' '; + } + } + return curRow; + } + + public void Start() + { + while (true) + { + for (int row = 0; row < lengths.Max(); row++) + { + Console.WriteLine(GetRow(row)); + Thread.Sleep(50); + } + Console.SetCursorPosition(0, 0); + SetLengths(); + } + } + } +} \ No newline at end of file diff --git a/Matrix.csproj b/Matrix.csproj new file mode 100644 index 0000000..2150e37 --- /dev/null +++ b/Matrix.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Matrix.sln b/Matrix.sln new file mode 100644 index 0000000..65c7f3c --- /dev/null +++ b/Matrix.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34701.34 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Matrix", "Matrix.csproj", "{CA49C33E-33DC-4C4F-92C3-8849CB3F3324}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CA49C33E-33DC-4C4F-92C3-8849CB3F3324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA49C33E-33DC-4C4F-92C3-8849CB3F3324}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA49C33E-33DC-4C4F-92C3-8849CB3F3324}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA49C33E-33DC-4C4F-92C3-8849CB3F3324}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {82E7F969-8518-4940-BEA9-EE3DBA6C2023} + EndGlobalSection +EndGlobal diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..0846ebf --- /dev/null +++ b/Program.cs @@ -0,0 +1,11 @@ +namespace Matrix +{ + public class Program + { + static void Main() + { + Matrix matrix = new(); + matrix.Start(); + } + } +} \ No newline at end of file