From 3e6896dc6e64ebbe6905731fbff7756c928583f4 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 1 Dec 2022 16:04:56 +0100 Subject: [PATCH] Refactor --- AoC2022.Day1/Program.cs | 2 +- inputs/{1_1.txt => 1.txt} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename inputs/{1_1.txt => 1.txt} (100%) diff --git a/AoC2022.Day1/Program.cs b/AoC2022.Day1/Program.cs index 7e36411..b4f74f7 100644 --- a/AoC2022.Day1/Program.cs +++ b/AoC2022.Day1/Program.cs @@ -1,4 +1,4 @@ -var input = File.ReadAllText("../../../../inputs/1_1.txt").TrimEnd('\n').Split("\n\n"); // Read input file, remove trailing newlines, split by double newline +var input = File.ReadAllText("../../../../inputs/1.txt").TrimEnd('\n').Split("\n\n"); // Read input file, remove trailing newlines, split by double newline var elves = input.Select(s => new Elf(s.Split("\n").Select(int.Parse))); // Use LINQ magic (select) to transform the collection of strings into a collection of Elves Console.WriteLine(elves.MaxBy(elf => elf.Total())!.Total()); // Output Elf with highest total number of calories diff --git a/inputs/1_1.txt b/inputs/1.txt similarity index 100% rename from inputs/1_1.txt rename to inputs/1.txt