Exemplo n.º 1
0
        public string ComputePartTwo(string[] input)
        {
            stopWatch = new Stopwatch();
            stopWatch.Start();

            var inputList = RepeatInput(input[0], 10000);
            var offset    = CalculateOffset(inputList);

            inputList = inputList.Substring(offset);

            // return $"{offset} - length: {inputList.Length} - generatePattern substring: {string.Join("", GeneratePattern(inputList.Length, offset)).Substring(offset-8, 48)}";

            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - BeforeOutput");
            var outputList = CalculateOutputPartTwo(inputList);

            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Generated output");
            var phase = 1;

            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Calculated offset");
            // Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - AppliedPhase {phase} - {inputList}");

            while (phase < 100)
            {
                // Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Applied phase {phase} - {outputList.Substring(outputList.Length-20), 20}");
                phase++;
                outputList = CalculateOutputPartTwo(outputList);
            }
            Console.WriteLine($"{DisplayUtils.DisplayValue(stopWatch)} - Applied phase {phase}");

            return(outputList.Substring(0, 8));
        }
Exemplo n.º 2
0
 static void DisplayDuration(Stopwatch stopWatch)
 {
     Console.WriteLine("RunTime " + DisplayUtils.DisplayValue(stopWatch));
 }