public void RepetitionTest(IEnumerable <IntVector> startingPosition, IEnumerable <IntVector> doesntMatter) { var system = new MoonMonitoringSystem(startingPosition); var count = system.GetRepetitionCount(); Assert.IsTrue(count == 2772); }
public void TestEnergy(IEnumerable <IntVector> startingPosition, IEnumerable <IntVector> doesntMatter) { var system = new MoonMonitoringSystem(startingPosition); system.Simulate(10); var energy = system.GetTotalEnegry(); Assert.IsTrue(energy == 179); }
public void TestTimeStep(IEnumerable <IntVector> startingPosition, IEnumerable <IntVector> expectedPosition) { var system = new MoonMonitoringSystem(startingPosition); system.NextTimeStep(); var positions = system.CurrentPositions; var equal = positions.SequenceEqual(expectedPosition); Assert.IsTrue(equal); }
/// <summary> /// Execution function for Day 12 /// </summary> public void Execute12() { UserActionAsync(() => { WriteToConsole("Start execution of Day12"); var IO = new IntVector(-3, 15, -11); var Europa = new IntVector(3, 13, -19); var Ganymede = new IntVector(-13, 18, -2); var Callisto = new IntVector(6, 0, -1); var system = new MoonMonitoringSystem(new List <IntVector> { IO, Europa, Ganymede, Callisto, }); system.Simulate(1000); var energy = system.GetTotalEnegry(); WriteToConsole($"The total energy in the system after 1000 timesteps is {energy}"); system = new MoonMonitoringSystem(new List <IntVector> { IO, Europa, Ganymede, Callisto, }); var count = system.GetRepetitionCount(); WriteToConsole($"The moons return to their position after {count} time steps"); }); }