Add benchmark support using -b
This commit is contained in:
16
Days/Day6.cs
16
Days/Day6.cs
@@ -6,7 +6,7 @@ public class Day6 : Day
|
||||
{
|
||||
public override int Number => 6;
|
||||
public override string Name => "Tuning Trouble";
|
||||
public override void RunPart1()
|
||||
public override void RunPart1(bool display = true)
|
||||
{
|
||||
int position = 0;
|
||||
|
||||
@@ -30,10 +30,13 @@ public class Day6 : Day
|
||||
charStream.Dequeue();
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Position of start-of-packet marker is: [yellow]{position}[/][/]");
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[green]Position of start-of-packet marker is: [yellow]{position}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
public override void RunPart2()
|
||||
public override void RunPart2(bool display = true)
|
||||
{
|
||||
const int length = 14;
|
||||
int position = 0;
|
||||
@@ -48,7 +51,7 @@ public class Day6 : Day
|
||||
for (int i = length - 1; i < Input.Length; i++)
|
||||
{
|
||||
charStream.Enqueue(Input[i]);
|
||||
|
||||
|
||||
// Check if all 14 chars are different
|
||||
if (charStream.ToHashSet().Count == charStream.Count)
|
||||
{
|
||||
@@ -59,7 +62,10 @@ public class Day6 : Day
|
||||
charStream.Dequeue();
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine($"[green]Position of start-of-message marker is: [yellow]{position}[/][/]");
|
||||
if (display)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[green]Position of start-of-message marker is: [yellow]{position}[/][/]");
|
||||
}
|
||||
}
|
||||
|
||||
#region Input
|
||||
|
||||
Reference in New Issue
Block a user