public void AOC_2020_Day03a() { var input = File.ReadAllText(".//Content2//2020/Day03.txt"); var answer = AOC_2020_Day03_Answer.CountTrees(input); answer.Should().Be(198); }
public void test_tree_count_variable_slope(int deltaX, int deltaY, int expectedResult) { var input = $"..##.......{Environment.NewLine}#...#...#..{Environment.NewLine}.#....#..#.{Environment.NewLine}..#.#...#.#{Environment.NewLine}.#...##..#.{Environment.NewLine}..#.##.....{Environment.NewLine}.#.#.#....#{Environment.NewLine}.#........#{Environment.NewLine}#.##...#...{Environment.NewLine}#...##....#{Environment.NewLine}.#..#...#.#"; var answer = AOC_2020_Day03_Answer.CountTreesForSlopeX(input, deltaX, deltaY); answer.Should().Be(expectedResult); }
public void test_tree_count() { var input = $"..##.......{Environment.NewLine}#...#...#..{Environment.NewLine}.#....#..#.{Environment.NewLine}..#.#...#.#{Environment.NewLine}.#...##..#.{Environment.NewLine}..#.##.....{Environment.NewLine}.#.#.#....#{Environment.NewLine}.#........#{Environment.NewLine}#.##...#...{Environment.NewLine}#...##....#{Environment.NewLine}.#..#...#.#"; var answer = AOC_2020_Day03_Answer.CountTrees(input); answer.Should().Be(7); }
public void AOC_2020_Day03b() { var input = File.ReadAllText(".//Content2//2020/Day03.txt"); var answers = new[] { AOC_2020_Day03_Answer.CountTreesForSlopeX(input, 1, 1), AOC_2020_Day03_Answer.CountTreesForSlopeX(input, 3, 1), AOC_2020_Day03_Answer.CountTreesForSlopeX(input, 5, 1), AOC_2020_Day03_Answer.CountTreesForSlopeX(input, 7, 1), AOC_2020_Day03_Answer.CountTreesForSlopeX(input, 1, 2) }; var answer = answers.Aggregate(1D, (acc, x) => acc * x); answer.Should().Be(5140884672); }