public static void Main() { var joltAdapter = JoltAdapter.Parse(File.ReadAllLines("input.txt").Select(long.Parse)); Console.WriteLine($"Part 1: the counts (offsets of 1 and 3) multiplied is: " + $"{joltAdapter.AdaptersWithXOffsetCount(1) * joltAdapter.AdaptersWithXOffsetCount(3)}."); Console.WriteLine($"Part 2: the number of options is {joltAdapter.NumberOfConnectionOptions}"); }
public void Part2(string filepath, long expected) { var parser = new Parser(filepath); var lines = parser.Parse(new IdentityFactory()); var sut = new JoltAdapter(lines); var actual = sut.Pathways(); Assert.Equal(expected, actual); }
static void Main(string[] args) { var joltAdapter = new JoltAdapter(File.ReadAllLines("../input.txt")); //Part One Console.WriteLine(joltAdapter.GetChainInput()); //Part Two Console.WriteLine(joltAdapter.ArrangeAdapter()); }
public void SolvePart1() { int[] adapterRatings = InputParser.ReadToIntArr(Day, "1"); JoltAdapter[] adapters = new JoltAdapter[adapterRatings.Length]; for (int i = 0; i < adapterRatings.Length; i++) { adapters[i] = new JoltAdapter(adapterRatings[i]); } Device device = new Device(adapters.Select(a => a.Rating).Max() + 3); JoltAdapter[] chain = Utilities.CreateSimpleChain(adapters); chain[^ 1].ConnectRecipient(device);
public void PartOneSmallTest() { var subject = new JoltAdapter(GetSmallExampleInput()); Assert.Equal(35, subject.GetChainInput()); }
public void PartTwoTest() { var subject = new JoltAdapter(GetExampleInput()); Assert.Equal(19208, subject.ArrangeAdapter()); }
public void PartTwoSmallTest() { var subject = new JoltAdapter(GetSmallExampleInput()); Assert.Equal(8, subject.ArrangeAdapter()); }
public void PartOneTest() { var subject = new JoltAdapter(GetExampleInput()); Assert.Equal(220, subject.GetChainInput()); }