static void Main() { var combinations = Input .GrowCombinations .Split(',') .Where(c => c.Last() == '#') .Select(c => c.Substring(0, 5)); var lifecyclePotRow = new LifeCyclePotrow(Input.InitialState, combinations); lifecyclePotRow.MoveGenerationsForward(20); Console.WriteLine($"A total of {lifecyclePotRow.CurrentSumOfPlantContainingPots} was generated."); }
public void Case() { // Arrange var initialState = "#..#.#..##......###...###"; var combinations = "...## => #,..#.. => #,.#... => #,.#.#. => #,.#.## => #,.##.. => #,.#### => #,#.#.# => #,#.### => #,##.#. => #,##.## => #,###.. => #,###.# => #,####. => #" .Split(',') .Where(c => c.Last() == '#') .Select(c => c.Substring(0, 5)); var lifecyclePotRow = new LifeCyclePotrow(initialState, combinations); // Act lifecyclePotRow.MoveGenerationsForward(20); // Assert Assert.Equal("..#....##....#####...#######....#.#..##.", lifecyclePotRow.CurrentState); Assert.Equal(325, lifecyclePotRow.CurrentSumOfPlantContainingPots); }