public static void CalcBatch(string inp, int numIterations) { var vectors = Day12Input.Satellites(inp); Console.WriteLine(vectors.Length); for (int i = 1; i < numIterations + 1; i++) { UpdateAll(vectors); } Console.WriteLine($"After {numIterations} steps"); var tot = vectors.Select(a => CalcKinOne(a) * CalcPotOne(a)).Sum(); Console.WriteLine($"Tot = {tot}"); }
public static void Calc() { //CalcBatch(Day12Input.Ex1, 10); //CalcBatch(Day12Input.Ex2, 100); //CalcBatch(Day12Input.official, 1000); Stopwatch watch = Stopwatch.StartNew(); CalcBatch(Day12Input.Test1, 100); watch.Stop(); Console.WriteLine(watch.Elapsed); CalcAllPeriods(Day12Input.Satellites(Day12Input.Ex1)); CalcAllPeriods(Day12Input.Satellites(Day12Input.Ex2)); CalcAllPeriods(Day12Input.Satellites(Day12Input.official)); //Console.WriteLine($"{GCD(6,4)}"); }