Пример #1
0
        public int SolvePartOne(IEnumerable <string> input)
        {
            var bunny = new Bunny(new Tracker());

            foreach (var line in input)
            {
                bunny.Execute(line.TrimStart());
            }

            return(bunny.CalculateDistance());
        }
Пример #2
0
        public static int SolvePartOne()
        {
            var bunny = new Bunny(new Tracker());

            foreach (var line in Input)
            {
                bunny.Execute(line.TrimStart());
            }

            return(bunny.CalculateDistance());
        }
Пример #3
0
        public static int SolvePartTwo()
        {
            var advancedBunny = new Bunny(new AdvancedTracker());

            foreach (var line in Input)
            {
                advancedBunny.Execute(line.TrimStart());
                if (advancedBunny.ShouldShowDuplicate)
                {
                    break;
                }
            }

            return(advancedBunny.CalculateDistance());
        }
Пример #4
0
        public int SolvePartTwo(IEnumerable <string> input)
        {
            var bunny = new Bunny(new AdvancedTracker());

            foreach (var line in input)
            {
                bunny.Execute(line.TrimStart());

                if (bunny.ShouldShowDuplicate)
                {
                    return(bunny.CalculateDistance());
                }
            }

            return(bunny.CalculateDistance());
        }