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 Day8 : Day
{
public override int Number => 8;
public override string Name => "Treetop Tree House";
public override void RunPart1()
public override void RunPart1(bool display = true)
{
var grid = CreateGrid();
@@ -92,10 +92,14 @@ public class Day8 : Day
}
}
AnsiConsole.MarkupLine($"[green]Total viewable trees: [yellow]{valid.Count}[/][/]");
if (display)
{
AnsiConsole.MarkupLine($"[green]Total viewable trees: [yellow]{valid.Count}[/][/]");
}
}
public override void RunPart2()
public override void RunPart2(bool display = true)
{
var grid = CreateGrid();
@@ -116,7 +120,10 @@ public class Day8 : Day
}
}
AnsiConsole.MarkupLine($"[green]Max scenic score: [yellow]{maxScenicScore}[/][/]");
if (display)
{
AnsiConsole.MarkupLine($"[green]Max scenic score: [yellow]{maxScenicScore}[/][/]");
}
}
private int ComputeScenicScore(int[,] grid, int i, int j, int size)