public void EnumerateParents() { var map_a = Orbit.BuildOrbitMap(MAP_A); map_a["L"].Parents().Select(o => o.Key).Should().ContainInOrder("K", "J", "E", "D", "C", "B", "COM"); map_a["I"].Parents().Select(o => o.Key).Should().ContainInOrder("D", "C", "B", "COM"); }
public void TransferCountShouldBeCorrect() { var orbit = Orbit.BuildOrbitMap(MAP_B); var distance = orbit.TransfersBetween("YOU", "SAN"); distance.Should().Be(4); orbit = Orbit.BuildOrbitMap(MAP_C); distance = orbit.TransfersBetween("YOU", "SAN"); distance.Should().Be(7); }
public void BuildPart1ExampleMap() { var orbit = Orbit.BuildOrbitMap(MAP_A); orbit.Key.Should().Be("COM"); orbit.Parent.Should().Be(orbit); orbit["B"].Children.Select(o => o.Key).Should().ContainInOrder("C", "G"); orbit["L"].Parent.Should().Be(orbit["K"]); orbit["L"].Depth.Should().Be(7); orbit["D"].Depth.Should().Be(3); orbit.TotalOrbits().Should().Be(42); }
static void Day6() { WriteLine("--- Day 6: Universal Orbit Map ---"); var map = "Day6/input.txt".ReadLines(); var orbit = Orbit.BuildOrbitMap(map); var result = orbit.TotalOrbits(); WriteLine(result); var distance = orbit.TransfersBetween("YOU", "SAN"); WriteLine(distance); }