Example #1
0
        static void Main(string[] args)
        {
            // Day 01
            string inputDay01;

            using (StreamReader streamReader = new StreamReader(@"C:/Temp/input_2017_day1.txt"))
                inputDay01 = streamReader.ReadLine();
            Console.WriteLine("The total sum of digits matching the following digit is: " + Day01.FindSumOfSequentialDigits(inputDay01));
            Console.WriteLine("The total sum of digits matching the number halfway through the list is: " + Day01.FindSumOfMatchingDigits(inputDay01));
            Console.WriteLine();

            // Day 02
            List <int> rowDifferences = new List <int>();
            List <int> rowDivisions   = new List <int>();

            Day02.PopulateLists(rowDifferences, rowDivisions);
            Console.WriteLine("The checksum is: " + rowDifferences.Sum());
            Console.WriteLine("The sum of all even divisions is: " + rowDivisions.Sum());
            Console.WriteLine();

            // Day 03
            int inputDay03 = 361527;

            Console.WriteLine("The distance between the first and last point is: " + Day03.FindDistance(inputDay03));
            Console.WriteLine("The first number that is larger than the input is: " + Day03.FindFirstLarger(inputDay03));
            Console.WriteLine();

            // Day 04
            int numberOfValidPassphrases   = 0;
            int numberOfNonAnaghramPhrases = 0;

            Day04.FindValidPhrases(ref numberOfValidPassphrases, ref numberOfNonAnaghramPhrases);
            Console.WriteLine("The number of valid passphrases is: " + numberOfValidPassphrases);
            Console.WriteLine("The number of valid passphrases without anaghrams is: " + numberOfNonAnaghramPhrases);
            Console.WriteLine();

            // Day 05
            List <int> listOfInstructions = new List <int>();

            using (StreamReader streamReader = new StreamReader(@"C:/Temp/input_2017_day5.txt"))
            {
                string row;
                while ((row = streamReader.ReadLine()) != null)
                {
                    listOfInstructions.Add(Convert.ToInt32(row));
                }
            }
            Console.WriteLine("Number of moves to escape (Part 1): " + Day05.NumberOfMovesToEscapse(new List <int>(listOfInstructions)));
            Console.WriteLine("Number of moves to escape (Part 2): " + Day05.MovesToEscapseWithAddedRule(listOfInstructions));
            Console.WriteLine();

            // Day 06
            int[] input              = { 10, 3, 15, 10, 5, 15, 5, 15, 9, 2, 5, 8, 5, 2, 3, 6 };
            int   numberOfCycles     = 0;
            int   indexOfDuplication = 0;

            Day06.CalulateCycles(input, ref numberOfCycles, ref indexOfDuplication);
            Console.WriteLine("The numbers of cycles that ran before a duplication was seen: " + numberOfCycles);
            Console.WriteLine("The numbers of loops between the duplications was: " + (numberOfCycles - indexOfDuplication));
            Console.WriteLine();

            // Day 07 (Only Part 1 as of now)
            string nameOfRootNode = Day07.FindNameOfRootNode();

            Console.WriteLine("The name of the bottom program is: " + nameOfRootNode);
            Console.WriteLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Advent of Code 2017");
            Console.WriteLine("===================");

            Console.WriteLine("\nDAY 1");
            Day01.Run();

            Console.WriteLine("\nDAY 2");
            Day02.Run();

            Console.WriteLine("\nDAY 3");
            Day03.Run();

            Console.WriteLine("\nDAY 4");
            Day04.Run();

            Console.WriteLine("\nDAY 5");
            Day05.Run();

            Console.WriteLine("\nDAY 6");
            Day06.Run();

            Console.WriteLine("\nDAY 7");
            Day07.Run();

            Console.WriteLine("\nDAY 8");
            Day08.Run();

            Console.WriteLine("\nDAY 9");
            Day09.Run();

            Console.WriteLine("\nDAY 10");
            Day10.Run();

            Console.WriteLine("\nDAY 11");
            Day11.Run();

            Console.WriteLine("\nDAY 12");
            Day12.Run();

            Console.WriteLine("\nDAY 13");
            Day13.Run();

            Console.WriteLine("\nDAY 14");
            Day14.Run();

            Console.WriteLine("\nDAY 15");
            Day15.Run();

            Console.WriteLine("\nDAY 16");
            Day16.Run();

            Console.WriteLine("\nDAY 17");
            Day17.Run();

            Console.WriteLine("\nDAY 18");
            Day18.Run();

            Console.WriteLine("\nDAY 19");
            Day19.Run();

            Console.WriteLine("\nDAY 20");
            Day20.Run();

            Console.WriteLine("\nDAY 22");
            Day22.Run();

            Console.WriteLine("\nDAY 23");
            Day23.Run();
        }
Example #3
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("*******************");
                Console.WriteLine("Advent of Code 2017");
                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();
            }
        }