static void Main() { Day today = new Day20(); Console.WriteLine(today.GetType().ToString()); Console.WriteLine("---------------------"); Console.WriteLine(); Stopwatch sw = new Stopwatch(); sw.Start(); Console.Write("Part 1: "); Console.WriteLine(today.Part1()); Console.WriteLine(); Console.Write("Part 2: "); Console.WriteLine(today.Part2()); sw.Stop(); Console.WriteLine("\nTime (ms): " + sw.ElapsedMilliseconds); }
public static void TestAll() { try { Console.WriteLine("Running tests for 2018"); Verifier.Verify(435, Day01.Part1(), "day 1 part 1"); Verifier.Verify(245, Day01.Part2(), "day 1 part 2"); Verifier.Verify(6448, Day02.Part1(), "day 2 part 1"); Verifier.Verify(0, Day02.Part2(), "day 2 part 1"); Verifier.Verify(0, Day03.Part1(), "day 3 part 1"); Verifier.Verify(0, Day03.Part2(), "day 3 part 2"); Verifier.Verify(0, Day04.Part1(), "day 4 part 1"); Verifier.Verify(0, Day04.Part2(), "day 4 part 2"); Verifier.Verify(0, Day05.Part1(), "day 5 part 1"); Verifier.Verify(0, Day05.Part2(), "day 5 part 2"); Verifier.Verify(0, Day06.Part1(), "day 6 part 1"); Verifier.Verify(0, Day06.Part2(), "day 6 part 2"); Verifier.Verify(0, Day07.Part1(), "day 7 part 1"); Verifier.Verify(0, Day07.Part2(), "day 7 part 2"); Verifier.Verify(0, Day08.Part1(), "day 8 part 1"); Verifier.Verify(0, Day08.Part2(), "day 8 part 2"); Verifier.Verify(0, Day09.Part1(), "day 9 part 1"); Verifier.Verify(0, Day09.Part2(), "day 9 part 2"); Verifier.Verify(0, Day10.Part1(), "day 10 part 1"); Verifier.Verify(0, Day10.Part2(), "day 10 part 2"); Verifier.Verify(0, Day11.Part1(), "day 11 part 1"); Verifier.Verify(0, Day11.Part2(), "day 11 part 2"); Verifier.Verify(0, Day12.Part1(), "day 12 part 1"); Verifier.Verify(0, Day12.Part2(), "day 12 part 2"); Verifier.Verify(0, Day13.Part1(), "day 13 part 1"); Verifier.Verify(0, Day13.Part2(), "day 13 part 2"); Verifier.Verify(0, Day14.Part1(), "day 14 part 1"); Verifier.Verify(0, Day14.Part2(), "day 14 part 2"); Verifier.Verify(0, Day15.Part1(), "day 15 part 1"); Verifier.Verify(0, Day15.Part2(), "day 15 part 2"); Verifier.Verify(0, Day16.Part1(), "day 16 part 1"); Verifier.Verify(0, Day16.Part2(), "day 16 part 2"); Verifier.Verify(0, Day17.Part1(), "day 17 part 1"); Verifier.Verify(0, Day17.Part2(), "day 17 part 2"); Verifier.Verify(0, Day18.Part1(), "day 18 part 1"); Verifier.Verify(0, Day18.Part2(), "day 18 part 2"); Verifier.Verify(0, Day19.Part1(), "day 19 part 1"); Verifier.Verify(0, Day19.Part2(), "day 19 part 2"); Verifier.Verify(0, Day20.Part1(), "day 20 part 1"); Verifier.Verify(0, Day20.Part2(), "day 20 part 2"); Verifier.Verify(0, Day21.Part1(), "day 21 part 1"); Verifier.Verify(0, Day21.Part2(), "day 21 part 2"); Verifier.Verify(0, Day22.Part1(), "day 22 part 1"); Verifier.Verify(0, Day22.Part2(), "day 22 part 2"); Verifier.Verify(0, Day23.Part1(), "day 23 part 1"); Verifier.Verify(0, Day23.Part2(), "day 23 part 2"); Verifier.Verify(0, Day24.Part1(), "day 24 part 1"); Verifier.Verify(0, Day24.Part2(), "day 24 part 2"); Verifier.Verify(0, Day25.Part1(), "day 25 part 1"); Console.WriteLine("All tests for 2018 OK"); } catch (Exception e) { Console.WriteLine(e.Message); } }
public static void TestAll() { try { Console.WriteLine("Running tests for 2020"); Verifier.Verify(55776, Day01.Part1(0), "day 1 part 1"); Verifier.Verify(223162626, Day01.Part2(0), "day 1 part 2"); Verifier.Verify(622, Day02.Part1(0), "day 2 part 1"); Verifier.Verify(263, Day02.Part2(0), "day 2 part 1"); Verifier.Verify(159, Day03.Part1(0), "day 3 part 1"); Verifier.Verify(6419669520, Day03.Part2(0), "day 3 part 2"); Verifier.Verify(210, Day04.Part1(0), "day 4 part 1"); Verifier.Verify(131, Day04.Part2(0), "day 4 part 2"); Verifier.Verify(894, Day05.Part1(0), "day 5 part 1"); Verifier.Verify(579, Day05.Part2(0), "day 5 part 2"); Verifier.Verify(6530, Day06.Part1(0), "day 6 part 1"); Verifier.Verify(3323, Day06.Part2(0), "day 6 part 2"); Verifier.Verify(192, Day07.Part1(0), "day 7 part 1"); Verifier.Verify(12128, Day07.Part2(0), "day 7 part 2"); Verifier.Verify(1671, Day08.Part1(0), "day 8 part 1"); Verifier.Verify(892, Day08.Part2(0), "day 8 part 2"); Verifier.Verify(70639851, Day09.Part1(0), "day 9 part 1"); Verifier.Verify(8249240, Day09.Part2(0), "day 9 part 2"); Verifier.Verify(2450, Day10.Part1(0), "day 10 part 1"); Verifier.Verify(32396521357312, Day10.Part2(0), "day 10 part 2"); Verifier.Verify(2273, Day11.Part1(0), "day 11 part 1"); Verifier.Verify(2064, Day11.Part2(0), "day 11 part 2"); Verifier.Verify(1710, Day12.Part1(0), "day 12 part 1"); Verifier.Verify(62045, Day12.Part2(0), "day 12 part 2"); Verifier.Verify(119, Day13.Part1(), "day 13 part 1"); Verifier.Verify(1106724616194525, Day13.Part2(), "day 13 part 2"); Verifier.Verify(5875750429995, Day14.Part1(0), "day 14 part 1"); Verifier.Verify(5272149590143, Day14.Part2(0), "day 14 part 2"); Verifier.Verify(959, Day15.Part1(0), "day 15 part 1"); Verifier.Verify(116590, Day15.Part2(0), "day 15 part 2"); Verifier.Verify(25972, Day16.Part1(0), "day 16 part 1"); Verifier.Verify(622670335901, Day16.Part2(0), "day 16 part 2"); Verifier.Verify(353, Day17.Part1(0), "day 17 part 1"); Verifier.Verify(2472, Day17.Part2(0), "day 17 part 2"); Verifier.Verify(11076907812171, Day18.Part1(), "day 18 part 1"); Verifier.Verify(283729053022731, Day18.Part2(), "day 18 part 2"); Verifier.Verify(149, Day19.Part1(), "day 19 part 1"); Verifier.Verify(332, Day19.Part2(), "day 19 part 2"); Verifier.Verify(83775126454273, Day20.Part1(), "day 20 part 1"); Verifier.Verify(1993, Day20.Part2(), "day 20 part 2"); Verifier.Verify(2659, Day21.Part1(), "day 21 part 1"); Verifier.Verify("rcqb,cltx,nrl,qjvvcvz,tsqpn,xhnk,tfqsb,zqzmzl", Day21.Part2(), "day 21 part 2"); Verifier.Verify(31781, Day22.Part1(), "day 22 part 1"); Verifier.Verify(35154, Day22.Part2(), "day 22 part 2"); Verifier.Verify(75893264, Day23.Part1(), "day 23 part 1"); Verifier.Verify(38162588308, Day23.Part2(), "day 23 part 2"); Verifier.Verify(228, Day24.Part1(), "day 24 part 1"); Verifier.Verify(3672, Day24.Part2(), "day 24 part 2"); Verifier.Verify(181800, Day25.Part1(), "day 25 part 1"); Console.WriteLine("All tests for 2020 OK"); } catch (Exception e) { Console.WriteLine(e.Message); } }
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 TestAll() { try { Console.WriteLine("Running tests for 2021"); Verifier.Verify(1529, Day01.Part1(), "day 1 part 1"); Verifier.Verify(1567, Day01.Part2(), "day 1 part 2"); Verifier.Verify(1813801, Day02.Part1(), "day 2 part 1"); Verifier.Verify(1960569556, Day02.Part2(), "day 2 part 1"); Verifier.Verify(2724524, Day03.Part1(), "day 3 part 1"); Verifier.Verify(2775870, Day03.Part2(), "day 3 part 2"); Verifier.Verify(44736, Day04.Part1(), "day 4 part 1"); Verifier.Verify(1827, Day04.Part2(), "day 4 part 2"); Verifier.Verify(4728, Day05.Part1(), "day 5 part 1"); Verifier.Verify(17717, Day05.Part2(), "day 5 part 2"); Verifier.Verify(375482, Day06.Part1(), "day 6 part 1"); Verifier.Verify(1689540415957, Day06.Part2(), "day 6 part 2"); Verifier.Verify(356922, Day07.Part1(), "day 7 part 1"); Verifier.Verify(100347031, Day07.Part2(), "day 7 part 2"); Verifier.Verify(488, Day08.Part1(), "day 8 part 1"); Verifier.Verify(1040429, Day08.Part2(), "day 8 part 2"); Verifier.Verify(496, Day09.Part1(), "day 9 part 1"); Verifier.Verify(902880, Day09.Part2(), "day 9 part 2"); Verifier.Verify(294195, Day10.Part1(), "day 10 part 1"); Verifier.Verify(3490802734, Day10.Part2(), "day 10 part 2"); Verifier.Verify(1725, Day11.Part1(), "day 11 part 1"); Verifier.Verify(308, Day11.Part2(), "day 11 part 2"); Verifier.Verify(4338, Day12.Part1(), "day 12 part 1"); Verifier.Verify(114189, Day12.Part2(), "day 12 part 2"); Verifier.Verify(0, Day13.Part1(), "day 13 part 1"); Verifier.Verify(0, Day13.Part2(), "day 13 part 2"); Verifier.Verify(0, Day14.Part1(), "day 14 part 1"); Verifier.Verify(0, Day14.Part2(), "day 14 part 2"); Verifier.Verify(0, Day15.Part1(), "day 15 part 1"); Verifier.Verify(0, Day15.Part2(), "day 15 part 2"); Verifier.Verify(0, Day16.Part1(), "day 16 part 1"); Verifier.Verify(0, Day16.Part2(), "day 16 part 2"); Verifier.Verify(0, Day17.Part1(), "day 17 part 1"); Verifier.Verify(0, Day17.Part2(), "day 17 part 2"); Verifier.Verify(0, Day18.Part1(), "day 18 part 1"); Verifier.Verify(0, Day18.Part2(), "day 18 part 2"); Verifier.Verify(0, Day19.Part1(), "day 19 part 1"); Verifier.Verify(0, Day19.Part2(), "day 19 part 2"); Verifier.Verify(0, Day20.Part1(), "day 20 part 1"); Verifier.Verify(0, Day20.Part2(), "day 20 part 2"); Verifier.Verify(0, Day21.Part1(), "day 21 part 1"); Verifier.Verify(0, Day21.Part2(), "day 21 part 2"); Verifier.Verify(0, Day22.Part1(), "day 22 part 1"); Verifier.Verify(0, Day22.Part2(), "day 22 part 2"); Verifier.Verify(0, Day23.Part1(), "day 23 part 1"); Verifier.Verify(0, Day23.Part2(), "day 23 part 2"); Verifier.Verify(0, Day24.Part1(), "day 24 part 1"); Verifier.Verify(0, Day24.Part2(), "day 24 part 2"); Verifier.Verify(0, Day25.Part1(), "day 25 part 1"); Console.WriteLine("All tests for 2021 OK"); } catch (Exception e) { Console.WriteLine(e.Message); } }
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()); } } }