private void RunPart2(List <string> map) { var slopes = new List <Tuple <int, int> > { new Tuple <int, int>(1, 1), new Tuple <int, int>(3, 1), new Tuple <int, int>(5, 1), new Tuple <int, int>(7, 1), new Tuple <int, int>(1, 2), }; var treesEncountered = new List <int>(); var result = 1; foreach (var slope in slopes) { var treeCount = new MapNavigator().CountTrees(map, slope); treesEncountered.Add(treeCount); result *= treeCount; } Console.Write("Trees encountered : 1"); foreach (var treeCount in treesEncountered) { Console.Write($"*{treeCount}"); } Console.WriteLine($" = {result}"); }
private void RunPart1(List <string> map) { int treeCount = new MapNavigator().CountTrees(ref map, new Tuple <int, int>(3, 1)); Console.WriteLine($"Trees encountered: {treeCount}"); foreach (var row in map) { Console.WriteLine($"{row}"); } }