diff --git a/NRG.Matrix.App/NRG.Matrix.App/DisplayObject.cs b/NRG.Matrix.App/NRG.Matrix.App/DisplayObject.cs deleted file mode 100644 index 548a739..0000000 --- a/NRG.Matrix.App/NRG.Matrix.App/DisplayObject.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Drawing; - -namespace NRG.Matrix.App; - -public record DisplayObject -{ - private static readonly Random _random = new(); - private static readonly int _traceLength = 25; - private string? _symbol; - private string _lastRandom = GetRandomSymbol(); - - public DisplayObject(int xRange) - { - Pos = new Point(_random.Next(0, xRange), 0); - IsTrace = false; - Color = OtherColor; - } - - public DisplayObject(Point pos, int yOffset) - { - Pos = pos with { Y = pos.Y - yOffset }; - IsTrace = true; - Color = TraceColor; - } - - public static ConsoleColor TraceColor { get; set; } = ConsoleColor.DarkGreen; - public static ConsoleColor OtherColor { get; set; } = ConsoleColor.Gray; - - public Point Pos { get; init; } = new(999, 999); - public bool IsTrace { get; init; } = false; - public ConsoleColor Color { get; init; } = ConsoleColor.Gray; - - public string Symbol - { - get => _symbol is null ? GetNextRandomSymbol() : _symbol; - init => _symbol = value; - } - - public DisplayObject Fall(int x = 0, int y = 1) - => this with { Pos = new Point(Pos.X + x, Pos.Y + y) }; - - public IEnumerable Trace() - => Enumerable.Range(1, _traceLength) - .Select(GetTrace) - .Append(GetClear(_traceLength + 1)); - - private DisplayObject GetTrace(int offset) - => new(Pos, offset); - - private DisplayObject GetClear(int offset) - => new(Pos, offset) { Symbol = " " }; - - private string GetNextRandomSymbol() - { - var getRandom = ShouldGetNewRandom(); - if (!IsTrace && !getRandom) - { - // Double chance for changed symbol on non trace object. - getRandom = ShouldGetNewRandom(); - } - if (getRandom) - { - _lastRandom = GetRandomSymbol(); - } - return _lastRandom; - } - - private static string GetRandomSymbol() - => ((char)_random.Next(33, 123)).ToString(); - - private static bool ShouldGetNewRandom() - => _random.Next(0, 3) == 0; -} \ No newline at end of file diff --git a/NRG.Matrix.App/NRG.Matrix.App/Models/Option.cs b/NRG.Matrix.App/NRG.Matrix.App/Models/Option.cs deleted file mode 100644 index 3fd0a6c..0000000 --- a/NRG.Matrix.App/NRG.Matrix.App/Models/Option.cs +++ /dev/null @@ -1,15 +0,0 @@ -using CommandLine; - -namespace NRG.Matrix.App.Models; - -public class Option -{ - [Option('d', "delay",Required = false, Default = 80, HelpText = "Delay in Milliseconds between two frames.")] - public int Delay { get; set; } - [Option('t', "time", Required = false, Default = null, HelpText = "How long the benchmark should run.")] - public TimeSpan? Time { get; set; } - [Option('m', "maxobjects", Required = false, Default = 9999, HelpText = "Maximum number of objects on the screen.")] - public int MaxObjects { get; set; } - [Option('a', "addrate", Required = false, HelpText = "Rate on how fast per frame the objects should spawn. (float)")] - public string AddRate { get; set; } = "e => 1"; -} diff --git a/NRG.Matrix.App/NRG.Matrix.App/NRG.Matrix.App.csproj b/NRG.Matrix.App/NRG.Matrix.App/NRG.Matrix.App.csproj deleted file mode 100644 index 8acc343..0000000 --- a/NRG.Matrix.App/NRG.Matrix.App/NRG.Matrix.App.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - Exe - net8.0 - enable - enable - - - - - - - - diff --git a/NRG.Matrix.App/NRG.Matrix.App/Program.cs b/NRG.Matrix.App/NRG.Matrix.App/Program.cs deleted file mode 100644 index 860e098..0000000 --- a/NRG.Matrix.App/NRG.Matrix.App/Program.cs +++ /dev/null @@ -1,31 +0,0 @@ -using CommandLine; -using NRG.Matrix.App.Models; - -namespace NRG.Matrix.App; - -internal class Program -{ - static void Main(string[] args) - { - Parser.Default.ParseArguments