Initial commit

This commit is contained in:
2023-12-05 06:16:22 +00:00
commit e9c0198d5f
13 changed files with 582 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AoCHelper" Version="3.0.0" />
</ItemGroup>
<PropertyGroup>
<NoWarn>S101</NoWarn>
</PropertyGroup>
<ItemGroup>
<None Update="Inputs\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

15
AdventOfCode/Day01.cs Normal file
View File

@@ -0,0 +1,15 @@
namespace AdventOfCode;
public class Day01 : BaseDay
{
private readonly string _input;
public Day01()
{
_input = File.ReadAllText(InputFilePath);
}
public override ValueTask<string> Solve_1() => new($"Solution to {ClassPrefix} {CalculateIndex()}, part 1");
public override ValueTask<string> Solve_2() => new($"Solution to {ClassPrefix} {CalculateIndex()}, part 2");
}

15
AdventOfCode/Day_26.cs Normal file
View File

@@ -0,0 +1,15 @@
namespace AdventOfCode;
public class Day_26 : BaseDay
{
private readonly string _input;
public Day_26()
{
_input = File.ReadAllText(InputFilePath);
}
public override ValueTask<string> Solve_1() => new(_input.Length.ToString());
public override ValueTask<string> Solve_2() => throw new NotImplementedException();
}

View File

@@ -0,0 +1 @@
global using AoCHelper;

View File

@@ -0,0 +1 @@
<Day 1 file input content>

View File

@@ -0,0 +1 @@
<Day 26 file input content>

18
AdventOfCode/Program.cs Normal file
View File

@@ -0,0 +1,18 @@
if (args.Length == 0)
{
await Solver.SolveLast(opt => opt.ClearConsole = false);
}
else if (args.Length == 1 && args[0].Contains("all", StringComparison.CurrentCultureIgnoreCase))
{
await Solver.SolveAll(opt =>
{
opt.ShowConstructorElapsedTime = true;
opt.ShowTotalElapsedTimePerDay = true;
});
}
else
{
var indexes = args.Select(arg => uint.TryParse(arg, out var index) ? index : uint.MaxValue);
await Solver.Solve(indexes.Where(i => i < uint.MaxValue));
}