Example #1
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 #2
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();
            }
        }
Example #3
0
        internal static void Main(string[] args)
        {
            try
            {
                var sw = new Stopwatch();

                sw.Start();

                Day1.Solve1Half("818275977931166178424892653779931342156567268946849597948944469863818248114327524824136924486891794739281668741616818614613222585132742386168687517939432911753846817997473555693821316918473474459788714917665794336753628836231159578734813485687247273288926216976992516314415836985611354682821892793983922755395577592859959966574329787693934242233159947846757279523939217844194346599494858459582798326799512571365294673978955928416955127211624234143497546729348687844317864243859238665326784414349618985832259224761857371389133635711819476969854584123589566163491796442167815899539788237118339218699137497532932492226948892362554937381497389469981346971998271644362944839883953967698665427314592438958181697639594631142991156327257413186621923369632466918836951277519421695264986942261781256412377711245825379412978876134267384793694756732246799739464721215446477972737883445615664755923441441781128933369585655925615257548499628878242122434979197969569971961379367756499884537433839217835728263798431874654317137955175565253555735968376115749641527957935691487965161211853476747758982854811367422656321836839326818976668191525884763294465366151349347633968321457954152621175837754723675485348339261288195865348545793575843874731785852718281311481217515834822185477982342271937155479432673815629144664144538221768992733498856934255518875381672342521819499939835919827166318715849161715775427981485233467222586764392783699273452228728667175488552924399518855743923659815483988899924199449721321589476864161778841352853573584489497263216627369841455165476954483715112127465311353411346132671561568444626828453687183385215975319858714144975174516356117245993696521941589168394574287785233685284294357548156487538175462176268162852746996633977948755296869616778577327951858348313582783675149343562362974553976147259225311183729415381527435926224781181987111454447371894645359797229493458443522549386769845742557644349554641538488252581267341635761715674381775778868374988451463624332123361576518411234438681171864923916896987836734129295354684962897616358722633724198278552339794629939574841672355699222747886785616814449297817352118452284785694551841431869545321438468118");
                Day1.Solve2Half("818275977931166178424892653779931342156567268946849597948944469863818248114327524824136924486891794739281668741616818614613222585132742386168687517939432911753846817997473555693821316918473474459788714917665794336753628836231159578734813485687247273288926216976992516314415836985611354682821892793983922755395577592859959966574329787693934242233159947846757279523939217844194346599494858459582798326799512571365294673978955928416955127211624234143497546729348687844317864243859238665326784414349618985832259224761857371389133635711819476969854584123589566163491796442167815899539788237118339218699137497532932492226948892362554937381497389469981346971998271644362944839883953967698665427314592438958181697639594631142991156327257413186621923369632466918836951277519421695264986942261781256412377711245825379412978876134267384793694756732246799739464721215446477972737883445615664755923441441781128933369585655925615257548499628878242122434979197969569971961379367756499884537433839217835728263798431874654317137955175565253555735968376115749641527957935691487965161211853476747758982854811367422656321836839326818976668191525884763294465366151349347633968321457954152621175837754723675485348339261288195865348545793575843874731785852718281311481217515834822185477982342271937155479432673815629144664144538221768992733498856934255518875381672342521819499939835919827166318715849161715775427981485233467222586764392783699273452228728667175488552924399518855743923659815483988899924199449721321589476864161778841352853573584489497263216627369841455165476954483715112127465311353411346132671561568444626828453687183385215975319858714144975174516356117245993696521941589168394574287785233685284294357548156487538175462176268162852746996633977948755296869616778577327951858348313582783675149343562362974553976147259225311183729415381527435926224781181987111454447371894645359797229493458443522549386769845742557644349554641538488252581267341635761715674381775778868374988451463624332123361576518411234438681171864923916896987836734129295354684962897616358722633724198278552339794629939574841672355699222747886785616814449297817352118452284785694551841431869545321438468118");

                Day2.Solve1Half("../../data/d2_h1_test.txt");
                Day2.Solve1Half("../../data/d2_h1.txt");
                Day2.Solve2Half("../../data/d2_h2_test.txt");
                Day2.Solve2Half("../../data/d2_h2.txt");

                Day3.Solve1Half(312051);
                Day3.Solve2Half(312051);

                Day4.Solve1Half("../../data/d4_h1_test.txt");
                Day4.Solve1Half("../../data/d4_h1.txt");
                Day4.Solve2Half("../../data/d4_h2_test.txt");
                Day4.Solve2Half("../../data/d4_h2.txt");

                Day5.Solve1Half("../../data/d5_h1_test.txt");
                Day5.Solve1Half("../../data/d5_h1.txt");
                Day5.Solve2Half("../../data/d5_h2_test.txt");
                Day5.Solve2Half("../../data/d5_h2.txt");

                Day6.Solve1Half(new int[] { 0, 2, 7, 0 });
                Day6.Solve1Half(new int[] { 0, 5, 10, 0, 11, 14, 13, 4, 11, 8, 8, 7, 1, 4, 12, 11 });
                Day6.Solve2Half(new int[] { 0, 2, 7, 0 });
                Day6.Solve2Half(new int[] { 0, 5, 10, 0, 11, 14, 13, 4, 11, 8, 8, 7, 1, 4, 12, 11 });

                Day7.Solve1Half("../../data/d7_h1_test.txt");
                Day7.Solve1Half("../../data/d7_h1.txt");
                Day7.Solve2Half("../../data/d7_h2_test.txt");
                Day7.Solve2Half("../../data/d7_h2.txt");

                Day8.Solve1Half("../../data/d8_h1_test.txt");
                Day8.Solve1Half("../../data/d8_h1.txt");
                Day8.Solve2Half("../../data/d8_h2_test.txt");
                Day8.Solve2Half("../../data/d8_h2.txt");

                Day9.Solve1Half("../../data/d9_test.txt");
                Day9.Solve1Half("../../data/d9.txt");
                Day9.Solve2Half("../../data/d9_test.txt");
                Day9.Solve2Half("../../data/d9.txt");

                Day10.Solve1Half(5, "3,4,1,5");
                Day10.Solve1Half(256, "97,167,54,178,2,11,209,174,119,248,254,0,255,1,64,190");
                Day10.Solve2Half(256, "1,2,3");
                Day10.Solve2Half(256, "AoC 2017");
                Day10.Solve2Half(256, "97,167,54,178,2,11,209,174,119,248,254,0,255,1,64,190");

                Day11.Solve1Half("../../data/d11.txt");
                Day11.Solve2Half("../../data/d11.txt");

                Day12.Solve1Half("../../data/d12.txt");
                Day12.Solve2Half("../../data/d12.txt");

                Day13.Solve1Half("../../data/d13_test.txt");
                Day13.Solve1Half("../../data/d13.txt");
                Day13.Solve2Half("../../data/d13_test.txt");
                Day13.Solve2Half("../../data/d13.txt");

                Day14.Solve1Half("flqrgnkx");
                Day14.Solve1Half("ljoxqyyw");
                Day14.Solve2Half("flqrgnkx");
                Day14.Solve2Half("ljoxqyyw");

                Day15.Solve1Half(65, 8921);
                Day15.Solve1Half(883, 879);
                Day15.Solve2Half(65, 8921);
                Day15.Solve2Half(883, 879);

                Day16.Solve1Half(16, "../../data/d16.txt");
                Day16.Solve2Half(16, "../../data/d16.txt");

                Day17.Solve1Half(3, 2017);
                Day17.Solve1Half(369, 2017);
                Day17.Solve2Half(369, 50000000);

                Day18.Solve1Half("../../data/d18_test.txt");
                Day18.Solve1Half("../../data/d18.txt");
                Day18.Solve2Half("../../data/d18_h2_test.txt");
                Day18.Solve2Half("../../data/d18.txt");

                Day19.Solve1Half("../../data/d19.txt");
                Day19.Solve2Half("../../data/d19.txt");

                Day20.Solve1Half("../../data/d20.txt");
                Day20.Solve2Half("../../data/d20.txt");

                Day21.Solve1Half(2, "../../data/d21_test.txt");
                Day21.Solve1Half(5, "../../data/d21.txt");
                Day21.Solve2Half(18, "../../data/d21.txt");

                Day22.Solve1Half("../../data/d22_test.txt");
                Day22.Solve1Half("../../data/d22.txt");
                Day22.Solve2Half("../../data/d22_test.txt");
                Day22.Solve2Half("../../data/d22.txt");

                Day23.Solve1Half("../../data/d23.txt");
                Day23.Solve2Half("../../data/d23.txt");

                Day24.Solve1Half("../../data/d24.txt");
                Day24.Solve2Half("../../data/d24.txt");

                Day25.Solve1Half("../../data/d25.txt");
                Day25.Solve2Half("../../data/d25.txt");

                sw.Stop();

                Console.WriteLine($"Total run time {sw.ElapsedMilliseconds}");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void bt_click(object sender, RoutedEventArgs e)
        {
            string input  = input_tb.Text;
            string output = "";

            switch ((sender as Button).Name)
            {
            case "d1p1":
                output = new Day1().SolveP1(input);
                break;

            case "d1p2":
                output = new Day1().SolveP2(input);
                break;

            case "d2p1":
                output = new Day2().SolveP1(input);
                break;

            case "d2p2":
                output = new Day2().SolveP2(input);
                break;

            case "d3p1":
                output = new Day3().SolveP1(input);
                break;

            case "d3p2":
                output = new Day3().SolveP2(input);
                break;

            case "d4p1":
                output = new Day4().SolveP1(input);
                break;

            case "d4p2":
                output = new Day4().SolveP2(input);
                break;

            case "d5p1":
                output = new Day5().SolveP1(input);
                break;

            case "d5p2":
                output = new Day5().SolveP2(input);
                break;

            case "d6p1":
                output = new Day6().SolveP1(input);
                break;

            case "d6p2":
                output = new Day6().SolveP2(input);
                break;

            case "d7p1":
                output = new Day7().SolveP1(input);
                break;

            case "d7p2":
                output = new Day7().SolveP2(input);
                break;

            case "d8p1":
                output = new Day8().SolveP1(input);
                break;

            case "d8p2":
                output = new Day8().SolveP2(input);
                break;

            case "d9p1":
                output = new Day9().SolveP1(input);
                break;

            case "d9p2":
                output = new Day9().SolveP2(input);
                break;

            case "d10p1":
                output = new Day10().SolveP1(input);
                break;

            case "d10p2":
                output = new Day10().SolveP2(input);
                break;

            case "d11p1":
                output = new Day11().SolveP1(input);
                break;

            case "d11p2":
                output = new Day11().SolveP2(input);
                break;

            case "d12p1":
                output = new Day12().SolveP1(input);
                break;

            case "d12p2":
                output = new Day12().SolveP2(input);
                break;

            case "d13p1":
                output = new Day13().SolveP1(input);
                break;

            case "d13p2":
                output = new Day13().SolveP2(input);
                break;

            case "d14p1":
                output = new Day14().SolveP1(input);
                break;

            case "d14p2":
                output = new Day14().SolveP2(input);
                break;

            case "d15p1":
                output = new Day15().SolveP1(input);
                break;

            case "d15p2":
                output = new Day15().SolveP2(input);
                break;

            case "d16p1":
                output = new Day16().SolveP1(input);
                break;

            case "d16p2":
                output = new Day16().SolveP2(input);
                break;

            case "d17p1":
                output = new Day17().SolveP1(input);
                break;

            case "d17p2":
                output = new Day17().SolveP2(input);
                break;

            case "d18p1":
                output = new Day18().SolveP1(input);
                break;

            case "d18p2":
                output = new Day18().SolveP2(input);
                break;

            case "d19p1":
                output = new Day19().SolveP1(input);
                break;

            case "d19p2":
                output = new Day19().SolveP2(input);
                break;

            case "d20p1":
                output = new Day20().SolveP1(input);
                break;

            case "d20p2":
                output = new Day20().SolveP2(input);
                break;

            case "d21p1":
                output = new Day21().SolveP1(input);
                break;

            case "d21p2":
                output = new Day21().SolveP2(input);
                break;

            case "d22p1":
                output = new Day22().SolveP1(input);
                break;

            case "d22p2":
                output = new Day22().SolveP2(input);
                break;

            case "d23p1":
                output = new Day23().SolveP1(input);
                break;

            case "d23p2":
                output = new Day23().SolveP2(input);
                break;

            case "d24p1":
                output = new Day24().SolveP1(input);
                break;

            case "d24p2":
                output = new Day24().SolveP2(input);
                break;
            }

            output_tb.Text = output;
        }