public void GetPosition_ReturnsCorrectInformation(int x, int y, PositionInformation expected)
        {
            var input  = @"..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#";
            var map    = new LoopingMap(input);
            var actual = map.GetPosition(x, y);

            Assert.Equal(expected, actual);
        }
Beispiel #2
0
    public int TraverseMap(LoopingMap map, int xSlope, int ySlope)
    {
        var x            = 0;
        var y            = 0;
        var cutdownTrees = 0;

        do
        {
            y += ySlope;
            x += xSlope;
            var currentTile = map.GetPosition(x, y);
            if (currentTile == PositionInformation.Tree)
            {
                cutdownTrees++;
            }
        }while (y < map.Height - 1);
        return(cutdownTrees);
    }