Example #1
0
 private static long RunAlgorithm2(Day3Input input)
 {
     return(RunAlgorithm1(input, 1, 1) *
            RunAlgorithm1(input, 3, 1) *
            RunAlgorithm1(input, 5, 1) *
            RunAlgorithm1(input, 7, 1) *
            RunAlgorithm1(input, 1, 2));
 }
Example #2
0
 private static long RunAlgorithm1(Day3Input input, int right, int down)
 {
     return(Positions(input.Width, right, down)
            .TakeWhile(position => input.IsPositionValid(position))
            .Count(position => input.TreeAt(position)));
 }