Exemplo n.º 1
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();
        }
Exemplo n.º 2
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();
                    }
                }
            }
        }
Exemplo n.º 3
0
 static string RunDay4()
 {
     return(Day4.Run(GetInput(4)).ToString());
 }
Exemplo n.º 4
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;
            }
        }