26 lines
842 B
C#
26 lines
842 B
C#
namespace AdventOfCodeLibrary._2022
|
|
{
|
|
using AdventOfCodeLibrary._2022.Day_05;
|
|
using AdventOfCodeLibrary.Shared;
|
|
|
|
public class Day05Part2 : Answerable
|
|
{
|
|
public override int Year { get; set; } = 2022;
|
|
public override int Day { get; set; } = 5;
|
|
public override int Part { get; set; } = 2;
|
|
|
|
public override string GetAwner(byte[] data)
|
|
{
|
|
string[] initAndInstructions = GetAsString(data).Split(NewLine + NewLine);
|
|
CraneWork work = new CraneWork();
|
|
work.ReadInitialContainerArrangement(initAndInstructions[0].Split(NewLine));
|
|
foreach (string instruction in initAndInstructions[1].Split(NewLine))
|
|
{
|
|
work.DoCraneWork(instruction, false);
|
|
}
|
|
|
|
return work.GetTopContainers();
|
|
}
|
|
}
|
|
}
|