Initial commit
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/.vs
|
||||
/bin
|
||||
/obj
|
57
Matrix.cs
Normal file
57
Matrix.cs
Normal file
@ -0,0 +1,57 @@
|
||||
namespace Matrix
|
||||
{
|
||||
public class Matrix
|
||||
{
|
||||
private Random random;
|
||||
private List<int> lengths;
|
||||
|
||||
public Matrix()
|
||||
{
|
||||
random = new();
|
||||
SetLengths();
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.BackgroundColor = ConsoleColor.Black;
|
||||
}
|
||||
|
||||
void SetLengths()
|
||||
{
|
||||
List<int> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
Matrix.csproj
Normal file
10
Matrix.csproj
Normal file
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
25
Matrix.sln
Normal file
25
Matrix.sln
Normal file
@ -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
|
11
Program.cs
Normal file
11
Program.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Matrix
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
Matrix matrix = new();
|
||||
matrix.Start();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user