static void Main(string[] args) { Console.WriteLine("+-------------------------+"); Console.WriteLine("| Advent of Code - Day 03 |"); Console.WriteLine("+-------------------------+"); long input = 325489; Stopwatch sw = new Stopwatch(); sw.Start(); var part1 = SpiralMemory.GetSteps(input); sw.Stop(); Console.WriteLine($"Part 1: Number of requried steps is {part1} and was found in {sw.ElapsedMilliseconds} ms"); sw.Reset(); sw.Start(); var part2 = AdvancedSpiralMemory.GetFirstValueAboveTarget(input); sw.Stop(); Console.WriteLine($"Part 2: First value above target is {part2} and was found in {sw.ElapsedMilliseconds} ms"); Console.WriteLine($" - Glædelig jul"); }
private static void Main() { const int puzzleInput = 347991; var memoryMapper = new SpiralMemory(puzzleInput); var entry = memoryMapper.GenerateEntries().Last(); Console.WriteLine($"End coordinates are: {entry.X}, {entry.Y}"); Console.WriteLine($"Distance from origin is: {memoryMapper.DistanceFromOrigin()}"); memoryMapper = new SpiralMemory(1000); var stressEntry = memoryMapper.GenerateStressTestEntries(puzzleInput).Last(); Console.WriteLine("First value written that is larger than the input is: " + stressEntry.Value); }