private static int traverseHill(int right = 3, int down = 1) { int currentRow = 0; int currentColumn = 0; int treesEncountered = 0; Console.WriteLine($"Going down the hill at {right}X{down}"); // foreach(string hillRow in TreePattern) for (currentRow = 0; currentRow < TreePattern.Count(); currentRow += down) { if (currentRow % down == 1) { Console.WriteLine("skipping"); continue; } string hillRow = TreePattern[currentRow]; if (hillRow[currentColumn] == '#') { treesEncountered++; } // at the end index the row and column //currentRow += 1; currentColumn += right; currentColumn %= hillRow.Length; } Console.WriteLine("Reached the bottom"); Console.WriteLine($"Encountered {treesEncountered} trees!"); return(treesEncountered); }