using System.Collections.Generic;
public int Across {get;set;}
public int Down {get;set;}
public static void Main()
var input = @"..##.......
var directionsPart1 = new List<Direction>() {
new Direction { Across = 3, Down = 1},
var directionsPart2 = new List<Direction>() {
new Direction { Across = 1, Down = 1},
new Direction { Across = 3, Down = 1},
new Direction { Across = 5, Down = 1},
new Direction { Across = 7, Down = 1},
new Direction { Across = 1, Down = 2}
ProcessDirections(input, directionsPart1, "Result for part one: ");
ProcessDirections(input, directionsPart2, "Result for part two: ");
public static void ProcessDirections(string input, List<Direction> directions, string label) {
foreach (Direction d in directions) {
var lines = input.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
while (i < lines.Length) {
while (treeLine.Length < position + 1) {
treeLine = $"{treeLine}{line}";
if (treeLine[position] == '#') {
runningTotal = runningTotal * treeCount;
Console.WriteLine($"{label}{runningTotal}");