From 69b5115122e73e59c4c451e4120e2e95fca2a0c2 Mon Sep 17 00:00:00 2001 From: TiagoRG Date: Wed, 7 Jun 2023 23:59:16 +0100 Subject: [PATCH] [2022] Changed the output format --- AdventOfCode/Year2022/Day1.cs | 8 ++++---- AdventOfCode/Year2022/Day2.cs | 16 ++++++++-------- AdventOfCode/Year2022/Day3.cs | 8 ++++---- AdventOfCode/Year2022/Day4.cs | 8 ++++---- AdventOfCode/Year2022/Day7.cs | 8 ++++---- 5 files changed, 24 insertions(+), 24 deletions(-) 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()