示例#1
0
        public void Day7Test()
        {
            var part1 = new Day7().Part1();
            var part2 = new Day7().Part2();

            Assert.AreEqual(89084, part2);
            Assert.AreEqual(185, part1);
        }
示例#2
0
文件: Program.cs 项目: Intershade/Git
        static void Main(string[] args)
        {
            Day1 day1 = new Day1();
            Day2 day2 = new Day2();
            Day3 day3 = new Day3();
            Day4 day4 = new Day4();
            Day5 day5 = new Day5();
            Day6 day6 = new Day6();
            Day7 day7 = new Day7();
            Day8 day8 = new Day8();

            //day1.Run();
            //day2.Run();
            //day3.Run();
            //day4.Run();
            //day5.Run();
            //day6.Run();
            day7.Run();
            //day8.Run();
        }
示例#3
0
        static void Main(string[] args)
        {
            List <Action> days = new List <Action> {
                () => Day1(),
                () => Day2(),
                () => Day3(),
                () => Day4(),
                () => Day5(),
                () => Day6.Run(),
                () => Day7.Run(),
                () => Day8(),
                () => Day9.Run(),
                () => Day10(),
                () => Day11.Run(),
                () => Day12.Run(),
                () => Day13.Run(),
                () => Day14.Run(),
                () => Day15.Run(),
                () => Day16(),
                () => Day17.Run(),
                () => Day18.Run(),
                () => Day19.Run(),
                () => Day20(),
                () => Day21.Run(),
                () => Day22.Run(),
                () => Day23.Run(),
                () => Day24.Run(),
                () => Day25.Run()
            };

            for (int i = 0; i < days.Count; i++)
            {
                Console.WriteLine("Day " + (i + 1) + ":");
                days[i].Invoke();
                Console.WriteLine();
            }
            Console.WriteLine("Färdig!");
            Console.ReadKey();
        }
示例#4
0
        static void Main(string[] args)
        {
            string UserSelection = "";
            bool   ContinueLoop  = true;

            do
            {
                // Ask for userinput to select problem 1-25
                // Select Test Input or Input
                Console.WriteLine("Please select a Day Number(1-25): ");
                UserSelection = Console.ReadLine();
                string PartSelection = "";
                string TestSelection = "";

                switch (UserSelection)
                {
                case "1":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day1.Part1(ReadFile("Input/Problem1.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day1.Part1(ReadFile("TestInput/Problem1.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day1.Part2(ReadFile("Input/Problem1.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day1.Part2(ReadFile("TestInput/Problem1.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "2":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day2.Part1(ReadFile("Input/Problem2.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day2.Part1(ReadFile("TestInput/Problem2.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day2.Part2(ReadFile("Input/Problem2.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day2.Part2(ReadFile("TestInput/Problem2.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "3":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day3.Part1(ReadFile("Input/Problem3.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day3.Part1(ReadFile("TestInput/Problem3.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day3.Part2(ReadFile("Input/Problem3.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day3.Part2(ReadFile("TestInput/Problem3.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "4":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day4.Part1(ReadFile("Input/Problem4.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day4.Part1(ReadFile("TestInput/Problem4.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day4.Part2(ReadFile("Input/Problem4.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day4.Part2(ReadFile("TestInput/Problem4.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "5":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day5.Part1(ReadFile("Input/Problem5.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day5.Part1(ReadFile("TestInput/Problem5.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day5.Part2(ReadFile("Input/Problem5.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day5.Part2(ReadFile("TestInput/Problem5.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "6":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day6.Part1(ReadFile("Input/Problem6.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day6.Part1(ReadFile("TestInput/Problem6.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day6.Part2(ReadFile("Input/Problem6.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day6.Part2(ReadFile("TestInput/Problem6.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "7":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day7.Part1(ReadFile("Input/Problem7.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day7.Part1(ReadFile("TestInput/Problem7.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day7.Part2(ReadFile("Input/Problem7.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day7.Part2(ReadFile("TestInput/Problem7.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "8":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day8.Part1(ReadFile("Input/Problem8.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day8.Part1(ReadFile("TestInput/Problem8.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day8.Part2(ReadFile("Input/Problem8.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day8.Part2(ReadFile("TestInput/Problem8.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "9":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day9.Part1(ReadFile("Input/Problem9.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day9.Part1(ReadFile("TestInput/Problem9.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day9.Part2(ReadFile("Input/Problem9.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day9.Part2(ReadFile("TestInput/Problem9.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "10":
                    Console.WriteLine("Please Select Part Number 1 or 2: ");
                    PartSelection = Console.ReadLine();
                    switch (PartSelection)
                    {
                    case "1":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day10.Part1(ReadFile("Input/Problem10.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day10.Part1(ReadFile("TestInput/Problem10.txt")));
                            break;
                        }
                        break;

                    case "2":
                        Console.WriteLine("Please Select Input or Test Input 1 or 2: ");
                        TestSelection = Console.ReadLine();
                        switch (TestSelection)
                        {
                        case "1":
                            Console.WriteLine(Day10.Part2(ReadFile("Input/Problem10.txt")));
                            break;

                        case "2":
                            Console.WriteLine(Day10.Part2(ReadFile("TestInput/Problem10.txt")));
                            break;
                        }
                        break;
                    }
                    break;

                case "X":
                case "x":
                    ContinueLoop = false;
                    break;

                default:
                    Console.WriteLine("Sorry please select a number between 1-25");
                    break;
                }
            }while(ContinueLoop == true);


            // Day 1


            // Day 2
            // Console.WriteLine(Day2.Part1(ReadFile("Input/Problem2.txt")));
            // Console.WriteLine(Day2.Part2(ReadFile("Input/Problem2.txt")));
            // Console.WriteLine(Day2.Part1(ReadFile("TestInput/Problem2.txt")));
            // Console.WriteLine(Day2.Part2(ReadFile("TestInput/Problem2.txt")));

            // Day 3
            // Console.WriteLine(Day3.Part1(ReadFile("Input/Problem3.txt")));
            // Console.WriteLine(Day3.Part2(ReadFile("Input/Problem3.txt")));
            // Console.WriteLine(Day3.Part1(ReadFile("TestInput/Problem3.txt")));
            // Console.WriteLine(Day3.Part2(ReadFile("TestInput/Problem3.txt")));

            // Day 4
            // Console.WriteLine(Day4.Part1(ReadFile("Input/Problem4.txt")));
            // Console.WriteLine(Day4.Part2(ReadFile("Input/Problem4.txt")));
            // Console.WriteLine(Day4.Part1(ReadFile("TestInput/Problem4.txt")));
            // Console.WriteLine(Day4.Part2(ReadFile("TestInput/Problem4.txt")));

            // Day 5
            // Console.WriteLine(Day5.Part1(ReadFile("Input/Problem5.txt")));
            // Console.WriteLine(Day5.Part2(ReadFile("Input/Problem5.txt")));
            // Console.WriteLine(Day5.Part1(ReadFile("TestInput/Problem5.txt")));
            // Console.WriteLine(Day5.Part2(ReadFile("TestInput/Problem5.txt")));

            // Day 6
            // Console.WriteLine(Day6.Part1(ReadFile("Input/Problem6.txt")));
            // Console.WriteLine(Day6.Part2(ReadFile("Input/Problem6.txt")));
            // Console.WriteLine(Day6.Part1(ReadFile("TestInput/Problem6.txt")));
            // Console.WriteLine(Day6.Part2(ReadFile("TestInput/Problem6.txt")));

            // Day 7
            // Console.WriteLine(Day7.Part1(ReadFile("Input/Problem7.txt")));
            // Console.WriteLine(Day7.Part2(ReadFile("Input/Problem7.txt")));
            // Console.WriteLine(Day7.Part1(ReadFile("TestInput/Problem7.txt")));
            // Console.WriteLine(Day7.Part2(ReadFile("TestInput/Problem7.txt")));

            // Day 8
            // Console.WriteLine(Day8.Part1(ReadFile("Input/Problem8.txt")));
            // Console.WriteLine(Day8.Part2(ReadFile("Input/Problem8.txt")));
            // Console.WriteLine(Day8.Part1(ReadFile("TestInput/Problem8.txt")));
            // Console.WriteLine(Day8.Part2(ReadFile("TestInput/Problem8.txt")));

            // Day 9
            // Console.WriteLine(Day9.Part1(ReadFile("Input/Problem9.txt")));
            // Console.WriteLine(Day9.Part2(ReadFile("Input/Problem9.txt")));
            // Console.WriteLine(Day9.Part1(ReadFile("TestInput/Problem9.txt")));
            // Console.WriteLine(Day9.Part2(ReadFile("TestInput/Problem9.txt")));

            // Day 10
            // Console.WriteLine(Day10.Part1(ReadFile("Input/Problem10.txt")));
            // Console.WriteLine(Day10.Part2(ReadFile("Input/Problem10.txt")));
            // Console.WriteLine(Day10.Part1(ReadFile("TestInput/Problem10.txt")));
            // Console.WriteLine(Day10.Part2(ReadFile("TestInput/Problem10.txt")));
        }
示例#5
0
        public static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Hello World!");
            }
            else
            {
                switch (args[0])
                {
                case "p1":
                    Day1.FirstPuzzle(args.Skip(1).Select(int.Parse).ToArray());
                    break;

                case "p2":
                    Day1.SecondPuzzle(args.Skip(1).Select(int.Parse).ToArray());
                    break;

                case "p3":
                    Day2.ThirdPuzzle(args[1]);
                    break;

                case "p4":
                    Day2.FourthPuzzle(args[1]);
                    break;

                case "p5":
                    Day3.FifthPuzzle(args[1], args[2]);
                    break;

                case "p6":
                    Day3.SixthPuzzle(args[1], args[2]);
                    break;

                case "p7":
                    Day4.SeventhPuzzle(args[1]);
                    break;

                case "p8":
                    Day4.EigthPuzzle(args[1]);
                    break;

                case "p9":
                    Day5.NinthPuzzle(args[1]);
                    break;

                case "p10":
                    Day5.TenthPuzzle(args[1]);
                    break;

                case "p11":
                    Day6.EleventhPuzzle(args.Skip(1).ToArray());
                    break;

                case "p12":
                    Day6.TwelthPuzzle(args.Skip(1).ToArray());
                    break;

                case "p13":
                    Day7.ThirteenthPuzzle(args[1]);
                    break;

                case "p14":
                    Day7.FourteenthPuzzle(args[1]);
                    break;

                case "p15":
                    Day8.FifteenthPuzzle(args[1]);
                    break;

                case "p16":
                    Day8.SixteenthPuzzle(args[1]);
                    break;

                case "p17":
                case "p18":
                    Day9.SeventeenthPuzzle(args[1]);
                    break;

                case "p19":
                    Day10.NineteenthPuzzle(args.Skip(1).ToArray());
                    break;

                case "p20":
                    Day10.TwentiethPuzzle(args.Skip(1).ToArray());
                    break;

                case "p21":
                    Day11.TwentyfirstPuzzle(args[1]);
                    break;

                case "p22":
                    Day11.TwentysecondPuzzle(args[1]);
                    break;

                case "p23":
                    Day12.TwentythirdPuzzle();
                    break;

                case "p24":
                    Day12.TwentyfourthPuzzle();
                    break;

                case "p25":
                    Day13.TwentyfifthPuzzle(args[1]);
                    break;

                case "p26":
                    Day13.TwentysixthPuzzle(args[1]);
                    break;

                case "p27":
                    Day14.TwentyseventhPuzzle();
                    break;

                case "p28":
                    Day14.TwentyeighthPuzzle();
                    break;

                default:
                    Console.WriteLine("Hello World!");
                    break;
                }
            }
        }
示例#6
0
        static void PrintSolution(int day)
        {
            switch (day)
            {
            case 1:
                Console.WriteLine("\nSolving Day 1....");
                Console.WriteLine($"Solution to part 1: {Day1.SolvePart1()}\n");
                Console.WriteLine($"Solution to part 2: {Day1.SolvePart2()}\n");
                break;

            case 2:
                Console.WriteLine("\nSolving Day 2....");
                Console.WriteLine($"Solution to part 1: {Day2.Solve(1)}\n");
                Console.WriteLine($"Solution to part 2: {Day2.Solve(2)}\n");
                break;

            case 3:
                Console.WriteLine("\nSolving Day 3....");
                Console.WriteLine($"Solution to part 1: {Day3.SolvePart1()}\n");
                Console.WriteLine($"Solution to part 2: {Day3.SolvePart2()}\n");
                break;

            case 4:
                Console.WriteLine("\nSolving Day 4....");

                var day4 = new Day4();
                Console.WriteLine($"Solution to part 1: {day4.Solve(1)}\n");

                day4.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day4.Solve(2)}\n");
                break;

            case 5:
                Console.WriteLine("\nSolving Day 5....");

                var day5 = new Day5();
                Console.WriteLine($"Solution to part 1: {day5.Solve()}\n");

                day5.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day5.SolvePart2()}\n");
                break;

            case 6:
                Console.WriteLine("\nSolving Day 6....");

                var day6 = new Day6();
                Console.WriteLine($"Solution to part 1: {day6.Solve()}\n");

                day6.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day6.SolvePart2()}\n");
                break;

            case 7:
                Console.WriteLine("\nSolving Day 7....");

                var day7 = new Day7();
                Console.WriteLine($"Solution to part 1: {day7.Solve()}\n");

                day7.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day7.SolvePart2()}\n");
                break;

            case 99:
                Console.WriteLine("\nDoing custom fun stuff....");

                var quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"make it so\" in all of TNG: {quiz.FindInTng("make it so")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"earl grey\" in all of TNG: {quiz.FindInTng("earl grey")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"earl grey hot\" in all of TNG: {quiz.FindInTng("earl grey hot")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"tea earl grey hot\" in all of TNG: {quiz.FindInTng("tea earl grey hot")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"shut up\" in all of TNG: {quiz.FindInTng("shut up")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"shut up wesley\" in all of TNG: {quiz.FindInTng("shut up wesley")}");

                break;

            default:
                break;
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            Console.WriteLine();
            Console.WriteLine("Welcome to Advent of Code 2017! Please pass in which Day you would like to evaluate as a command line argument!");
            Console.WriteLine();

            int dayChallenge = Int32.Parse(args[0]);

            if (dayChallenge < 1 || dayChallenge > 25)
            {
                Console.WriteLine("Please pass in a valid day challenge between 1 and 25 :(");
                Console.WriteLine();
                return;
            }

            switch (dayChallenge)
            {
            case 1:
                Day1.TestDay1("181445682966897848665963472661939865313976877194312684993521259486517527961396717561854825453963181134379574918373213732184697746668399631642622373684425326112585283946462323363991753895647177797691214784149215198715986947573668987188746878678399624533792551651335979847131975965677957755571358934665327487287312467771187981424785514785421781781976477326712674311994735947987383516699897916595433228294198759715959469578766739518475118771755787196238772345762941477359483456641194685333528329581113788599843621326313592354167846466415943566183192946217689936174884493199368681514958669615226362538622898367728662941275658917124167353496334664239539753835439929664552886538885727235662548783529353611441231681613535447417941911479391558481443933134283852879511395429489152435996669232681215627723723565872291296878528334773391626672491878762288953597499218397146685679387438634857358552943964839321464529237533868734473777756775687759355878519113426969197211824325893376812556798483325994128743242544899625215765851923959798197562831313891371735973761384464685316273343541852758525318144681364492173465174512856618292785483181956548813344752352933634979165667651165776587656468598791994573513652324764687515345959621493346623821965554755615219855842969932269414839446887613738174567989512857785566352285988991946436148652839391593178736624957214917527759574235133666461988355855613377789115472297915429318142824465141688559333787512328799783539285826471818279818457674417354335454395644435889386297695625378256613558911695145397779576526397241795181294322797687168326696497256684943829666672341162656479563522892141714998477865114944671225898297338685958644728534192317628618817551492975251364233974374724968483637518876583946828819994321129556511537619253381981544394112184655586964655164192552352534626295996968762388827294873362719636616182786976922445125551927969267591395292198155775434997827738862786341543524544822321112131815475829945625787561369956264826651461575948462782869972654343749617939132353399334744265286151177931594514857563664329299713436914721119746932159456287267887878779218815883191236858656959258484139254446341");
                break;

            case 2:
                Day2.TestDay2();
                break;

            case 3:
                Day3.TestDay3(265149);
                break;

            case 4:
                Day4.TestDay4();
                break;

            case 5:
                Day5.TestDay5();
                break;

            case 6:
                Day6.TestDay6();
                break;

            case 7:
                Day7.TestDay7();
                break;

            case 8:
                Day8.TestDay8();
                break;

            case 9:
                Day9.TestDay9();
                break;

            case 10:
                Day10.TestDay10();
                break;

            case 11:
                Day11.TestDay11();
                break;

            case 12:
                Day12.TestDay12();
                break;

            case 13:
                Day13.TestDay13();
                break;

            case 14:
                Day14.TestDay14();
                break;

            case 15:
                Day15.TestDay15();
                break;

            case 16:
                Day16.TestDay16();
                break;

            case 17:
                Day17.TestDay17();
                break;

            case 18:
                Day18.TestDay18();
                break;

            case 19:
                Day19.TestDay19();
                break;

            case 20:
                Day20.TestDay20();
                break;

            case 21:
                Day21.TestDay21();
                break;

            case 22:
                Day22.TestDay22();
                break;

            case 23:
                Day23.TestDay23();
                break;

            case 24:
                Day24.TestDay24();
                break;

            case 25:
                Day25.TestDay25();
                break;

            default:
                break;
            }

            return;
        }
        public static void SafeSolve(string input)
        {
            try
            {
                if (ValidateInput(input))
                {
                    Console.WriteLine($"Solving day {SafeGetDay(input)}, part {SafeGetPart(input)}");
                    switch (input)
                    {
                    case "1.1":
                        Day1.Solve("Data/D1P1.txt");
                        break;

                    case "1.2":
                        Day1.Solve("Data/D1P1.txt", true);
                        break;

                    case "2.1":
                        Day2.Solve("Data/D2P1.txt");
                        break;

                    case "2.2":
                        Day2.Solve("Data/D2P1.txt", true);
                        break;

                    case "3.1":
                        Day3.Solve("Data/D3P1.txt", true);
                        break;

                    case "4.1":
                        Day4.Solve("Data/D4P1.txt");
                        break;

                    case "4.2":
                        Day4.Solve("Data/D4P1.txt", true);
                        break;

                    case "5.1":
                        Day5.Solve("Data/D5P1.txt");
                        break;

                    case "5.2":
                        Day5.Solve("Data/D5P1.txt", true);
                        break;

                    case "7.1":
                        Day7.Solve("Data/D7P1.txt");
                        break;

                    case "7.2":
                        Day7.Solve("Data/D7P1.txt", true);
                        break;

                    default:
                        Console.WriteLine("No puzzle found for specified date. Try again.");
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"We done goofed on day {SafeGetDay(input)}. " + e.Message);
            }
        }
        public static void Solve(int day, int problemPart)
        {
            var puzzleInput = _loadFileInput(day);
            var solution    = 0;

            switch (day)
            {
            case 1:
                solution = Day1.Solve(puzzleInput, problemPart);
                break;

            case 2:
                solution = Day2.Solve(puzzleInput, problemPart);
                break;

            case 3:
                solution = Day3.Solve(puzzleInput);
                break;

            case 4:
                solution = Day4.Solve(puzzleInput);
                break;

            case 5:
                solution = Day5.Solve(puzzleInput);
                break;

            case 6:
                solution = Day6.Solve(puzzleInput);
                break;

            case 7:
                solution = Day7.Solve(puzzleInput);
                break;

            case 8:
                solution = Day8.Solve(puzzleInput);
                break;

            case 9:
                throw new NotImplementedException();
                break;

            case 10:
                throw new NotImplementedException();
                break;

            case 11:
                throw new NotImplementedException();
                break;

            case 12:
                throw new NotImplementedException();
                break;

            case 13:
                throw new NotImplementedException();
                break;

            case 14:
                throw new NotImplementedException();
                break;

            case 15:
                throw new NotImplementedException();
                break;

            case 16:
                throw new NotImplementedException();
                break;

            case 17:
                throw new NotImplementedException();
                break;

            case 18:
                throw new NotImplementedException();
                break;

            case 19:
                throw new NotImplementedException();
                break;

            case 20:
                throw new NotImplementedException();
                break;

            case 21:
                throw new NotImplementedException();
                break;

            case 22:
                throw new NotImplementedException();
                break;

            case 23:
                throw new NotImplementedException();
                break;

            case 24:
                throw new NotImplementedException();
                break;

            case 25:
                throw new NotImplementedException();
                break;

            default:
                Console.WriteLine("ERROR: Inavlid day");
                break;
            }

            Console.WriteLine($"Puzzle Solution: {solution}");
        }
示例#10
0
        static void Main(string[] args)
        {
            bool repeat = true;

            Console.WriteLine("ADVENT OF CODE 2016");
            Console.WriteLine("#######GODJUL#######");

            while (repeat)
            {
                Console.Write("Select day(1-25, 0 to exit): ");
                string day = Console.ReadLine();
                Console.WriteLine();

                switch (day)
                {
                case "1":
                    Day1 day1 = new Day1();
                    day1.Run();
                    break;

                case "2":
                    Day2 day2 = new Day2();
                    day2.Run();
                    break;

                case "3":
                    Day3 day3 = new Day3();
                    day3.Run();
                    break;

                case "4":
                    Day4 day4 = new Day4();
                    day4.Run();
                    break;

                case "5":
                    Day5 day5 = new Day5();
                    day5.Run();
                    break;

                case "6":
                    Day6 day6 = new Day6();
                    day6.Run();
                    break;

                case "7":
                    Day7 day7 = new Day7();
                    day7.Run();
                    break;

                case "0":
                    repeat = false;
                    break;

                default:
                    break;
                }
                Console.WriteLine();
            }

            Console.WriteLine("hej då");
            Console.ReadKey();
        }
示例#11
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Need to specify day number (1-25)");
            }
            else
            {
                Console.WriteLine($"Day {args[0]}");
                if (args[0] == "1")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day1.Problem1("1122"));
                    Console.WriteLine(Day1.Problem1("1111"));
                    Console.WriteLine(Day1.Problem1("1234"));
                    Console.WriteLine(Day1.Problem1("57276274387944537823652626177853384411146325384494935924454336611953119173638191671326254832624841593421667683474349154668177743437745965461678636631863541462893547616877914914662358836365421198516263335926544716331814125295712581158399321372683742773423626286669759415959391374744214595682795818615532673877868424196926497731144319736445141728123322962547288572434564178492753681842244888368542423832228211172842456231275738182764232265933625119312598161192193214898949267765417468348935134618964683127194391796165368145548814473129857697989322621368744725685183346825333247866734735894493395218781464346951777873929898961358796274889826894529599645442657423438562423853247543621565468819799931598754753467593832328147439341586125262733737128386961596394728159719292787597426898945198788211417854662948358422729471312456437778978749753927251431677533575752312447488337156956217451965643454445329758327129966657189332824969141448538681979632611199385896965946849725421978137753366252459914913637858783146735469758716752765718189175583956476935185985918536318424248425426398158278111751711911227818826766177996223718837428972784328925743869885232266127727865267881592395643836999244218345184474613129823933659422223685422732186536199153988717455568523781673393698356967355875123554797755491181791593156433735591529495984256519631187849654633243225118132152549712643273819314433877592644693826861523243946998615722951182474773173215527598949553185313259992227879964482121769617218685394776778423378182462422788277997523913176326468957342296368178321958626168785578977414537368686438348124283789748775163821457641135163495649331144436157836647912852483177542224864952271874645274572426458614384917923623627532487625396914111582754953944965462576624728896917137599778828769958626788685374749661741223741834844643725486925886933118382649581481351844943368484853956759877215252766294896496444835264357169642341291412768946589781812493421379575569593678354241223363739129813633236996588711791919421574583924743119867622229659211793468744163297478952475933163259769578345894367855534294493613767564497137369969315192443795512585"));
                    Console.WriteLine();

                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day1.Problem2("1212"));
                    Console.WriteLine(Day1.Problem2("1221"));
                    Console.WriteLine(Day1.Problem2("123425"));
                    Console.WriteLine(Day1.Problem2("123123"));
                    Console.WriteLine(Day1.Problem2("12131415"));
                    Console.WriteLine(Day1.Problem2("57276274387944537823652626177853384411146325384494935924454336611953119173638191671326254832624841593421667683474349154668177743437745965461678636631863541462893547616877914914662358836365421198516263335926544716331814125295712581158399321372683742773423626286669759415959391374744214595682795818615532673877868424196926497731144319736445141728123322962547288572434564178492753681842244888368542423832228211172842456231275738182764232265933625119312598161192193214898949267765417468348935134618964683127194391796165368145548814473129857697989322621368744725685183346825333247866734735894493395218781464346951777873929898961358796274889826894529599645442657423438562423853247543621565468819799931598754753467593832328147439341586125262733737128386961596394728159719292787597426898945198788211417854662948358422729471312456437778978749753927251431677533575752312447488337156956217451965643454445329758327129966657189332824969141448538681979632611199385896965946849725421978137753366252459914913637858783146735469758716752765718189175583956476935185985918536318424248425426398158278111751711911227818826766177996223718837428972784328925743869885232266127727865267881592395643836999244218345184474613129823933659422223685422732186536199153988717455568523781673393698356967355875123554797755491181791593156433735591529495984256519631187849654633243225118132152549712643273819314433877592644693826861523243946998615722951182474773173215527598949553185313259992227879964482121769617218685394776778423378182462422788277997523913176326468957342296368178321958626168785578977414537368686438348124283789748775163821457641135163495649331144436157836647912852483177542224864952271874645274572426458614384917923623627532487625396914111582754953944965462576624728896917137599778828769958626788685374749661741223741834844643725486925886933118382649581481351844943368484853956759877215252766294896496444835264357169642341291412768946589781812493421379575569593678354241223363739129813633236996588711791919421574583924743119867622229659211793468744163297478952475933163259769578345894367855534294493613767564497137369969315192443795512585"));
                }
                else if (args[0] == "2")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day2.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day2.Problem2());
                }
                else if (args[0] == "3")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day3.Problem1(12));
                    Console.WriteLine(Day3.Problem1(23));
                    Console.WriteLine(Day3.Problem1(1024));
                    Console.WriteLine(Day3.Problem1(325489));
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day3.Problem2(325489));
                }
                else if (args[0] == "4")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day4.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day4.Problem2());
                }
                else if (args[0] == "5")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day5.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day5.Problem2());
                }
                else if (args[0] == "6")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day6.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day6.Problem2());
                }
                else if (args[0] == "7")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day7.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day7.Problem2());
                }
                else if (args[0] == "8")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day8.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day8.Problem2());
                }
                else if (args[0] == "9")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day9.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day9.Problem2());
                }
                else if (args[0] == "10")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day10.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day10.Problem2());
                }
                else if (args[0] == "11")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day11.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day11.Problem2());
                }
                else if (args[0] == "12")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day12.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day12.Problem2());
                }
                else if (args[0] == "13")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day13.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day13.Problem2());
                }
                else if (args[0] == "14")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day14.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day14.Problem2());
                }
                else if (args[0] == "15")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day15.Problem1(516, 190));
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day15.Problem2(516, 190));
                }
                else if (args[0] == "16")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day16.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day16.Problem2());
                }
                else if (args[0] == "17")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day17.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day17.Problem2());
                }
                else if (args[0] == "18")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day18.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day18.Problem2());
                }
                else if (args[0] == "19")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day19.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day19.Problem2());
                }
                else if (args[0] == "20")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day20.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day20.Problem2());
                }
                else if (args[0] == "21")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day21.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day21.Problem2());
                }
                else if (args[0] == "22")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day22.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day22.Problem2());
                }
                else if (args[0] == "23")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day23.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day23.Problem2());
                }
                else if (args[0] == "24")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day24.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day24.Problem2());
                }
                else if (args[0] == "25")
                {
                    Console.WriteLine("Problem 1");
                    Console.WriteLine(Day25.Problem1());
                    Console.WriteLine("Problem 2");
                    Console.WriteLine(Day25.Problem2());
                }
            }
        }