Code formatting and warning fixing.

This commit is contained in:
2024-12-01 17:36:23 +01:00
parent 9f8d966b7a
commit dafd2526d1
93 changed files with 739 additions and 823 deletions

View File

@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>AdventOfCode2017</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>AdventOfCode2017</RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Update="inputs\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="inputs\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AdventOfCode.Common\AdventOfCode.Common.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AdventOfCode.Common\AdventOfCode.Common.csproj"/>
</ItemGroup>
</Project>

View File

@@ -48,10 +48,10 @@ public class Day01 : IDay
{
string input = inputs[0];
int value = 0;
for(int i = 0; i < input.Length; i++)
for (int i = 0; i < input.Length; i++)
{
int nextI = (i + 1) % input.Length;
if(input[i] == input[nextI])
if (input[i] == input[nextI])
{
value += (input[i] - '0');
}

View File

@@ -51,10 +51,10 @@ public class Day02 : IDay
public string ResolvePart1(string[] inputs)
{
int checksum = 0;
foreach(string input in inputs)
foreach (string input in inputs)
{
int[] row = input
.Split(new[] { " ", " " }, StringSplitOptions.RemoveEmptyEntries)
.Split([" ", " "], StringSplitOptions.RemoveEmptyEntries)
.Select(cell => Convert.ToInt32(cell))
.ToArray();
int max = row.Max();
@@ -70,7 +70,7 @@ public class Day02 : IDay
foreach (string input in inputs)
{
int[] row = input
.Split(new[] { " ", " " }, StringSplitOptions.RemoveEmptyEntries)
.Split([" ", " "], StringSplitOptions.RemoveEmptyEntries)
.Select(cell => Convert.ToInt32(cell))
.ToArray();