[2022] Changed the output format
This commit is contained in:
parent
596c74d0d0
commit
69b5115122
|
@ -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()
|
||||
|
|
|
@ -2,21 +2,21 @@ namespace AdventOfCode.Year2022;
|
|||
|
||||
public class Day2
|
||||
{
|
||||
private static List<string[]> matches = new();
|
||||
private static readonly List<string[]> _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(" "));
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue