コード例 #1
0
ファイル: Program.cs プロジェクト: peteski22/AdventOfCode
        static void Main(string[] args)
        {
            Console.WriteLine("DAY 1");
            Console.WriteLine("Part 1: " + Day01.GetPart1Result());
            Console.WriteLine("Part 2: " + Day01.GetPart2Result());

            Console.WriteLine("DAY 2");
            Console.WriteLine("Part 1: " + Day02.GetPart1Result);
            Console.WriteLine("Part 2: " + Day02.GetPart2Result);

            Console.WriteLine("DAY 3");
            Console.WriteLine("Part 1: " + Day03.GetPart1Result());
            Console.WriteLine("Part 2: " + Day03.GetPart2Result());

            Console.WriteLine("DAY 4");
            Console.WriteLine("Part 1: " + Day04.GetPart1Result());
            Console.WriteLine("Part 2: " + Day04.GetPart2Result());

            Console.WriteLine("DAY 5");
            Console.WriteLine("Part 1: TODO"); //+ Day05.GetPart1Result());
            Console.WriteLine("Part 2: TODO"); //+ Day05.GetPart2Result());

            Console.WriteLine("DAY 6");
            Console.WriteLine("Part 1: " + Day06.GetPart1Result());
            Console.WriteLine("Part 2: " + Day06.GetPart2Result());

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
コード例 #2
0
 static void Main(string[] args)
 {
     Day01.Run();
     Day02.Run();
     Day03.Run();
     Day04.Run();
     Day05.Run();
     Day06.Run();
     Day07.Run();
     Day08.Run();
     Day09.Run();
     Day10.Run();
     Day11.Run();
     Day12.Run();
     Day13.Run();
     Day14.Run();
     Day15.Run();
     Day16.Run();
     Day17.Run();
     Day18.Run();
     Day19a.Run();
     Day19b.Run();
     Day20.Run();
     Day21.Run();
     Day22.Run();
     Day23.Run();
     Day24.Run();
     Day25.Run();
 }
コード例 #3
0
        static void Main()
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            Day01.Solve();
            Day02.Solve();
            Day03.Solve();
            Day04.Solve();
            Day05.Solve();
            Day06.Solve();
            //Day07.Solve();
            Day08.Solve();

            var elapsed = stopwatch.Elapsed;

            Console.WriteLine($"\nTime: {elapsed}");
        }
コード例 #4
0
        public bool IsIncorrectNumber(string wantedNumber, int posInNumberList)
        {
            string numbersToInspect = "";

            for (int i = posInNumberList - PREAMBLE_LENGHT; i < posInNumberList; i++)
            {
                numbersToInspect += numbers[i] + "\r\n";
            }

            numbersToInspect = numbersToInspect.Substring(0, numbersToInspect.Length - 2);

            try
            {
                Day01 day01 = new Day01(numbersToInspect);
                day01.WANTED_NUMBER = Convert.ToInt64(wantedNumber);
                day01.SolvePart1();

                return(false);
            }
            catch
            {
                return(true);
            }
        }
コード例 #5
0
        static void Main(string[] args)
        {
            int output;

            #region Day 01
            Console.WriteLine("Advent of Code - Day 01");

            output = Day01.Day1Part1(InputHelper.InputToIntList(1));
            Console.WriteLine("Part 1: " + output);

            output = Day01.Day1Part2(InputHelper.InputToIntList(1));
            Console.WriteLine("Part 2: " + output);

            Console.WriteLine();
            #endregion Day 01

            #region Day 02
            Console.WriteLine("Advent of Code - Day 02");

            output = Day02.Day2Part1(InputHelper.InputToStringList(2));
            Console.WriteLine("Part 1: " + output);

            output = Day02.Day2Part2(InputHelper.InputToStringList(2));
            Console.WriteLine("Part 2: " + output);

            Console.WriteLine();
            #endregion Day 02

            #region Day 03
            Console.WriteLine("Advent of Code - Day 03");

            output = Day03.Day3Part1(InputHelper.InputToStringList(3), 3, 1);
            Console.WriteLine("Part 1: " + output);

            var input  = InputHelper.InputToStringList(3);
            int count1 = Day03.Day3Part1(input, 1, 1);
            int count2 = Day03.Day3Part1(input, 3, 1);
            int count3 = Day03.Day3Part1(input, 5, 1);
            int count4 = Day03.Day3Part1(input, 7, 1);
            int count5 = Day03.Day3Part1(input, 1, 2);
            //TODO: bug - number is too large, overflow
            output = count1 * count2 * count3 * count4 * count5;
            Console.WriteLine("Part 2: " + output);

            Console.WriteLine();
            #endregion Day 03

            #region Day 04
            Console.WriteLine("Advent of Code - Day 04");

            output = Day04.Day4Part1(InputHelper.InputToStringList(4));
            Console.WriteLine("Part 1: " + output);

            output = Day04.Day4Part2(InputHelper.InputToStringList(4));
            Console.WriteLine("Part 2: " + output);

            Console.WriteLine();
            #endregion Day 04

            #region Day 05
            Console.WriteLine("Advent of Code - Day 05");

            output = Day05.Day5Part1(InputHelper.InputToStringList(5));
            Console.WriteLine("Part 1: " + output);

            output = Day05.Day5Part2(InputHelper.InputToStringList(5));
            Console.WriteLine("Part 2: " + output);

            Console.WriteLine();
            #endregion Day 05

            #region Day 06
            Console.WriteLine("Advent of Code - Day 05");

            output = Day06.Day6Part1(InputHelper.InputToStringList(6));
            Console.WriteLine("Part 1: " + output);

            output = Day06.Day6Part2(InputHelper.InputToStringList(6));
            Console.WriteLine("Part 2: " + output);

            Console.WriteLine();
            #endregion Day 06
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: ThatAdamsGuy/AdventOfCode
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("*******************");
                Console.WriteLine("Advent of Code 2020");
                Console.WriteLine("*******************");
                Console.WriteLine();
                Console.Write("Run day: ");
                int dayToRun = int.Parse(Console.ReadLine());

                switch (dayToRun)
                {
                case 1:
                    Day01.Run();
                    break;

                case 2:
                    Day02.Run();
                    break;

                case 3:
                    Day03.Run();
                    break;

                case 4:
                    Day04.Run();
                    break;

                case 5:
                    Day05.Run();
                    break;

                case 6:
                    Day06.Run();
                    break;

                case 7:
                    Day07.Run();
                    break;

                case 8:
                    Day08.Run();
                    break;

                case 9:
                    Day09.Run();
                    break;

                case 10:
                    Day10.Run();
                    break;

                case 11:
                    Day11.Run();
                    break;

                case 12:
                    Day12.Run();
                    break;

                case 13:
                    Day13.Run();
                    break;

                case 14:
                    Day14.Run();
                    break;

                case 15:
                    Day15.Run();
                    break;

                case 16:
                    Day16.Run();
                    break;

                case 17:
                    Day17.Run();
                    break;

                case 18:
                    Day18.Run();
                    break;

                case 19:
                    Day19.Run();
                    break;

                case 20:
                    Day20.Run();
                    break;

                case 21:
                    Day21.Run();
                    break;

                case 22:
                    Day22.Run();
                    break;

                case 23:
                    Day23.Run();
                    break;

                case 24:
                    Day24.Run();
                    break;

                case 25:
                    Day25.Run();
                    break;
                }
                Console.WriteLine();
            }
        }
コード例 #7
0
        public static void Main(string[] args)
        {
            Logger.ShowDebug = false;

            Leaderboard.Start();

            Day01.StartA();
            Day01.StartB();

            Day02.StartA();
            Day02.StartB();

            Day03.StartA();
            Day03.StartB();

            Day04.StartA();
            Day04.StartB();

            Day05.StartA();
            Day05.StartB();

            Day06.StartA();
            Day06.StartB();

            Day07.StartA();
            Day07.StartB();

            Day08.StartA();
            Day08.StartB();

            Day09.StartA();
            Day09.StartB();

            Day10.StartA();
            Day10.StartB();

            Day11.StartA();
            Day11.StartB();

            Day12.StartA();
            Day12.StartB();

            Day13.StartA();
            Day13.StartB();
            Day13.StartB2();
            Day13.StartB3();

            Day14.StartA();
            Day14.StartB();

            Day15.StartA();
            Day15.StartB();

            Day16.StartA();
            Day16.StartB();

            Day17.StartA();
            Day17.StartB();

            Day18.StartA();
            Day18.StartB();

            Day19.StartA();
            Day19.StartB();

            Day20.StartA();
            Day20.StartB();

            Day21.StartA();
            Day21.StartB();

            Day22.StartA();
            Day22.StartB();

            Day23.StartA();
            Day23.StartB();

            Day24.StartA();
            Day24.StartB();

            Day25.StartA();

            Logger.ShowDebug = true;

            Console.ReadKey();
        }
コード例 #8
0
 public static void Main()
 {
     Console.WriteLine("*** Advent of Code 2020 ***");
     Console.WriteLine();
     Console.WriteLine("--- Day 1: Report Repair ---");
     Console.WriteLine("Part One Answer: " + Day01.PartOne());
     Console.WriteLine("Part Two Answer: " + Day01.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 2: Password Philosophy ---");
     Console.WriteLine("Part One Answer: " + Day02.PartOne());
     Console.WriteLine("Part Two Answer: " + Day02.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 3: Toboggan Trajectory ---");
     Console.WriteLine("Part One Answer: " + Day03.PartOne());
     Console.WriteLine("Part Two Answer: " + Day03.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 4: Passport Processing ---");
     Console.WriteLine("Part One Answer: " + Day04.PartOne());
     Console.WriteLine("Part Two Answer: " + Day04.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 5: Binary Boarding ---");
     Console.WriteLine("Part One Answer: " + Day05.PartOne());
     Console.WriteLine("Part Two Answer: " + Day05.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 6: Custom Customs ---");
     Console.WriteLine("Part One Answer: " + Day06.PartOne());
     Console.WriteLine("Part Two Answer: " + Day06.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 7: Handy Haversacks ---");
     Console.WriteLine("Part One Answer: " + Day07.PartOne());
     Console.WriteLine("Part Two Answer: " + Day07.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 8: Handheld Halting ---");
     Console.WriteLine("Part One Answer: " + Day08.PartOne());
     Console.WriteLine("Part Two Answer: " + Day08.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 9: Encoding Error ---");
     Console.WriteLine("Part One Answer: " + Day09.PartOne());
     Console.WriteLine("Part Two Answer: " + Day09.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 10: Adapter Array ---");
     Console.WriteLine("Part One Answer: " + Day10.PartOne());
     Console.WriteLine("Part Two Answer: " + Day10.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 11: Seating System ---");
     Console.WriteLine("Part One Answer: " + Day11.PartOne());
     Console.WriteLine("Part Two Answer: " + Day11.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 12: Rain Risk ---");
     Console.WriteLine("Part One Answer: " + Day12.PartOne());
     Console.WriteLine("Part Two Answer: " + Day12.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 13: Shuttle Search ---");
     Console.WriteLine("Part One Answer: " + Day13.PartOne());
     Console.WriteLine("Part Two Answer: " + Day13.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 14: Docking Data ---");
     Console.WriteLine("Part One Answer: " + Day14.PartOne());
     Console.WriteLine("Part Two Answer: " + Day14.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 15: Rambunctious Recitation ---");
     Console.WriteLine("Part One Answer: " + Day15.PartOne());
     Console.WriteLine("Part Two Answer: " + Day15.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 16: Ticket Translation ---");
     Console.WriteLine("Part One Answer: " + Day16.PartOne());
     Console.WriteLine("Part Two Answer: " + Day16.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 17: Conway Cubes ---");
     Console.WriteLine("Part One Answer: " + Day17.PartOne());
     Console.WriteLine("Part Two Answer: " + Day17.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 18: Operation Order ---");
     Console.WriteLine("Part One Answer: " + Day18.PartOne());
     Console.WriteLine("Part Two Answer: " + Day18.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 19: Monster Messages ---");
     Console.WriteLine("Part One Answer: " + Day19.PartOne());
     Console.WriteLine("Part Two Answer: " + Day19.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 20: Jurassic Jigsaw ---");
     Console.WriteLine("Part One Answer: " + Day20.PartOne());
     Console.WriteLine("Part Two Answer: " + Day20.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 21: Allergen Assessment ---");
     Console.WriteLine("Part One Answer: " + Day21.PartOne());
     Console.WriteLine("Part Two Answer: " + Day21.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 22: Crab Combat ---");
     Console.WriteLine("Part One Answer: " + Day22.PartOne());
     Console.WriteLine("Part Two Answer: " + Day22.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 23: Crab Cups ---");
     Console.WriteLine("Part One Answer: " + Day23.PartOne());
     Console.WriteLine("Part Two Answer: " + Day23.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 24: Lobby Layout ---");
     Console.WriteLine("Part One Answer: " + Day24.PartOne());
     Console.WriteLine("Part Two Answer: " + Day24.PartTwo());
     Console.WriteLine();
     Console.WriteLine("--- Day 25: Combo Breaker ---");
     Console.WriteLine("Part One Answer: " + Day25.PartOne());
     Console.WriteLine("Part Two Answer: fifty stars");
     Console.WriteLine();
     Console.ReadKey();
 }
コード例 #9
0
        static void Main(string[] args)
        {
            var startTime = DateTime.Now;

            Console.WriteLine("---Welcome to erjicle's solutions to Advent of Code 2020!!---");
            // Day 1
            Console.WriteLine($"Day 01 - Part 1: {Day01.GetDay01Part01Answer()}");
            Console.WriteLine($"Day 01 - Part 2: {Day01.GetDay01Part02Answer()}");
            // Day 2
            Console.WriteLine($"Day 02 - Part 1: {Day02.GetDay02Part01Answer()}");
            Console.WriteLine($"Day 02 - Part 2: {Day02.GetDay02Part02Answer()}");
            // Day 3
            Console.WriteLine($"Day 03 - Part 1: {Day03.GetDay03Part01Answer()}");
            Console.WriteLine($"Day 03 - Part 2: {Day03.GetDay03Part02Answer()}");
            // Day 4
            Console.WriteLine($"Day 04 - Part 1: {Day04.GetDay04Part01Answer()}");
            Console.WriteLine($"Day 04 - Part 2: {Day04.GetDay04Part02Answer()}");
            // Day 5
            Console.WriteLine($"Day 05 - Part 1: {Day05.GetDay05Part01Answer()}");
            Console.WriteLine($"Day 05 - Part 2: {Day05.GetDay05Part02Answer()}");
            // Day 6
            Console.WriteLine($"Day 06 - Part 1: {Day06.GetDay06Part01Answer()}");
            Console.WriteLine($"Day 06 - Part 2: {Day06.GetDay06Part02Answer()}");
            // Day 7
            Console.WriteLine($"Day 07 - Part 1: {Day07.GetDay07Part01Answer()}");
            Console.WriteLine($"Day 07 - Part 2: {Day07.GetDay07Part02Answer()}");
            // Day 8
            Console.WriteLine($"Day 08 - Part 1: {Day08.GetDay08Part01Answer()}");
            Console.WriteLine($"Day 08 - Part 2: {Day08.GetDay08Part02Answer()}");
            // Day 9
            Console.WriteLine($"Day 09 - Part 1: {Day09.GetDay09Part01Answer()}");
            Console.WriteLine($"Day 09 - Part 2: {Day09.GetDay09Part02Answer()}");
            // Day 10
            Console.WriteLine($"Day 10 - Part 1: {Day10.GetDay10Part01Answer()}");
            Console.WriteLine($"Day 10 - Part 2: {Day10.GetDay10Part02Answer()}");
            // Day 11
            Console.WriteLine($"Day 11 - Part 1: {Day11.GetDay11Part01Answer()}");
            Console.WriteLine($"Day 11 - Part 2: {Day11.GetDay11Part02Answer()}");
            // Day 12
            Console.WriteLine($"Day 12 - Part 1: {Day12.GetDay12Part01Answer()}");
            Console.WriteLine($"Day 12 - Part 2: {Day12.GetDay12Part02Answer()}");
            // Day 13
            Console.WriteLine($"Day 13 - Part 1: {Day13.GetDay13Part01Answer()}");
            Console.WriteLine($"Day 13 - Part 2: {Day13.GetDay13Part02Answer()}");
            // Day 14
            Console.WriteLine($"Day 14 - Part 1: {Day14.GetDay14Part01Answer()}");
            Console.WriteLine($"Day 14 - Part 2: {Day14.GetDay14Part02Answer()}");
            // Day 15
            Console.WriteLine($"Day 15 - Part 1: {Day15.GetDay15Part01Answer()}");
            Console.WriteLine($"Day 15 - Part 2: {Day15.GetDay15Part02Answer()}");
            // Day 16
            Console.WriteLine($"Day 16 - Part 1: {Day16.GetDay16Part01Answer()}");
            Console.WriteLine($"Day 16 - Part 2: {Day16.GetDay16Part02Answer()}");
            // Day 17
            Console.WriteLine($"Day 17 - Part 1: {Day17.GetDay17Part01Answer()}");
            Console.WriteLine($"Day 17 - Part 2: {Day17.GetDay17Part02Answer()}");
            // Day 18
            Console.WriteLine($"Day 18 - Part 1: {Day18.GetDay18Part01Answer()}");
            Console.WriteLine($"Day 18 - Part 2: {Day18.GetDay18Part02Answer()}");
            // Day 19
            Console.WriteLine($"Day 19 - Part 1: {Day19.GetDay19Part01Answer()}");
            Console.WriteLine($"Day 19 - Part 2: {Day19.GetDay19Part02Answer()}");
            // Day 20
            Console.WriteLine($"Day 20 - Part 1: {Day20.GetDay20Part01Answer()}");
            Console.WriteLine($"Day 20 - Part 2: {Day20.GetDay20Part02Answer()}");
            // Day 21
            Console.WriteLine($"Day 21 - Part 1: {Day21.GetDay21Part01Answer()}");
            Console.WriteLine($"Day 21 - Part 2: {Day21.GetDay21Part02Answer()}");
            // Day 22
            Console.WriteLine($"Day 22 - Part 1: {Day22.GetDay22Part01Answer()}");
            Console.WriteLine($"Day 22 - Part 2: {Day22.GetDay22Part02Answer()}");
            // Day 23
            Console.WriteLine($"Day 23 - Part 1: {Day23.GetDay23Part01Answer()}");
            Console.WriteLine($"Day 23 - Part 2: {Day23.GetDay23Part02Answer()}");
            // Day 24
            Console.WriteLine($"Day 24 - Part 1: {Day24.GetDay24Part01Answer()}");
            Console.WriteLine($"Day 24 - Part 2: {Day24.GetDay24Part02Answer()}");
            // Day 25
            Console.WriteLine($"Day 25 - Part 1: {Day25.GetDay25Part01Answer()}");
            var endTime = DateTime.Now;

            Console.WriteLine("All puzzles complete! You have now arrived at your sweet tropical vacation spot. Enjoy!");
            Console.WriteLine($"Processing complete in {(endTime - startTime).TotalSeconds} second(s)!");
        }
コード例 #10
0
 static void Main(string[] args)
 {
     Day01.Puzzle();
     //Day02.Puzzle();
     ReadKey();
 }