[2022] Changed the output format

This commit is contained in:
Tiago Garcia 2023-06-07 23:59:16 +01:00
parent 596c74d0d0
commit 69b5115122
No known key found for this signature in database
GPG Key ID: F423E37A2415E160
5 changed files with 24 additions and 24 deletions

View File

@ -6,11 +6,11 @@ public class Day1
public Day1() public Day1()
{ {
Console.WriteLine("\nDay1 Solution\n"); Console.WriteLine("\nDay1 Solution");
LoadCaloriesPerElf(); LoadCaloriesPerElf();
Console.WriteLine($"Part1\nResult: {Part1()}\n"); Console.WriteLine($"Part1 Result: {Part1()}");
Console.WriteLine($"Part2\nResult: {Part2()}\n"); Console.WriteLine($"Part2 Result: {Part2()}");
Console.WriteLine("=============================\n"); Console.WriteLine("\n=============================\n");
} }
private static int Part1() private static int Part1()

View File

@ -2,21 +2,21 @@ namespace AdventOfCode.Year2022;
public class Day2 public class Day2
{ {
private static List<string[]> matches = new(); private static readonly List<string[]> _matches = new();
public Day2() public Day2()
{ {
Console.WriteLine("Day2 Solution\n"); Console.WriteLine("Day2 Solution");
LoadMatches(); LoadMatches();
Console.WriteLine($"Part1\nResult: {Part1()}\n"); Console.WriteLine($"Part1 Result: {Part1()}");
Console.WriteLine($"Part2\nResult: {Part2()}\n"); Console.WriteLine($"Part2 Result: {Part2()}");
Console.WriteLine("=============================\n"); Console.WriteLine("\n=============================\n");
} }
private static int Part1() private static int Part1()
{ {
int score = 0; int score = 0;
foreach (string[] match in matches) foreach (string[] match in _matches)
{ {
if (match[0] == "A") if (match[0] == "A")
{ {
@ -53,7 +53,7 @@ public class Day2
private static int Part2() private static int Part2()
{ {
int score = 0; int score = 0;
foreach (string[] match in matches) foreach (string[] match in _matches)
{ {
if (match[0] == "A") if (match[0] == "A")
{ {
@ -90,6 +90,6 @@ public class Day2
private static void LoadMatches() private static void LoadMatches()
{ {
foreach (string line in File.ReadAllLines("inputs/day2.txt")) foreach (string line in File.ReadAllLines("inputs/day2.txt"))
matches.Add(line.Split(" ")); _matches.Add(line.Split(" "));
} }
} }

View File

@ -6,10 +6,10 @@ public class Day3
public Day3() public Day3()
{ {
Console.WriteLine("Day3 Solution\n"); Console.WriteLine("Day3 Solution");
Console.WriteLine($"Part1\nResult: {Part1()}\n"); Console.WriteLine($"Part1 Result: {Part1()}");
Console.WriteLine($"Part2\nResult: {Part2()}\n"); Console.WriteLine($"Part2 Result: {Part2()}");
Console.WriteLine("=============================\n"); Console.WriteLine("\n=============================\n");
} }
private static int Part1() private static int Part1()

View File

@ -4,7 +4,7 @@ public class Day4
{ {
public Day4() public Day4()
{ {
Console.WriteLine("Day4 Solution\n"); Console.WriteLine("Day4 Solution");
string[] lines = File.ReadAllLines("inputs/day4.txt"); string[] lines = File.ReadAllLines("inputs/day4.txt");
int containedCount = 0; int containedCount = 0;
@ -17,9 +17,9 @@ public class Day4
intersectedCount++; intersectedCount++;
} }
Console.WriteLine($"Part1\nResult: {containedCount}\n"); Console.WriteLine($"Part1 Result: {containedCount}");
Console.WriteLine($"Part2\nResult: {intersectedCount}\n"); Console.WriteLine($"Part2 Result: {intersectedCount}");
Console.WriteLine("=============================\n"); Console.WriteLine("\n=============================\n");
} }
public static bool IsContained(string line) public static bool IsContained(string line)

View File

@ -6,11 +6,11 @@ public class Day7
public Day7() public Day7()
{ {
Console.WriteLine("Day7 Solution\n"); Console.WriteLine("Day7 Solution");
LoadTree(); LoadTree();
Console.WriteLine($"Part1\nResult: {Part1()}\n"); Console.WriteLine($"Part1 Result: {Part1()}");
Console.WriteLine($"Part2\nResult: {Part2()}\n"); Console.WriteLine($"Part2 Result: {Part2()}");
Console.WriteLine("=============================\n"); Console.WriteLine("\n=============================\n");
} }
private static int Part1() private static int Part1()