public void Test3_123425_yields_4() { Day1.Part2("123425").Should().Be(4); }
public void Test1_1212_yields_6() { Day1.Part2("1212").Should().Be(6); }
public void Test2_1221_yields_0() { Day1.Part2("1221").Should().Be(0); }
public void Test4_91212129_yields_9() { Day1.Part1("91212129").Should().Be(9); }
public void Day1_part1_solution() { var result = Day1.Part1("21752342814933766938172121674976879111362417653261522357855816893656462449168377359285244818489723869987861247912289729579296691684761143544956991583942215236568961875851755854977946147178746464675227699149925227227137557479769948569788884399379821111382536722699575759474473273939756348992714667963596189765734743169489599125771443348193383566159843593541134749392569865481578359825844394454173219857919349341442148282229689541561169341622222354651397342928678496478671339383923769856425795211323673389723181967933933832711545885653952861879231537976292517866354812943192728263269524735698423336673735158993853556148833861327959262254756647827739145283577793481526768156921138428318939361859721778556264519643435871835744859243167227889562738712953651128317624673985213525897522378259178625416722152155728615936587369515254936828668564857283226439881266871945998796488472249182538883354186573925183152663862683995449671663285775397453876262722567452435914777363522817594741946638986571793655889466419895996924122915777224499481496837343194149123735355268151941712871245863553836953349887831949788869852929147849489265325843934669999391846286319268686789372513976522282587526866148166337215961493536262851512218794139272361292811529888161198799297966893366553115353639298256788819385272471187213579185523521341651117947676785341146235441411441813242514813227821843819424619974979886871646621918865274574538951761567855845681272364646138584716333599843835167373525248547542442942583122624534494442516259616973235858469131159773167334953658673271599748942956981954699444528689628848694446818825465485122869742839711471129862632128635779658365756362863627135983617613332849756371986376967117549251566281992964573929655589313871976556784849231916513831538254812347116253949818633527185174221565279775766742262687713114114344843534958833372634182176866315441583887177759222598853735114191874277711434653854816841589229914164681364497429324463193669337827467661773833517841763711156376147664749175267212562321567728575765844893232718971471289841171642868948852136818661741238178676857381583155547755219837116125995361896562498721571413742"); result.Should().Be(1119); }
public void Test2_1111_yields_4() { Day1.Part1("1111").Should().Be(4); }
public void Test3_1234_yields_0() { Day1.Part1("1234").Should().Be(0); }
public void Test4_12131415_yields_4() { Day1.Part2("12131415").Should().Be(4); }
public void Test1_1122_yields_3() { Day1.Part1("1122").Should().Be(3); }
public void Test4_123123_yields_12() { Day1.Part2("123123").Should().Be(12); }
static void Main(string[] args) { var d1 = new Day1(); Console.WriteLine($"Day 1\n-----\nAnswer 1: {d1.Answer1}\nAnswer 2: {d1.Answer2}"); }
static void Main(string[] args) { Console.Title = "AoC - 2017"; path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string introduction = File.ReadAllText(path + "/Resources/introduction.txt"); string[] input; Start: Console.Clear(); Console.Write(introduction); AwaitInput: try { input = Console.ReadLine().Split('.'); } catch { goto Start; } switch (input[0].ToUpper()) { case "1": Day1.Run(new string[] { input[1] }); goto AwaitInput; case "2": Day2.Run(new string[] { input[1] }); goto AwaitInput; case "3": Day3.Run(new string[] { input[1] }); goto AwaitInput; case "4": Day4.Run(new string[] { input[1] }); goto AwaitInput; case "5": Day5.Run(new string[] { input[1] }); goto AwaitInput; case "6": Day6.Run(new string[] { input[1] }); goto AwaitInput; case "7": Day7.Run(new string[] { input[1] }); goto AwaitInput; case "8": Day8.Run(new string[] { input[1] }); goto AwaitInput; case "9": Day9.Run(new string[] { input[1] }); goto AwaitInput; case "10": Day10.Run(new string[] { input[1] }); goto AwaitInput; case "11": Day11.Run(new string[] { input[1] }); goto AwaitInput; case "12": Day12.Run(new string[] { input[1] }); goto AwaitInput; case "13": Day13.Run(new string[] { input[1] }); goto AwaitInput; case "END": goto End; default: goto Start; } End: Console.Write(""); }
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; }