misc
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Problems\*\*\*.txt">
|
<EmbeddedResource Include="Problems\*\*\*.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -22,36 +22,36 @@
|
|||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Problems\AOC2022\Day10\input.txt" />
|
<None Remove="Problems\AOC2022\Day10\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day10\sara.txt" />
|
<None Remove="Problems\AOC2022\Day10\sara.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day10\simple.txt" />
|
<None Remove="Problems\AOC2022\Day10\simple.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day10\test.txt" />
|
<None Remove="Problems\AOC2022\Day10\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day11\input.txt" />
|
<None Remove="Problems\AOC2022\Day11\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day11\test.txt" />
|
<None Remove="Problems\AOC2022\Day11\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day3\input.txt" />
|
<None Remove="Problems\AOC2022\Day3\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day3\test.txt" />
|
<None Remove="Problems\AOC2022\Day3\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day4\input.txt" />
|
<None Remove="Problems\AOC2022\Day4\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day4\test.txt" />
|
<None Remove="Problems\AOC2022\Day4\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day5\input.txt" />
|
<None Remove="Problems\AOC2022\Day5\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day5\test.txt" />
|
<None Remove="Problems\AOC2022\Day5\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day6\input.txt" />
|
<None Remove="Problems\AOC2022\Day6\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day6\test.txt" />
|
<None Remove="Problems\AOC2022\Day6\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day8\input.txt" />
|
<None Remove="Problems\AOC2022\Day8\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day8\test.txt" />
|
<None Remove="Problems\AOC2022\Day8\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day9\input.txt" />
|
<None Remove="Problems\AOC2022\Day9\input.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day9\test.txt" />
|
<None Remove="Problems\AOC2022\Day9\test.txt" />
|
||||||
<None Remove="Problems\AOC2022\Day9\test2.txt" />
|
<None Remove="Problems\AOC2022\Day9\test2.txt" />
|
||||||
<None Remove="problems\aoc2023\day1\input.txt" />
|
<None Remove="problems\aoc2023\day1\input.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Problems\AOC2015\" />
|
<Folder Include="Problems\AOC2015\" />
|
||||||
<Folder Include="Problems\AOC2021\" />
|
<Folder Include="Problems\AOC2021\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Superpower" Version="3.0.0" />
|
<PackageReference Include="Superpower" Version="3.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace AdventOfCode.Problems.AOC2023.Day1;
|
|||||||
[ProblemInfo(2023, 1, "Trebuchet!?")]
|
[ProblemInfo(2023, 1, "Trebuchet!?")]
|
||||||
public partial class Trebuchet : Problem<int, int>
|
public partial class Trebuchet : Problem<int, int>
|
||||||
{
|
{
|
||||||
private string[] _inputData = Array.Empty<string>();
|
private string[] _inputData = [];
|
||||||
|
|
||||||
public override void LoadInput()
|
public override void LoadInput()
|
||||||
{
|
{
|
||||||
@@ -34,6 +34,7 @@ public partial class Trebuchet : Problem<int, int>
|
|||||||
{
|
{
|
||||||
if (line[i] - '0' >= 10)
|
if (line[i] - '0' >= 10)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
left = line[i] - '0';
|
left = line[i] - '0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -83,6 +84,7 @@ public partial class Trebuchet : Problem<int, int>
|
|||||||
left = line[i] - '0';
|
left = line[i] - '0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = line.Length - 1; i >= 0; i--)
|
for (int i = line.Length - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var word = _numberWords.FirstOrDefault(v => line[..(i + 1)].EndsWith(v.word), (word: "", value: -1)).value;
|
var word = _numberWords.FirstOrDefault(v => line[..(i + 1)].EndsWith(v.word), (word: "", value: -1)).value;
|
||||||
@@ -99,9 +101,4 @@ public partial class Trebuchet : Problem<int, int>
|
|||||||
}
|
}
|
||||||
return (left, right);
|
return (left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[GeneratedRegex("(?<1>one)|(?<2>two)|(?<3>three)|(?<4>four)|(?<5>five)|(?<6>six)|(?<7>seven)|(?<8>eight)|(?<9>nine)|(?<1>1)|(?<2>2)|(?<3>3)|(?<4>4)|(?<5>5)|(?<6>6)|(?<7>7)|(?<8>8)|(?<9>9)")]
|
|
||||||
public static partial Regex ParseNumbers();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user