Exemplo n.º 1
0
        public void GivenWholeSlope_WhenTraversed_ThenGivenCountOfTreesEncountered()
        {
            var trevser = new MapTreverser();

            var inputs = FileReader.ReadFileLines("input.txt");

            var countOfTrees = trevser.TraverseSlope(inputs, 1, 3);

            Assert.AreEqual(193, countOfTrees);
        }
Exemplo n.º 2
0
        public void GivenWholeSlopeMultipleTimes_WhenTraversed_ThenGivenCountOfTreesEncountered()
        {
            var trevser = new MapTreverser();

            var inputs = FileReader.ReadFileLines("input.txt");

            var slope1 = trevser.TraverseSlope(inputs, 1, 1);
            var slope2 = trevser.TraverseSlope(inputs, 1, 3);
            var slope3 = trevser.TraverseSlope(inputs, 1, 5);
            var slope4 = trevser.TraverseSlope(inputs, 1, 7);
            var slope5 = trevser.TraverseSlope(inputs, 2, 1);

            var total = slope1 * slope2 * slope3 * slope4 * slope5;

            Assert.AreEqual(1355323200, total);
        }
Exemplo n.º 3
0
        public void GivenASingleLineInput_WhenLatBeyondInput_ThenLoopsAroundToStartAndReturnsIfTreePresent(string input, int latitude, bool expected)
        {
            var traverser = new MapTreverser();

            Assert.AreEqual(expected, traverser.IsTreeAtLatitude(input, latitude));
        }