Files
2022/advent-of-code-2022.csproj
Parnic 52bd9dfc2b Day 20 solution
Yes, I skipped day 19. For now. It sucks.

Day 20 is another "oh right, % is remainder in C#, not modulo" which means it does dumb things with negative numbers. I originally implemented this by hand, looping through the addition/subtraction and wrapping as necessary, but found "euclidean division" after a few Google searches for, essentially, "surely C# can do modulo somehow, right?" and finding that the answer is "no, not really" (though there is an open proposal to make %% a true modulo operator, but that doesn't help me now). So this math utility was the best thing I could find on Wikipedia that did what I wanted (I don't need both the division and modulo response, though, so I left the division part commented out for now). The other trick here is using the shortened length of the array when performing the modulo due to the rules around how wrapping works in this problem (which I think is terribly explained and confusing, but it's also late and I could just be dumb).

I think a faster solution is to just change indices instead of actually moving numbers around in the list, but I'm happy with this for now.
2022-12-20 00:45:40 -06:00

105 lines
4.1 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>aoc2022</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<LangVersion>default</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>5</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningLevel>5</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<None Remove="inputs\01.txt" />
<None Remove="inputs\01a.txt" />
<EmbeddedResource Include="inputs\01.txt" />
<None Remove="inputs\02.txt" />
<EmbeddedResource Include="inputs\01a.txt" />
<EmbeddedResource Include="inputs\02.txt" />
<None Remove="inputs\03.txt" />
<EmbeddedResource Include="inputs\03.txt" />
<None Remove="inputs\04.txt" />
<EmbeddedResource Include="inputs\04.txt" />
<None Remove="inputs\05.txt" />
<EmbeddedResource Include="inputs\05.txt" />
<None Remove="inputs\06.txt" />
<EmbeddedResource Include="inputs\06.txt" />
<None Remove="inputs\07.txt" />
<EmbeddedResource Include="inputs\06a.txt" />
<EmbeddedResource Include="inputs\07.txt" />
<None Remove="inputs\08.txt" />
<EmbeddedResource Include="inputs\07a.txt" />
<EmbeddedResource Include="inputs\08.txt" />
<None Remove="inputs\09.txt" />
<EmbeddedResource Include="inputs\08a.txt" />
<EmbeddedResource Include="inputs\09.txt" />
<None Remove="inputs\10.txt" />
<EmbeddedResource Include="inputs\09a.txt" />
<EmbeddedResource Include="inputs\09b.txt" />
<EmbeddedResource Include="inputs\10.txt" />
<None Remove="inputs\11.txt" />
<EmbeddedResource Include="inputs\10a.txt" />
<EmbeddedResource Include="inputs\10b.txt" />
<EmbeddedResource Include="inputs\11.txt" />
<None Remove="inputs\12.txt" />
<EmbeddedResource Include="inputs\11a.txt" />
<EmbeddedResource Include="inputs\12.txt" />
<None Remove="inputs\13.txt" />
<EmbeddedResource Include="inputs\12a.txt" />
<EmbeddedResource Include="inputs\13.txt" />
<None Remove="inputs\14.txt" />
<EmbeddedResource Include="inputs\13a.txt" />
<EmbeddedResource Include="inputs\14.txt" />
<None Remove="inputs\15.txt" />
<EmbeddedResource Include="inputs\14a.txt" />
<EmbeddedResource Include="inputs\15.txt" />
<None Remove="inputs\16.txt" />
<EmbeddedResource Include="inputs\15a.txt" />
<EmbeddedResource Include="inputs\16.txt" />
<None Remove="inputs\17.txt" />
<EmbeddedResource Include="inputs\16a.txt" />
<EmbeddedResource Include="inputs\17.txt" />
<None Remove="inputs\18.txt" />
<EmbeddedResource Include="inputs\17a.txt" />
<EmbeddedResource Include="inputs\18.txt" />
<None Remove="inputs\19.txt" />
<EmbeddedResource Include="inputs\18a.txt" />
<EmbeddedResource Include="inputs\18b.txt" />
<EmbeddedResource Include="inputs\19.txt" />
<None Remove="inputs\20.txt" />
<EmbeddedResource Include="inputs\20.txt" />
<None Remove="inputs\21.txt" />
<EmbeddedResource Include="inputs\20a.txt" />
<EmbeddedResource Include="inputs\21.txt" />
<None Remove="inputs\22.txt" />
<EmbeddedResource Include="inputs\22.txt" />
<None Remove="inputs\23.txt" />
<EmbeddedResource Include="inputs\23.txt" />
<None Remove="inputs\24.txt" />
<EmbeddedResource Include="inputs\24.txt" />
<None Remove="inputs\25.txt" />
<EmbeddedResource Include="inputs\25.txt" />
<None Remove="inputs\02a.txt" />
<EmbeddedResource Include="inputs\02a.txt" />
<None Remove="inputs\03a.txt" />
<EmbeddedResource Include="inputs\03a.txt" />
<None Remove="inputs\04a.txt" />
<EmbeddedResource Include="inputs\04a.txt" />
<None Remove="inputs\05a.txt" />
<EmbeddedResource Include="inputs\05a.txt" />
</ItemGroup>
</Project>