Automatic code cleanup
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2015.Day10;
|
||||
|
||||
[ProblemInfo(2015, 10, "Evles Look, Elves Say")]
|
||||
internal class LookAndSay : Problem<int, int>
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ public class NiceList : Problem<int, int>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsNice2(string value)
|
||||
{
|
||||
var pairs = new Dictionary<string, List<int>>();
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2019.Day1
|
||||
{
|
||||
[ProblemInfo(2019, 1, "The Tyranny of the Rocket Equation")]
|
||||
@@ -41,7 +35,6 @@ namespace AdventOfCode.Problems.AOC2019.Day1
|
||||
|
||||
public override void CalculatePart2()
|
||||
{
|
||||
|
||||
Part2 = GetFuelRequirement(_input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2019.Day3
|
||||
{
|
||||
@@ -227,7 +220,6 @@ namespace AdventOfCode.Problems.AOC2019.Day3
|
||||
|
||||
public static int SolveWires(string[] wires)
|
||||
{
|
||||
|
||||
var (wireSegmentsA, wireSegmentsB) = CreateWirePair(wires);
|
||||
|
||||
int shortestWire = int.MaxValue;
|
||||
@@ -271,7 +263,6 @@ namespace AdventOfCode.Problems.AOC2019.Day3
|
||||
var wireA = wires[0].Split(',');
|
||||
var wireSegmentsA = CreateWire(wireA);
|
||||
|
||||
|
||||
var wireB = wires[1].Split(',');
|
||||
var wireSegmentsB = CreateWire(wireB);
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2019.Day4
|
||||
{
|
||||
[ProblemInfo(2019, 4, "Secure Container")]
|
||||
@@ -30,7 +24,6 @@ namespace AdventOfCode.Problems.AOC2019.Day4
|
||||
|
||||
public static bool HasDoubles(int[] password)
|
||||
{
|
||||
|
||||
bool foundDouble = false;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
@@ -53,7 +46,6 @@ namespace AdventOfCode.Problems.AOC2019.Day4
|
||||
foundDouble = true;
|
||||
}
|
||||
return foundDouble;
|
||||
|
||||
}
|
||||
|
||||
public static bool IsAssending(int[] password)
|
||||
@@ -68,8 +60,6 @@ namespace AdventOfCode.Problems.AOC2019.Day4
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static int CountPasswordsPart1(int lower, int upper)
|
||||
{
|
||||
int passwordCount = 0;
|
||||
@@ -87,6 +77,7 @@ namespace AdventOfCode.Problems.AOC2019.Day4
|
||||
}
|
||||
return passwordCount;
|
||||
}
|
||||
|
||||
public static int CountPasswordsPart2(int lower, int upper)
|
||||
{
|
||||
int passwordCount = 0;
|
||||
@@ -139,7 +130,6 @@ namespace AdventOfCode.Problems.AOC2019.Day4
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void LoadInput()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
using AdventOfCode.Day_5;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2019.Day5;
|
||||
|
||||
[ProblemInfo(2019, 5, "Sunny with a Chance of Asteroids")]
|
||||
internal class ChanceOfAsteroids : Problem<int, int>
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace AdventOfCode.Day_5
|
||||
namespace AdventOfCode.Day_5
|
||||
{
|
||||
public class IntCodeV2
|
||||
{
|
||||
@@ -19,7 +14,6 @@ namespace AdventOfCode.Day_5
|
||||
this.paramCount = paramCount;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool IsHalted { get; private set; }
|
||||
@@ -171,6 +165,7 @@ namespace AdventOfCode.Day_5
|
||||
{
|
||||
case 1:
|
||||
return (opModes, arr[0]);
|
||||
|
||||
case 2:
|
||||
return (opModes, (arr[^2] * 10) + arr[^1]);
|
||||
}
|
||||
@@ -234,7 +229,5 @@ namespace AdventOfCode.Day_5
|
||||
_instructionPointer = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2019.Day6;
|
||||
|
||||
[ProblemInfo(2019, 6, "Universal Orbit Map")]
|
||||
internal class UniversalOrbits : Problem<int, int>
|
||||
{
|
||||
@@ -31,7 +26,6 @@ internal class UniversalOrbits : Problem<int, int>
|
||||
|
||||
HashSet<string> pathYOU = new(pathToYOU.Select(o => o.Name));
|
||||
|
||||
|
||||
for (int i = 0; i < pathToSAN.Count; i++)
|
||||
{
|
||||
if (pathYOU.Contains(pathToSAN[i].Name))
|
||||
@@ -50,7 +44,6 @@ internal class UniversalOrbits : Problem<int, int>
|
||||
}
|
||||
}
|
||||
Part2 = dist - 2;
|
||||
|
||||
}
|
||||
|
||||
public override void LoadInput()
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2019.Day8
|
||||
{
|
||||
[ProblemInfo(2019, 8, "Space Image Format")]
|
||||
@@ -18,7 +12,6 @@ namespace AdventOfCode.Problems.AOC2019.Day8
|
||||
var imageData = File.ReadAllText("Day8/input.txt").Replace("\n", "").Select(c => int.Parse(c.ToString())).ToArray();
|
||||
|
||||
Console.WriteLine(Checksum(imageData, 25, 6));
|
||||
|
||||
}
|
||||
|
||||
public static void RenderImage(int[] data, int h, int w)
|
||||
@@ -28,11 +21,9 @@ namespace AdventOfCode.Problems.AOC2019.Day8
|
||||
|
||||
for (int l = 0; l < layerCount; l++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int Checksum(int[] data, int h, int w)
|
||||
{
|
||||
var imgSize = h * w;
|
||||
@@ -54,9 +45,11 @@ namespace AdventOfCode.Problems.AOC2019.Day8
|
||||
case 0:
|
||||
zeroCount[l]++;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
oneCount[l]++;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
twoCount[l]++;
|
||||
break;
|
||||
@@ -70,7 +63,6 @@ namespace AdventOfCode.Problems.AOC2019.Day8
|
||||
}
|
||||
|
||||
return oneCount[smallestLayer] * twoCount[smallestLayer];
|
||||
|
||||
}
|
||||
|
||||
public override void LoadInput()
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AdventOfCode
|
||||
namespace AdventOfCode
|
||||
{
|
||||
public static class InputParsing
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System.Collections;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2021.Day11;
|
||||
|
||||
@@ -76,7 +73,6 @@ public class DumboOctopus : Problem<int, int>, IEnumerable<byte>
|
||||
{
|
||||
Increment(ref data);
|
||||
Flash(ref data, ref flashes);
|
||||
|
||||
}
|
||||
|
||||
private static void Increment(ref byte[] data)
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2021.Day3;
|
||||
|
||||
[ProblemInfo(2021, 3, "Binary Diagnostic")]
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2021.Day6;
|
||||
|
||||
[ProblemInfo(2021, 6, "Lanternfish")]
|
||||
@@ -18,11 +12,11 @@ internal class LanternFish : Problem<long, long>
|
||||
var input = ReadInputLines();
|
||||
Data = input.First().Split(",").Select(v => int.Parse(v)).ToArray();
|
||||
}
|
||||
|
||||
public override void CalculatePart1()
|
||||
{
|
||||
var lifetimes = PrepareLifetimes();
|
||||
Part1 = Simulate(lifetimes, 80);
|
||||
|
||||
}
|
||||
|
||||
public override void CalculatePart2()
|
||||
@@ -53,8 +47,4 @@ internal class LanternFish : Problem<long, long>
|
||||
|
||||
return lifetimes.Sum();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using AdventOfCode.Runner;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day0;
|
||||
|
||||
[ProblemInfo(2022, 0, "Fancy Test")]
|
||||
public class TestProblem : Problem
|
||||
{
|
||||
@@ -20,7 +20,6 @@ public class TestProblem : Problem
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
public override void PrintPart1()
|
||||
{
|
||||
Console.WriteLine("Result");
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using AdventOfCode.Runner;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day1;
|
||||
|
||||
[ProblemInfo(2022, 1, "Calorie Counting")]
|
||||
internal class CalorieCounting : Problem
|
||||
{
|
||||
@@ -16,7 +10,8 @@ internal class CalorieCounting : Problem
|
||||
private (int calories, int elf)? _mostestElf;
|
||||
private IEnumerable<(int sum, int idx)>? _mostestElves;
|
||||
|
||||
public CalorieCounting() {
|
||||
public CalorieCounting()
|
||||
{
|
||||
FlaresFood = new List<List<int>>
|
||||
{
|
||||
new List<int>()
|
||||
@@ -38,6 +33,7 @@ internal class CalorieCounting : Problem
|
||||
FlaresFood[c].Add(int.Parse(calorie));
|
||||
}
|
||||
}
|
||||
|
||||
public override void CalculatePart1()
|
||||
{
|
||||
_mostestElf = FlaresFood
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace AdventOfCode.Problems.AOC2022.Day10;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day10;
|
||||
internal class CathodeCPU
|
||||
{
|
||||
public enum Instruction
|
||||
@@ -38,9 +33,9 @@ internal class CathodeCPU
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void ExecuteCode((Instruction ins, int value)[] code, Action<int, int> processor)
|
||||
{
|
||||
|
||||
while (_programCounter < code.Length)
|
||||
{
|
||||
var (ins, value) = code[_programCounter];
|
||||
@@ -52,23 +47,20 @@ internal class CathodeCPU
|
||||
case { ins: Instruction.NoOp }:
|
||||
_programCounter++;
|
||||
break;
|
||||
|
||||
case { ins: Instruction.AddX, _pending: -1 }:
|
||||
_pending = 1;
|
||||
break;
|
||||
|
||||
case { ins: Instruction.AddX, _pending: 0 }:
|
||||
X += value;
|
||||
_programCounter++;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (_pending >= 0)
|
||||
_pending--;
|
||||
_cycleNumber++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,7 +25,6 @@ internal class CathodeRayTube : Problem<int, string>
|
||||
if (cycle > output.Length)
|
||||
return;
|
||||
|
||||
|
||||
var pos = signal % 40;
|
||||
var head = (cycle % 40);
|
||||
var sprite = Math.Abs(pos - head);
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day11;
|
||||
|
||||
[ProblemInfo(2022, 11, "Monkey in the Middle")]
|
||||
internal class MonkeyInTheMiddle : Problem<int, int>
|
||||
{
|
||||
@@ -37,7 +31,6 @@ internal class MonkeyInTheMiddle : Problem<int, int>
|
||||
var lines = ReadInputLines("test.txt").Chunk(7);
|
||||
_monkeysPart1 = lines.Select(ln => new Monkey(ln)).ToArray();
|
||||
_monkeysPart2 = lines.Select(ln => new Monkey(ln)).ToArray();
|
||||
|
||||
}
|
||||
|
||||
private static void Simulate(Monkey[] monkeys, int rounds, uint worry = 3)
|
||||
@@ -54,8 +47,8 @@ internal class MonkeyInTheMiddle : Problem<int, int>
|
||||
SimulateTurn(monkey, monkeys, worry);
|
||||
}
|
||||
|
||||
|
||||
private static void SimulateTurn(Monkey monkey, Monkey[] monkeys, uint worry = 3) {
|
||||
private static void SimulateTurn(Monkey monkey, Monkey[] monkeys, uint worry = 3)
|
||||
{
|
||||
for (int i = 0; i < monkey.Items.Count; i++)
|
||||
{
|
||||
var item = monkey.Inspect(monkey.Items[i], worry);
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day12;
|
||||
|
||||
[ProblemInfo(2022, 12, "Hill Climbing Algorithm")]
|
||||
internal class HillClimbing : Problem
|
||||
{
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day13;
|
||||
|
||||
[ProblemInfo(2022, 13, "Distress Signal")]
|
||||
internal class DistressSignal : Problem
|
||||
{
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day14;
|
||||
|
||||
[ProblemInfo(2022, 14, "Regolith Reservoir")]
|
||||
internal class RegolithReservoir : Problem
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using AdventOfCode.Runner;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day2;
|
||||
|
||||
@@ -74,7 +73,8 @@ internal class RockPaperScissors : Problem
|
||||
};
|
||||
}
|
||||
|
||||
private static int GetResponseValue(char move, char result) {
|
||||
private static int GetResponseValue(char move, char result)
|
||||
{
|
||||
var p = result switch
|
||||
{
|
||||
'X' => (GetMoveValue(move) + 2) % 3, //Lose
|
||||
@@ -85,7 +85,6 @@ internal class RockPaperScissors : Problem
|
||||
return p == 0 ? 3 : p;
|
||||
}
|
||||
|
||||
|
||||
public override void CalculatePart2()
|
||||
{
|
||||
var score = 0;
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
using AdventOfCode.Runner;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day3;
|
||||
|
||||
[ProblemInfo(2022, 3, "Rucksack Reorganization")]
|
||||
internal class RucksackReorganization : Problem
|
||||
{
|
||||
private string[] _sacks;
|
||||
|
||||
public RucksackReorganization() {
|
||||
public RucksackReorganization()
|
||||
{
|
||||
_sacks = Array.Empty<string>();
|
||||
}
|
||||
|
||||
@@ -21,6 +16,7 @@ internal class RucksackReorganization : Problem
|
||||
{
|
||||
_sacks = ReadInputLines("input.txt");
|
||||
}
|
||||
|
||||
public override void CalculatePart1()
|
||||
{
|
||||
var total = 0;
|
||||
@@ -55,5 +51,4 @@ internal class RucksackReorganization : Problem
|
||||
}
|
||||
Part2 = total.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,7 @@
|
||||
using AdventOfCode.Runner;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day4;
|
||||
|
||||
[ProblemInfo(2022, 4, "Camp Cleanup")]
|
||||
internal class CampCleanup : Problem<int, int>
|
||||
{
|
||||
@@ -32,7 +26,6 @@ internal class CampCleanup : Problem<int, int>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void CalculatePart1()
|
||||
{
|
||||
var total = 0;
|
||||
@@ -53,7 +46,6 @@ internal class CampCleanup : Problem<int, int>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
record Range(int A, int B)
|
||||
{
|
||||
public bool Contains(Range other)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
using Superpower;
|
||||
using Superpower.Parsers;
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day5;
|
||||
@@ -13,6 +12,7 @@ internal partial class SupplyStacks : Problem
|
||||
{
|
||||
private List<char>[] _stacksPart1 = Array.Empty<List<char>>();
|
||||
private List<char>[] _stacksPart2 = Array.Empty<List<char>>();
|
||||
|
||||
private readonly TextParser<(int, int, int)> _moveParser = from move in Character.Letter.Or(Character.WhiteSpace).Many()
|
||||
from stack in Character.Digit.Many()
|
||||
from frm in Character.Letter.Or(Character.WhiteSpace).Many()
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day6;
|
||||
|
||||
[ProblemInfo(2022, 6, "Tuning Trouble")]
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Collections;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2022.Day7;
|
||||
namespace AdventOfCode.Problems.AOC2022.Day7;
|
||||
|
||||
internal class DirectoryNode
|
||||
{
|
||||
|
||||
@@ -37,7 +37,8 @@ internal class NoSpace : Problem<int,int>
|
||||
ParseCommand(line[2..], ref curDir);
|
||||
dir = $"/{string.Join("/", curDir.Reverse())}";
|
||||
_dirTree.AddDirectory(dir);
|
||||
}else
|
||||
}
|
||||
else
|
||||
ReadDirectory(line, _dirTree.GetDirectory(dir)!);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ public class RopeSimulator
|
||||
else
|
||||
_visited.Add(tail, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FollowHead()
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using Superpower.Parsers;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2023.Day1;
|
||||
|
||||
[ProblemInfo(2023, 1, "Trebuchet!?")]
|
||||
@@ -20,6 +11,7 @@ public partial class Trebuchet : Problem<int, int>
|
||||
{
|
||||
_inputData = ReadInputLines();
|
||||
}
|
||||
|
||||
public override void CalculatePart1()
|
||||
{
|
||||
Part1 = _inputData.Select(GetCalibrationValues)
|
||||
@@ -78,7 +70,8 @@ public partial class Trebuchet : Problem<int, int>
|
||||
{
|
||||
left = word;
|
||||
break;
|
||||
}else if(line[i] - '0' >= 10)
|
||||
}
|
||||
else if (line[i] - '0' >= 10)
|
||||
continue;
|
||||
|
||||
left = line[i] - '0';
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using AdventOfCode.Runner.Attributes;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2023.Day2;
|
||||
|
||||
[ProblemInfo(2023, 2, "Cube Conundrum")]
|
||||
internal class CubeConundrum : Problem<int, int>
|
||||
{
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AdventOfCode.Problems.AOC2023.Day2;
|
||||
namespace AdventOfCode.Problems.AOC2023.Day2;
|
||||
|
||||
internal class CubeGame
|
||||
{
|
||||
@@ -54,15 +46,15 @@ internal record struct CubeRound(int Red, int Green, int Blue)
|
||||
var count = int.Parse(info[0]);
|
||||
switch (info[1])
|
||||
{
|
||||
case "red":
|
||||
case ['r', ..]:
|
||||
r = count;
|
||||
break;
|
||||
|
||||
case "green":
|
||||
case ['g', ..]:
|
||||
g = count;
|
||||
break;
|
||||
|
||||
case "blue":
|
||||
case ['b', ..]:
|
||||
b = count;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
global using AdventOfCode.Runner;
|
||||
global using AdventOfCode.Runner;
|
||||
|
||||
namespace AdventOfCode;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
namespace AdventOfCode.Runner.Attributes;
|
||||
|
||||
public class ProblemInfoAttribute : Attribute
|
||||
{
|
||||
public int Day { get; init; }
|
||||
public int Year { get; init; }
|
||||
public string Name { get; init; }
|
||||
|
||||
public ProblemInfoAttribute(int year, int day, string name)
|
||||
{
|
||||
Year = year;
|
||||
|
||||
Reference in New Issue
Block a user