Add benchmark support using -b
This commit is contained in:
16
Days/Day3.cs
16
Days/Day3.cs
@@ -7,7 +7,7 @@ public class Day3 : Day
|
||||
public override int Number => 3;
|
||||
public override string Name => "Rucksack Reorganization";
|
||||
|
||||
public override void RunPart1()
|
||||
public override void RunPart1(bool display = true)
|
||||
{
|
||||
long sum = 0;
|
||||
|
||||
@@ -22,10 +22,13 @@ public class Day3 : Day
|
||||
sum += CharToPriority(common);
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Sum of priorities is: [yellow]{sum}[/][/]");
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[green]Sum of priorities is: [yellow]{sum}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
public override void RunPart2()
|
||||
public override void RunPart2(bool display = true)
|
||||
{
|
||||
long sum = 0;
|
||||
|
||||
@@ -40,10 +43,13 @@ public class Day3 : Day
|
||||
sum += CharToPriority(common);
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Sum of priorities is: [yellow]{sum}[/][/]");
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[green]Sum of priorities is: [yellow]{sum}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
private int CharToPriority(char c)
|
||||
private static int CharToPriority(char c)
|
||||
{
|
||||
if (char.IsLower(c))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user