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

@@ -7,7 +7,7 @@ public class Day9 : Day
public override int Number => 9;
public override string Name => "Rope Bridge";
public override void RunPart1()
public override void RunPart1(bool display = true)
{
// Start
(int x, int y) start = (0, 0);
@@ -49,10 +49,13 @@ public class Day9 : Day
}
}
AnsiConsole.MarkupLine($"[green]The tail visited [yellow]{tailVisitedPositions.Count}[/] unique positions[/]");
if (display)
{
AnsiConsole.MarkupLine($"[green]The tail visited [yellow]{tailVisitedPositions.Count}[/] unique positions[/]");
}
}
public override void RunPart2()
public override void RunPart2(bool display = true)
{
const int tailSegments = 9;
@@ -130,7 +133,10 @@ public class Day9 : Day
}
}
AnsiConsole.MarkupLine($"[green]The tail visited [yellow]{tailVisitedPositions.Count}[/] unique positions[/]");
if (display)
{
AnsiConsole.MarkupLine($"[green]The tail visited [yellow]{tailVisitedPositions.Count}[/] unique positions[/]");
}
}
#region Input