예제 #1
0
        public override string PartOne(string input)
        {
            Coords   startingLoc = new Coords(0, 0);
            Map      treeMap     = new Map(CreateMap(input), startingLoc, 3, 1);
            Toboggan tob         = new Toboggan(treeMap);

            return(Convert.ToString(tob.DownhillRun()));
        }
예제 #2
0
        public override string PartTwo(string input)
        {
            Coords   startingLoc = new Coords(0, 0);
            Map      treeMap     = new Map(CreateMap(input), startingLoc, 1, 1);
            Toboggan tob         = new Toboggan(treeMap);

            var treeCount1 = tob.DownhillRun();

            tob.UpdateSlope(3, 1);
            var treeCount2 = tob.DownhillRun();

            tob.UpdateSlope(5, 1);
            var treeCount3 = tob.DownhillRun();

            tob.UpdateSlope(7, 1);
            var treeCount4 = tob.DownhillRun();

            tob.UpdateSlope(1, 2);
            var treeCount5 = tob.DownhillRun();

            return(Convert.ToString(treeCount1 * treeCount2 * treeCount3 * treeCount4 * treeCount5));
        }