Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var day1 = new Day1();
            var day2 = new Day2();
            var day3 = new Day3();
            var day4 = new Day4();
            var day5 = new Day5();
            var day6 = new Day6();
            var day7 = new Day7();
            var day8 = new Day8();

            ExecuteAndShowTime(day1.Part1, 1, 1);
            ExecuteAndShowTime(day1.Part2, 1, 2);
            ExecuteAndShowTime(day2.Part1, 2, 1);
            ExecuteAndShowTime(day2.Part2, 2, 2);
            ExecuteAndShowTime(day3.Part1, 3, 1);
            ExecuteAndShowTime(day3.Part2, 3, 2);
            ExecuteAndShowTime(day4.Part1, 4, 1);
            ExecuteAndShowTime(day4.Part2, 4, 2);
            ExecuteAndShowTime(day5.Part1, 5, 1);
            ExecuteAndShowTime(day5.Part2, 5, 2);
            ExecuteAndShowTime(day6.Part1, 6, 1);
            ExecuteAndShowTime(day6.Part2, 6, 2);
            ExecuteAndShowTime(day7.Part1, 7, 1);
            ExecuteAndShowTime(day7.Part2, 7, 2);
            ExecuteAndShowTime(day8.Part1, 8, 1);
        }
Ejemplo n.º 2
0
        private static void SolveDay6()
        {
            StringData data = new StringData(".\\Data\\Day6a.txt");
            Day6       day  = new Day6(data);

            Console.WriteLine("Day6");
            day.SolveToConsole();
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Helper.PrintChallenge("Day 1");
            Day1.Run();

            Helper.PrintChallenge("Day 2");
            Day2.Run();

            Helper.PrintChallenge("Day 3");
            Day3.Run();

            Helper.PrintChallenge("Day 4");
            Day4.Run();

            Helper.PrintChallenge("Day 5");
            Day5.Run();

            Helper.PrintChallenge("Day 6");
            Day6.Run();

            Helper.PrintChallenge("Day 7");
            Day7.Run();

            Helper.PrintChallenge("Day 8");
            Day8.Run();

            Helper.PrintChallenge("Day 9");
            Day9.Run();

            Helper.PrintChallenge("Day 10");
            Day10.Run();

            Helper.PrintChallenge("Day 11");
            Day11.Run();

            Helper.PrintChallenge("Day 12");
            Day12.Run();

            Helper.PrintChallenge("Day 13");
            Day13.Run();

            Helper.PrintChallenge("Day 14");
            Day14.Run();

            Helper.PrintChallenge("Day 15");
            Day15.Run();

            Helper.PrintChallenge("Day 16");
            Day16.Run();

            Helper.PrintChallenge("Day 17");
            Day17.Run();
        }
Ejemplo n.º 4
0
 static void bigDemo()
 {
     Day1.Demo();
     Day2.demo();
     Day3.demo();
     Day4.demo();
     Day5.demo();
     Day6.demo();
     Day7.demo();
     Day8.demo();
     Day9.demo();
 }
Ejemplo n.º 5
0
        public void InitializePuzzle(string path, string cookie, int day)
        {
            Uri uri = new Uri(path);

            using var client = new HttpClient();
            client.DefaultRequestHeaders.Add("Cookie", cookie);
            var response = client.GetStringAsync(uri).Result;

            response.Replace(" ", "");
            string[] values = response.Split("\n");

            if (day == 1)
            {
                Day1.PuzzleA(values);
                Day1.PuzzleB(values);
            }
            if (day == 2)
            {
                Day2.PuzzleA(values);
                Day2.PuzzleB(values);
            }
            if (day == 3)
            {
                Day3.PuzzleA(values);
                Day3.PuzzleB(values);
            }
            if (day == 4)
            {
                Day4.PuzzleA(response);
                Day4.PuzzleB(response);
            }
            if (day == 5)
            {
                Day5.PuzzleA(values);
                Day5.PuzzleB(values);
            }
            if (day == 6)
            {
                Day6.PuzzleA(response);
                Day6.PuzzleB(response);
            }
            if (day == 7)
            {
                Day7.PuzzleA(values);
                Day7.PuzzleB(values);
            }
            if (day == 8)
            {
                Day8.PuzzleA(values);
                Day8.PuzzleB(response);
            }
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            //var day1 = new Day1();
            //Debug.WriteLine(day1.SolvePuzzleP2());

            //Console.WriteLine(Day3.SolvePuzzleP1());
            //Console.WriteLine(Day3.SolvePuzzleP2());
            //Console.WriteLine(Day4.SolvePuzzleP1(new FileInfo(@".\Files\day4.txt")));
            //Console.WriteLine(Day4.SolvePuzzleP2(new FileInfo(@".\Files\day4.txt")));
            //Console.WriteLine(Day5.Test());
            //Console.WriteLine(Day5.SolvePuzzleP1(new FileInfo(@".\Files\day5.txt")));
            //Console.WriteLine(Day5.SolvePuzzleP2(new FileInfo(@".\Files\day5.txt")));
            //Console.WriteLine(Day6.SolvePuzzleP1(new FileInfo(@".\Files\day6.txt")));
            Console.WriteLine(Day6.SolvePuzzleP2(new FileInfo(@".\Files\day6.txt")));



            Console.ReadKey();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Console.WriteLine("Day1");
            Day1.Problem1();
            Day1.Problem2();

            Console.WriteLine("Day2");
            Day2.Problem1();
            Day2.Problem2();

            Console.WriteLine("Day3");
            Day3.Problem1();
            Day3.Problem2();

            Console.WriteLine("Day4");
            Day4.Problem1();
            Day4.Problem2();

            Console.WriteLine("Day5");
            Day5.Problem1();
            Day5.Problem2();

            Console.WriteLine("Day6");
            Day6.Problem1();
            Day6.Problem2();

            Console.WriteLine("Day 7");
            Day7.Problem1();
            Day7.Problem2();

            Console.WriteLine("Day 8");
            Day8.Problem1();
            Day8.Problem2();

            Console.WriteLine("Day 9");
            Day9.Problem1();
            Day9.Problem2();

            Console.WriteLine("Day 10");
            Day10.Problem1();
            Day10.Problem2();

            Console.WriteLine("Day 11");
            Day11.Problem1();
            Day11.Problem2();

            Console.WriteLine("Day 12");
            Day12.Problem1();
            Day12.Problem2();

            Console.WriteLine("Day 13");
            Day13.Problem1();
            Day13.Problem2();

            Console.WriteLine("Day 14");
            Day14.Problem1();
            Day14.Problem2();

            Console.WriteLine("Day 15");
            Day15.Problem1();
            //Day15.Problem2();

            Console.WriteLine("Day 16");
            Day16.Problem1();
            Day16.Problem2();
        }
Ejemplo n.º 8
0
 static string RunDay6()
 {
     return(Day6.Run(GetInput(6)).ToString());
 }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            //Christmas colors, of course
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.ForegroundColor = ConsoleColor.DarkRed;

            Console.WriteLine("Alex Herreid's solutions to the 2020 Advent of Code");
            Console.WriteLine("***********************");
            Console.WriteLine("Challenges received from https://adventofcode.com/2020/about");
            Console.WriteLine("***********************");
            Console.WriteLine("Challenge copyright original creator, solution copyright Alex Herreid");
            Console.WriteLine("***********************");
            Console.WriteLine("Based on the website description, the goal of the program is to practice coding and collect stars."
                              + " As they write: \"To save your vacation, you need to get all fifty stars by December 25th.\""
                              + " There are two puzzles per day, worth one star each. The full challenge text is not copied here, instead " +
                              "there is just a brief summary on the top of each day of what the code is supposed to do.");

            bool quit = false;

            while (!quit)
            {
                Console.WriteLine("***********************");
                Console.WriteLine();
                Console.WriteLine("Main Menu: (Q to quit)");
                Console.WriteLine("Type in the day number to go to that challenge/solution combo.");
                Console.Write("Day Number: ");
                string input = Console.ReadLine()?.ToUpper();
                if (input == "Q")
                {
                    quit = true;
                }
                else
                {
                    bool validDay = true;
                    if (int.TryParse(input, out int dayNum))
                    {
                        DayPuzzleType?dpt = null;
                        switch (dayNum)
                        {
                        case 1:
                            dpt = DayPuzzleSelector(dayNum);
                            switch (dpt)
                            {
                            case DayPuzzleType.Puzzle1:
                                Day1.Day1_Puzzle1();
                                break;

                            case DayPuzzleType.Puzzle2:
                                Day1.Day1_Puzzle2();
                                break;
                            }
                            break;

                        case 2:
                            dpt = DayPuzzleSelector(dayNum);
                            switch (dpt)
                            {
                            case DayPuzzleType.Puzzle1:
                                Day2.Day2_Puzzle1();
                                break;

                            case DayPuzzleType.Puzzle2:
                                Day2.Day2_Puzzle2();
                                break;
                            }
                            break;

                        case 3:
                            dpt = DayPuzzleSelector(dayNum);
                            switch (dpt)
                            {
                            case DayPuzzleType.Puzzle1:
                                Day3.Day3_Puzzle1();
                                break;

                            case DayPuzzleType.Puzzle2:
                                Day3.Day3_Puzzle2();
                                break;
                            }
                            break;

                        case 4:
                            dpt = DayPuzzleSelector(dayNum);
                            switch (dpt)
                            {
                            case DayPuzzleType.Puzzle1:
                                Day4.Day4_Puzzle1();
                                break;

                            case DayPuzzleType.Puzzle2:
                                Day4.Day4_Puzzle2();
                                break;
                            }
                            break;

                        case 5:
                            dpt = DayPuzzleSelector(dayNum);
                            switch (dpt)
                            {
                            case DayPuzzleType.Puzzle1:
                                Day5.Day5_Puzzle1();
                                break;

                            case DayPuzzleType.Puzzle2:
                                Day5.Day5_Puzzle2();
                                break;
                            }
                            break;

                        case 6:
                            dpt = DayPuzzleSelector(dayNum);
                            switch (dpt)
                            {
                            case DayPuzzleType.Puzzle1:
                                Day6.Day6_Puzzle1();
                                break;

                            case DayPuzzleType.Puzzle2:
                                Day6.Day6_Puzzle2();
                                break;
                            }
                            break;

                        default:
                            validDay = false;
                            break;
                        }
                    }
                    else
                    {
                        validDay = false;
                    }

                    if (!validDay)
                    {
                        Console.Clear();
                        Console.WriteLine("Invalid selection, please try again");
                        Console.WriteLine();
                    }
                }
            }
        }
Ejemplo n.º 10
0
        //IT WORKS AND I'M TOO LAZY TO ALTER WHAT LOOKED FINE WHEN IT WAS JUST 3 DAYS LONG
        private void Button1_Click(object sender, EventArgs e)
        {
            switch ((int)dayNumber.Value)
            {
            case 1:
                outputBox.Text = "\n- - - - DAY 1 - PART 1 - - - -\n\n" + Day1.PartOneOutput(inputBox.Text);
                break;

            case 2:
                outputBox.Text = "\n- - - - DAY 2 - PART 1 - - - -\n\n" + Day2.PartOneOutput(inputBox.Text);
                break;

            case 3:
                outputBox.Text = "\n- - - - DAY 3 - PART 1 - - - -\n\n" + Day3.PartOneOutput(inputBox.Text);
                break;

            case 4:
                outputBox.Text = "\n- - - - DAY 4 - PART 1 - - - -\n\n" + Day4.PartOneOutput(inputBox.Text);
                break;

            case 5:
                outputBox.Text = "\n- - - - DAY 5 - PART 1 - - - -\n\n" + Day5.PartOneOutput(inputBox.Text);
                break;

            case 6:
                outputBox.Text = "\n- - - - DAY 6 - PART 1 - - - -\n\n" + Day6.PartOneOutput(inputBox.Text);
                break;

            case 7:
                outputBox.Text = "\n- - - - DAY 7 - PART 1 - - - -\n\n" + Day7.PartOneOutput(inputBox.Text);
                break;

            case 8:
                outputBox.Text = "\n- - - - DAY 8 - PART 1 - - - -\n\n" + Day8.PartOneOutput(inputBox.Text);
                break;

            case 9:
                outputBox.Text = "\n- - - - DAY 9 - PART 1 - - - -\n\n" + Day9.PartOneOutput(inputBox.Text);
                break;

            case 10:
                outputBox.Text = "\n- - - - DAY 10 - PART 1 - - - -\n\n" + Day10.PartOneOutput(inputBox.Text);
                break;

            case 11:
                outputBox.Text = "\n- - - - DAY 11 - PART 1 - - - -\n\n" + Day11.PartOneOutput(inputBox.Text);
                break;

            case 12:
                outputBox.Text = "\n- - - - DAY 12 - PART 1 - - - -\n\n" + Day12.PartOneOutput(inputBox.Text);
                break;

            case 13:
                outputBox.Text = "\n- - - - DAY 13 - PART 1 - - - -\n\n" + Day13.PartOneOutput(inputBox.Text);
                break;

            case 14:
                outputBox.Text = "\n- - - - DAY 14 - PART 1 - - - -\n\n" + Day14.PartOneOutput(inputBox.Text);
                break;

            case 15:
                outputBox.Text = "\n- - - - DAY 15 - PART 1 - - - -\n\n" + Day15.PartOneOutput(inputBox.Text);
                break;

            case 16:
                outputBox.Text = "\n- - - - DAY 16 - PART 1 - - - -\n\n" + Day16.PartOneOutput(inputBox.Text);
                break;

            case 17:
                outputBox.Text = "\n- - - - DAY 17 - PART 1 - - - -\n\n" + Day17.PartOneOutput(inputBox.Text);
                break;

            case 18:
                outputBox.Text = "\n- - - - DAY 18 - PART 1 - - - -\n\n" + Day18.PartOneOutput(inputBox.Text);
                break;

            case 19:
                outputBox.Text = "\n- - - - DAY 19 - PART 1 - - - -\n\n" + Day19.PartOneOutput(inputBox.Text);
                break;

            case 20:
                outputBox.Text = "\n- - - - DAY 20 - PART 1 - - - -\n\n" + Day20.PartOneOutput(inputBox.Text);
                break;

            case 21:
                outputBox.Text = "\n- - - - DAY 21 - PART 1 - - - -\n\n" + Day21.PartOneOutput(inputBox.Text);
                break;

            case 22:
                outputBox.Text = "\n- - - - DAY 22 - PART 1 - - - -\n\n" + Day22.PartOneOutput(inputBox.Text);
                break;

            case 23:
                outputBox.Text = "\n- - - - DAY 23 - PART 1 - - - -\n\n" + Day23.PartOneOutput(inputBox.Text);
                break;

            case 24:
                outputBox.Text = "\n- - - - DAY 24 - PART 1 - - - -\n\n" + Day24.PartOneOutput(inputBox.Text);
                break;

            case 25:
                outputBox.Text = "\n- - - - DAY 25 - PART 1 - - - -\n\n" + Day25.PartOneOutput(inputBox.Text);
                break;

            default:
                break;
            }
        }