Day1 and structure

This commit is contained in:
Stefan Forstenlechner 2021-12-01 21:08:29 +01:00
commit 45c8a0df7f
7 changed files with 2058 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
.idea

8
AoC2021.csproj Normal file
View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

16
AoC2021.sln Normal file
View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AoC2021", "AoC2021.csproj", "{8EB1C70D-5BC2-4FD5-AC52-A7FCC272C2FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8EB1C70D-5BC2-4FD5-AC52-A7FCC272C2FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8EB1C70D-5BC2-4FD5-AC52-A7FCC272C2FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EB1C70D-5BC2-4FD5-AC52-A7FCC272C2FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EB1C70D-5BC2-4FD5-AC52-A7FCC272C2FA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

10
Day1.cs Normal file
View File

@ -0,0 +1,10 @@
#define Day1
#if Day1
using System;
using System.IO;
using System.Linq;
var scans = File.ReadAllText("day1/input").Split("\n", StringSplitOptions.RemoveEmptyEntries).Select(l => int.Parse(l)).ToList();
Console.WriteLine(Enumerable.Range(1, scans.Count - 1).Count(i => scans[i - 1] < scans[i]));
Console.WriteLine(Enumerable.Range(3, scans.Count - 3).Count(i => scans[i - 3] < scans[i]));
#endif

8
Day2.cs Normal file
View File

@ -0,0 +1,8 @@
// #define Day2
#if Day2
using System;
using System.IO;
using System.Linq;
var toBeDefined = File.ReadAllText("day2/input").Split("\n", StringSplitOptions.RemoveEmptyEntries);
#endif

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# Advent of Code 2021
## How to use
All source files use [top-level statements](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#top-level-statements).
To run a specific file, uncomment the first line that contains a preprocessor directive and in turn allows compilation of the code below.
Before moving to the next file, comment out the first line again, as only one file is allowed to have top-level statements.
by Stefan Forstenlechner

2000
day1/input Normal file

File diff suppressed because it is too large Load Diff