Add benchmark support using -b
This commit is contained in:
@@ -121,7 +121,7 @@ public class Day14 : Day
|
||||
private readonly Point _sandSource = new(500, 0);
|
||||
private Point _offsetSandSource;
|
||||
|
||||
public override void RunPart1()
|
||||
public override void RunPart1(bool display = true)
|
||||
{
|
||||
var map = GenerateMap();
|
||||
|
||||
@@ -136,12 +136,15 @@ public class Day14 : Day
|
||||
sandBlocksCount++;
|
||||
}
|
||||
|
||||
AnsiConsole.Write(canvas);
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.Write(canvas);
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Total sand blocks: [yellow]{sandBlocksCount}[/][/]");
|
||||
AnsiConsole.MarkupLine($"[green]Total sand blocks: [yellow]{sandBlocksCount}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
public override void RunPart2()
|
||||
public override void RunPart2(bool display = true)
|
||||
{
|
||||
var map = GenerateDictionaryMap();
|
||||
|
||||
@@ -156,9 +159,13 @@ public class Day14 : Day
|
||||
sandBlocksCount++;
|
||||
}
|
||||
|
||||
AnsiConsole.Write(GenerateCanvas(map, _sandSource));
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Total sand blocks: [yellow]{sandBlocksCount}[/][/]");
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.Write(GenerateCanvas(map, _sandSource));
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Total sand blocks: [yellow]{sandBlocksCount}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool GenerateSand(CellType[,] map, Canvas canvas, in Point sandSource)
|
||||
|
||||
Reference in New Issue
Block a user