diff --git a/AdventOfCode/Year2022/Day1.cs b/AdventOfCode/Year2022/Day1.cs index 799a904..61b97d4 100644 --- a/AdventOfCode/Year2022/Day1.cs +++ b/AdventOfCode/Year2022/Day1.cs @@ -6,11 +6,11 @@ public class Day1 public Day1() { - Console.WriteLine("\nDay1 Solution\n"); + Console.WriteLine("\nDay1 Solution"); LoadCaloriesPerElf(); - Console.WriteLine($"Part1\nResult: {Part1()}\n"); - Console.WriteLine($"Part2\nResult: {Part2()}\n"); - Console.WriteLine("=============================\n"); + Console.WriteLine($"Part1 Result: {Part1()}"); + Console.WriteLine($"Part2 Result: {Part2()}"); + Console.WriteLine("\n=============================\n"); } private static int Part1() diff --git a/AdventOfCode/Year2022/Day2.cs b/AdventOfCode/Year2022/Day2.cs index f98cca1..66ef8e7 100644 --- a/AdventOfCode/Year2022/Day2.cs +++ b/AdventOfCode/Year2022/Day2.cs @@ -2,21 +2,21 @@ namespace AdventOfCode.Year2022; public class Day2 { - private static List matches = new(); + private static readonly List _matches = new(); public Day2() { - Console.WriteLine("Day2 Solution\n"); + Console.WriteLine("Day2 Solution"); LoadMatches(); - Console.WriteLine($"Part1\nResult: {Part1()}\n"); - Console.WriteLine($"Part2\nResult: {Part2()}\n"); - Console.WriteLine("=============================\n"); + Console.WriteLine($"Part1 Result: {Part1()}"); + Console.WriteLine($"Part2 Result: {Part2()}"); + Console.WriteLine("\n=============================\n"); } private static int Part1() { int score = 0; - foreach (string[] match in matches) + foreach (string[] match in _matches) { if (match[0] == "A") { @@ -53,7 +53,7 @@ public class Day2 private static int Part2() { int score = 0; - foreach (string[] match in matches) + foreach (string[] match in _matches) { if (match[0] == "A") { @@ -90,6 +90,6 @@ public class Day2 private static void LoadMatches() { foreach (string line in File.ReadAllLines("inputs/day2.txt")) - matches.Add(line.Split(" ")); + _matches.Add(line.Split(" ")); } } \ No newline at end of file diff --git a/AdventOfCode/Year2022/Day3.cs b/AdventOfCode/Year2022/Day3.cs index 7b44d73..47b5b41 100644 --- a/AdventOfCode/Year2022/Day3.cs +++ b/AdventOfCode/Year2022/Day3.cs @@ -6,10 +6,10 @@ public class Day3 public Day3() { - Console.WriteLine("Day3 Solution\n"); - Console.WriteLine($"Part1\nResult: {Part1()}\n"); - Console.WriteLine($"Part2\nResult: {Part2()}\n"); - Console.WriteLine("=============================\n"); + Console.WriteLine("Day3 Solution"); + Console.WriteLine($"Part1 Result: {Part1()}"); + Console.WriteLine($"Part2 Result: {Part2()}"); + Console.WriteLine("\n=============================\n"); } private static int Part1() diff --git a/AdventOfCode/Year2022/Day4.cs b/AdventOfCode/Year2022/Day4.cs index 0a25666..8a956e7 100644 --- a/AdventOfCode/Year2022/Day4.cs +++ b/AdventOfCode/Year2022/Day4.cs @@ -4,7 +4,7 @@ public class Day4 { public Day4() { - Console.WriteLine("Day4 Solution\n"); + Console.WriteLine("Day4 Solution"); string[] lines = File.ReadAllLines("inputs/day4.txt"); int containedCount = 0; @@ -17,9 +17,9 @@ public class Day4 intersectedCount++; } - Console.WriteLine($"Part1\nResult: {containedCount}\n"); - Console.WriteLine($"Part2\nResult: {intersectedCount}\n"); - Console.WriteLine("=============================\n"); + Console.WriteLine($"Part1 Result: {containedCount}"); + Console.WriteLine($"Part2 Result: {intersectedCount}"); + Console.WriteLine("\n=============================\n"); } public static bool IsContained(string line) diff --git a/AdventOfCode/Year2022/Day7.cs b/AdventOfCode/Year2022/Day7.cs index d157186..f03fcd3 100644 --- a/AdventOfCode/Year2022/Day7.cs +++ b/AdventOfCode/Year2022/Day7.cs @@ -6,11 +6,11 @@ public class Day7 public Day7() { - Console.WriteLine("Day7 Solution\n"); + Console.WriteLine("Day7 Solution"); LoadTree(); - Console.WriteLine($"Part1\nResult: {Part1()}\n"); - Console.WriteLine($"Part2\nResult: {Part2()}\n"); - Console.WriteLine("=============================\n"); + Console.WriteLine($"Part1 Result: {Part1()}"); + Console.WriteLine($"Part2 Result: {Part2()}"); + Console.WriteLine("\n=============================\n"); } private static int Part1()