public void DaySeven_PartTwo_ReturnsWeightDifference() { var input = File.ReadAllLines($"{inputsPrefix}Day7.txt"); var tower = new ProgramTree(input); var bottomDisc = tower.GetBottomDisc(); tower.BuildTree(bottomDisc); var result = tower.DetermineOptimalWeightOfUnbalancedDisc(); Assert.Equal(596, result); }
public void BuildTreeShould_PopulateChildren() { var input = new[] { "pbga (66)", "xhth (57)", "ebii (61)", "havc (66)", "ktlj (57)", "fwft (72) -> ktlj, cntj, xhth", "qoyq (66)", "padx (45) -> pbga, havc, qoyq", "tknk (41) -> ugml, padx, fwft", "jptl (61)", "ugml (68) -> gyxo, ebii, jptl", "gyxo (61)", "cntj (57)" }; var tower = new ProgramTree(input); var bottomDisc = tower.GetBottomDisc(); tower.BuildTree(bottomDisc); Assert.NotNull(tower.Discs); foreach (var disc in tower.Discs.Where(d => d.HasChildren)) { Assert.NotNull(disc.ChildDiscs); } }