// Simulate 1000 steps of interaction in the given star system; get the total energy in it as defined by the task. public string PartOne(string[] lines) { var system = new System1D(lines); system.StepTimes(1000); return(system.TotalEnergy().ToString()); }
// Find out after how many steps the star system returns to the initial configuration. public string PartTwo(string[] lines) { var system = new System1D(lines); return(Enumerable.Range(0, 3).Select(system.StepAxisUntilSame).Aggregate(1L, LCM).ToString()); }