Add benchmark support using -b

This commit is contained in:
2022-12-17 21:48:16 +01:00
parent 147c348ee1
commit 63c866f5a0
20 changed files with 469 additions and 341 deletions

View File

@@ -6,7 +6,7 @@ public class Day10 : Day
{
public override int Number => 10;
public override string Name => "Cathode-Ray Tube";
public override void RunPart1()
public override void RunPart1(bool display = true)
{
int cycle = 1;
int x = 1;
@@ -47,10 +47,13 @@ public class Day10 : Day
}
}
AnsiConsole.MarkupLine($"[green]Sum of signal strengths: [yellow]{sum}[/][/]");
if (display)
{
AnsiConsole.MarkupLine($"[green]Sum of signal strengths: [yellow]{sum}[/][/]");
}
}
public override void RunPart2()
public override void RunPart2(bool display = true)
{
// Setup the CRT
const char litPixel = '#';
@@ -122,7 +125,10 @@ public class Day10 : Day
}
// Print the CRT
AnsiConsole.Write(crtCanvas);
if (display)
{
AnsiConsole.Write(crtCanvas);
}
}
#region Input