diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..63781da --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "input"] + path = input + url = https://github.com/deckelmouck/adventofcode-input diff --git a/2019/Day01/201901_1.txt b/2019/Day01/201901_1.txt deleted file mode 100644 index cbe635d..0000000 --- a/2019/Day01/201901_1.txt +++ /dev/null @@ -1,100 +0,0 @@ -89122 -141123 -91549 -66506 -53504 -56517 -77050 -92298 -84853 -141828 -86739 -126125 -82793 -113761 -68961 -132576 -61718 -64498 -110415 -134867 -102449 -107364 -88491 -120584 -52192 -130494 -121583 -132166 -111339 -68715 -104966 -117227 -58921 -83909 -70626 -141637 -95127 -72029 -136121 -136915 -74312 -54863 -53547 -149493 -78528 -132289 -148754 -133905 -135357 -58483 -62214 -124684 -118590 -107087 -95768 -86835 -122277 -126183 -108546 -75212 -62280 -76039 -135743 -86133 -111613 -139477 -65930 -106225 -101531 -96501 -66844 -114158 -137091 -138143 -102083 -69857 -59372 -137605 -108135 -96365 -94851 -104414 -74194 -74188 -131888 -75910 -78279 -93285 -53597 -82705 -119360 -149274 -92510 -95490 -54087 -97695 -94753 -80493 -101173 -51906 diff --git a/2019/Day01/Solution.cs b/2019/Day01/Solution.cs new file mode 100644 index 0000000..500012a --- /dev/null +++ b/2019/Day01/Solution.cs @@ -0,0 +1,72 @@ +using System; + +namespace adventofcode.Year2019.Day01; + +public class Solution : BaseSolution, ISolver +{ + public void SolvePart1() + { + string line; + //int counter = 0; + int neededfuel = 0; + // string filepath = Environment.CurrentDirectory + @"\2019\Day01\201901_1.txt"; + //string filepath = Path.Combine(Environment.CurrentDirectory, "2019", "Day01", "201901_1.txt"); + //string filepath = Path.Combine(Environment.CurrentDirectory, GetYear(), $"Day{GetDay()}", "input.txt"); + string filepath = GetInputFilePath("201901_1.txt"); + + Console.WriteLine(filepath); + + if(System.IO.File.Exists(filepath)) + { + System.IO.StreamReader file = new System.IO.StreamReader(filepath); + + while((line = file.ReadLine()) != null) + { + int mass = Convert.ToInt32(line); + int fuel = mass / 3 - 2; + + neededfuel = neededfuel + fuel; + //Console.WriteLine(line); + //counter++; + } + //Console.WriteLine("{0} lines read.", counter.ToString()); + Console.WriteLine("we need {0} fuel.", neededfuel); + } + } + + public void SolvePart2() + { + string line; + //int counter = 0; + int neededfuel = 0; + //string filepath = Environment.CurrentDirectory + @"\2019\Day01\201901_1.txt"; + string filepath = System.IO.Path.Combine(Environment.CurrentDirectory, "2019", "Day01", "201901_1.txt"); + + Console.WriteLine(filepath); + + if(System.IO.File.Exists(filepath)) + { + System.IO.StreamReader file = new System.IO.StreamReader(filepath); + + while((line = file.ReadLine()) != null) + { + int mass = Convert.ToInt32(line); + int fuel = mass / 3 - 2; + int fueltotal = fuel; + + while(fuel / 3 - 2 > 0) + { + fuel = fuel / 3 - 2; + fueltotal = fueltotal + fuel; + } + + neededfuel = neededfuel + fueltotal; + + //Console.WriteLine(line); + //counter++; + } + //Console.WriteLine("{0} lines read.", counter.ToString()); + Console.WriteLine("we need {0} fuel.", neededfuel); + } + } +} diff --git a/2019/Day02/201902_1.txt b/2019/Day02/201902_1.txt deleted file mode 100644 index 835f660..0000000 --- a/2019/Day02/201902_1.txt +++ /dev/null @@ -1 +0,0 @@ -1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,13,1,19,1,19,10,23,2,10,23,27,1,27,6,31,1,13,31,35,1,13,35,39,1,39,10,43,2,43,13,47,1,47,9,51,2,51,13,55,1,5,55,59,2,59,9,63,1,13,63,67,2,13,67,71,1,71,5,75,2,75,13,79,1,79,6,83,1,83,5,87,2,87,6,91,1,5,91,95,1,95,13,99,2,99,6,103,1,5,103,107,1,107,9,111,2,6,111,115,1,5,115,119,1,119,2,123,1,6,123,0,99,2,14,0,0 diff --git a/2019/Day03/201903_1.txt b/2019/Day03/201903_1.txt deleted file mode 100644 index c2e5e1d..0000000 --- a/2019/Day03/201903_1.txt +++ /dev/null @@ -1,2 +0,0 @@ -R998,U494,L814,D519,R407,U983,R307,D745,R64,D29,L935,D919,L272,D473,R689,U560,L942,U264,R816,U745,R209,U227,R241,U111,L653,D108,R823,U254,L263,U987,L368,D76,R665,D646,L759,U425,L581,D826,R829,D388,L234,U33,L48,U598,L708,D764,L414,D75,L163,U802,L183,U893,L486,U947,L393,D694,L454,D600,R377,U312,R89,D178,L652,D751,R402,D946,R213,U985,R994,D336,R573,D105,L442,U965,R603,U508,L17,U191,L37,U678,L506,U823,R878,D709,L348,U167,L355,U314,L164,D672,L309,U895,R358,D769,R869,U598,R63,D68,R105,U133,R357,U588,L154,D631,L939,D235,R506,D885,R958,D896,L195,U292,L952,D616,L824,D497,R99,D121,R387,D155,L70,U580,L890,D368,L910,U645,L786,U977,R9,U781,L454,U783,L382,U321,L195,U196,L239,U764,R18,D71,R97,U77,L803,U963,L704,U94,L511,U747,L798,D905,L679,D135,R455,U650,R947,U14,L722,D245,L490,D183,L276,U559,L901,D767,R827,U522,L380,U494,R402,U70,R589,D582,R206,U756,L989,U427,L704,D864,R885,D9,R872,U454,R912,U752,R197,U304,L728,U879,R456,D410,L141,U473,R246,U498,R443,D297,R333,D123,R12,D665,R684,D531,R601,D13,L260,U60,R302,D514,R416,D496,L562,D334,L608,U74,R451,U251,R961,U166,L368,U146,R962,U973,R120,U808,R480,D536,L690,D958,R292,U333,R656,U305,R46,U831,L756,D907,L638,D969,L445,U541,R784,U148,R338,D264,R72,D637,R759,D709,L611,D34,R99,U305,R143,D191,R673,D753,R387,U994,R720,D896,R95,U703,L499,D453,R96,U808,L485,U127,L856,U357,L543,U382,R411,U969,L532,U64,R303,U457,L412,D140,R146,D67,R147,D681,L1,D994,L876,D504,R46,U683,L992,U640,L663,D681,L327,U840,R543,U97,R988,U792,R36 -L999,U148,L592,D613,L147,D782,R594,U86,R891,D448,R92,U756,R93,D763,L536,U906,L960,D988,L532,U66,R597,U120,L273,D32,R525,U628,L630,U89,L248,U594,R886,D544,L288,U380,L23,D191,L842,U394,L818,U593,L195,U183,L863,D456,L891,D653,R618,U314,L775,D220,R952,U960,R714,U946,L343,D873,L449,U840,R769,U356,L20,D610,L506,U733,R524,D450,L888,D634,R737,U171,R906,U369,L172,D625,L97,D437,R359,D636,R775,U749,L281,U188,R418,D437,R708,D316,L388,D717,R59,U73,R304,U148,L823,U137,R265,U59,R488,D564,R980,U798,L626,U47,L763,U858,L450,U663,R378,U93,L275,U472,L792,U544,R192,D979,L520,U835,L946,D615,L120,U923,L23,U292,R396,U605,L76,U813,L388,U500,L848,U509,L276,D538,R26,D806,R685,D319,R414,D989,L519,U603,R898,D477,L107,D828,R836,U432,L601,U888,L476,D974,L911,U122,L921,D401,L878,D962,L214,D913,L113,U418,R992,U844,L928,U534,L13,U457,L866,D208,L303,D732,L497,U673,R659,D639,R430,D301,L573,U373,L270,D901,L605,D935,R440,D183,R374,D883,L551,U771,R707,D141,R984,U346,R894,U1,R33,U492,R371,D631,R95,D62,L378,D343,R108,D611,L267,D871,L296,U391,R302,D424,R160,U141,R682,U949,R380,U251,L277,D404,R392,D210,L158,U896,R350,D891,L837,D980,R288,U597,L292,D639,L943,D827,L492,D625,L153,D570,R948,D855,L945,U840,L493,U800,L392,D438,R8,U966,R218,U597,R852,D291,L840,D831,L498,U846,R875,D244,R159,U243,R975,D246,R549,D304,R954,D123,R58,U5,L621,U767,R455,U550,R800,D417,R869,D184,L966,D51,L383,U132,L664,U220,L263,D307,R716,U346,L958,U84,L154,U90,L726,U628,L159,U791,L643,D652,L138,U577,R457,U655,L547,D441,L21 diff --git a/2019/Day04/201904_1.txt b/2019/Day04/201904_1.txt deleted file mode 100644 index 02f2ae5..0000000 --- a/2019/Day04/201904_1.txt +++ /dev/null @@ -1 +0,0 @@ -236491-713787 \ No newline at end of file diff --git a/2021/Day01/input.txt b/2021/Day01/input.txt deleted file mode 100644 index e69de29..0000000 diff --git a/2022/Day01/input b/2022/Day01/input deleted file mode 100644 index 89622fa..0000000 --- a/2022/Day01/input +++ /dev/null @@ -1,2262 +0,0 @@ -5916 -7281 -1715 -3853 -10283 -1455 -7807 -6117 - -33711 -6672 - -3988 -6947 -1674 -1928 -6128 -6361 -3817 -6141 -3301 -5473 -2609 -4262 -6105 - -2725 -7430 -7415 -6997 -4542 -2703 -7148 -2710 -5660 -7372 -2539 -7162 - -5377 -4274 -2793 -2911 -2113 -1077 -4115 -5871 -1079 -4336 -4894 -2088 -5408 -5535 -1982 - -3270 -1347 -4884 -2986 -6067 -5567 -5093 -4421 -2772 -4935 -6153 -1235 -3824 -6460 - -4131 -5183 -5329 -8021 -6096 -6053 -4352 -2016 -5055 -3031 -3379 - -1846 -3964 -16169 -10061 -16400 - -1519 -5378 -6590 -6782 -7072 -4011 -6581 -5871 -6112 -6836 - -3894 -5621 -6342 -6746 -1955 -3348 -5651 -1468 -7232 -3240 -3435 -4566 - -8079 -4170 -5034 - -7439 -1078 -4537 -7020 -2013 -2796 -1627 -1171 -3472 -2611 -3701 -1570 - -2874 -13468 -4739 -16126 -11847 - -37266 -25445 - -9722 -12162 -9507 -5369 - -10547 -5064 -10328 -7331 -2829 -7218 -2094 -8963 - -9828 -4878 -1582 -3494 -8656 - -4271 -8332 -1579 -6029 -13927 -5572 - -6709 -5200 -2009 -7145 -3739 -4750 -7173 -6257 -2520 -4878 -3730 -5773 - -3367 -11772 -4282 -9184 -6947 -2471 - -1112 -1186 -2178 -5993 -2098 -5243 -5223 -1709 -2290 -6327 - -8571 -4827 -4630 -2496 -6101 -10967 -9712 - -5730 -2663 -6857 -3517 -7938 -5069 -1825 -6498 -2716 -6798 -6394 - -2154 -5746 -3630 -4056 -6257 -6249 -4872 -1769 -8320 -1294 - -1469 -6784 -6869 -3459 -6487 -1003 -7296 -8054 -3027 -8338 - -1156 -5197 -6307 -3935 -4874 -2021 -2001 -2077 -3755 -4507 -4116 -1742 -1341 - -2602 -6117 -1059 -4689 -4430 -1216 -4126 -4810 -6270 -2819 -6013 -1589 -4496 -5670 - -5739 -8341 -9572 -6860 -5805 -6627 -3291 -5664 -1907 - -5359 -26291 - -2503 -8306 -6709 -4770 -7460 -5028 -6586 -1286 -4120 -4381 - -1049 -17368 - -5170 -1955 -6256 -2513 -2666 -2571 -1274 -4515 -2359 -5327 -6325 -1141 -5883 - -9948 -18400 -10491 -16743 - -1531 -2231 -3614 -6706 -3516 -5629 -1745 -2780 -2899 -2916 -3928 -4085 - -10012 -12228 -15603 -4551 -3922 - -12264 -13387 -6562 -6050 -12784 -11921 - -34920 -20549 - -4990 -5935 -4252 -4079 -1354 -9274 -3232 -1527 -5978 - -65379 - -1216 -5983 -12805 -6875 -2671 -2381 - -4320 -5687 -6760 -2023 -4263 -1892 -2926 - -3192 -10623 -10169 -12098 -1307 -11324 -2156 - -3749 -2564 -3627 -4701 -5104 -1052 -5035 -3742 -5456 -2150 -2042 -4326 -3053 -5006 -5142 - -5984 - -13641 -30009 - -13225 -5744 -8472 -8526 -5427 - -4593 -6409 -7212 -6755 - -4285 -8123 -6604 -1812 -4145 -9072 -7456 -9813 - -8572 -3737 -9989 -17372 - -3522 -11158 -11713 -1160 -10425 -9709 -7731 - -6503 -3369 -3225 -3899 - -31458 -29242 - -27980 -17901 - -3361 -2869 -1654 -5350 -6317 -8273 -6526 -2723 - -5186 -31304 - -12989 -11754 -11012 -5487 -3127 - -1627 -3229 -2818 -6410 -10184 -6946 -3349 -2976 - -4656 -4290 -3066 -5230 -3503 -1444 -3154 -3748 -2392 -2435 -2211 -2093 -3835 -2402 -1698 - -1311 -6276 - -3748 -4996 -6338 -8906 -11219 -1797 -6467 - -4241 -3011 -6574 -3945 -5947 -6398 -1505 -4799 -5325 -5559 -1735 - -13793 -9236 -9335 - -1031 -7087 -1933 -14085 -12694 - -2019 -2371 - -6900 -6067 -5355 -7415 -3735 -3616 -5010 -4661 -7376 -3971 -2233 -6296 - -7738 -2032 -2170 -6164 -6861 -2420 -5351 -2794 -9647 - -5785 -1391 -2213 -12440 - -2136 -1308 -3209 -3353 -3791 -5916 -5124 -1003 -2489 -5370 -3041 -4007 -2782 -2946 -5378 - -5848 -8012 -5443 -3056 -2550 -8199 -9613 -6809 -2623 - -16460 -1618 - -12239 - -3005 -1728 -7292 -7379 -3241 -5232 -8567 -5880 -4743 -8582 - -9983 -5730 -2346 -7669 -3723 -3102 -10038 -3634 - -5996 -7330 -1061 -5321 -3113 -3533 -6219 -4449 -1353 -5978 -1035 - -2951 -2249 -6361 -1322 -3363 -4667 -4494 -6531 -1530 -2968 -2552 -2249 -5052 - -4376 -13988 - -5472 -3797 -8451 -5091 -5804 -9664 -9061 -1726 -7215 - -2922 -4700 -6062 -5747 -4578 -2098 -1192 -1245 -4752 -1098 -1591 -4644 -5028 - -25366 - -5026 -1139 -6338 -1321 -5559 -3270 -6123 -2535 -1758 -1290 -4424 -3760 -3754 -5044 - -5414 -3035 -5760 -3894 -6727 -2297 -3800 -3285 -3127 -4110 -5435 -1321 - -1363 -5566 -3084 -6064 -1968 -2954 -5078 -5649 -5761 -1265 -5368 -2584 -1814 -4855 -4670 - -4580 -3174 -1343 -4299 -2930 -2209 -4883 -4404 -2899 -4431 -2433 -3444 -2183 -3816 - -2301 -3278 -6603 -5907 -6658 -3429 -3206 -5091 -4527 -3467 -4731 -2694 - -14883 -3132 -16229 -13353 - -4339 -4088 -4244 -1947 -2691 -6081 -1013 -3078 -1197 - -4565 -5429 -19061 -7019 - -5028 -1657 -5177 -1768 -3641 -3897 -3675 -1885 -1966 -1724 -6106 -5721 -5394 -1562 -3637 - -5590 -5469 -4382 -5375 -1656 -3496 -1553 -4737 -5521 -2951 -5633 -6099 -2365 - -3451 -6892 -4327 -6207 -6468 -1638 -6676 -3366 -6793 - -7999 -3815 -2828 -7726 -4747 -6494 -3227 -5024 -7550 - -10475 -24156 -1946 - -61232 - -3562 -11518 -5489 -13618 -8886 -4331 - -5068 -6620 -1899 -1742 -4183 -4792 -3300 -1636 -3644 -1716 -2247 - -21547 -25323 -17987 - -10463 -11220 -7134 -10719 -1274 -11774 - -22985 -19754 - -16499 -24689 - -2529 -4751 -2572 -4097 -6163 -5281 -3617 -3757 -3927 -3603 -3093 -6143 -4730 -3650 - -6393 -1523 -5956 -6591 -2063 -6414 -6834 -6649 -3808 -1286 -4953 -5087 -2796 - -3296 -2685 -5141 -3415 -7132 -4397 -4098 -6860 -5815 -4552 -2464 - -15557 - -1863 -1041 -4563 -1798 -3402 -1270 -3457 -1379 -5354 -2330 -6010 -3812 -2823 -6076 -4226 - -2619 -3202 -3298 -5199 -5356 -2239 -1567 -2088 -3106 -1639 -7116 -6917 - -1569 -7017 -4686 -8636 -8174 -1685 -5343 -4403 -1187 -3285 - -2886 -5763 -1469 -11516 -10773 -2282 -11137 - -10923 -8429 -11772 -8319 -4256 -6490 -2616 - -3491 -28517 - -15778 -16609 -25152 - -4645 -5384 -6744 -4612 -4405 -5450 -3678 -3894 -2232 -7232 -2377 -7056 - -4331 -2122 -4624 -1423 -6583 -5137 -1426 -1919 -2101 -4315 -4855 -6865 -1114 - -7694 -8630 -6754 -5894 -7170 -8178 -8646 -6369 -6162 -5627 - -8027 -1885 -6581 -2173 -3920 -7931 -1907 -6362 -6774 -5027 - -3841 -8648 -5530 -2754 -13794 -8974 - -1363 -5452 -6499 -5721 -2430 -2766 -6536 -1606 -5189 -1008 -6126 -2875 -5931 - -7517 -8727 -3495 -7647 -10130 -8585 -1435 - -3909 -6342 -5378 -11006 -6483 -6426 -4300 - -7358 -4616 -9891 -2965 -11555 -13437 - -6332 -3010 -7403 -1795 -7359 -5017 -6471 -2495 -2589 -7223 - -5359 -10446 -12714 -1727 -8024 - -11690 -3529 -6145 -8147 -15083 - -5461 -4939 -1905 -3342 -3385 -3920 -5609 -3524 -5645 -6882 -4355 -2263 -3464 - -67422 - -2437 -6392 -1206 -1253 -3402 -4722 -2867 -6304 -3139 -2120 -4953 -5095 -3647 - -16783 - -9717 -25377 -17887 - -6852 -8926 -10395 -2107 -8228 -7462 -5239 -10085 - -22658 -18276 -12253 - -3488 -4976 -4196 -3427 -4603 -1579 -6785 -6656 -5143 -1109 -5507 - -14794 -28617 - -2296 -2367 -1865 -9975 -1988 -3950 -7755 -3008 - -8090 -8620 -11016 -11153 -5513 -2683 -4080 - -10557 -2744 -11379 -8339 -1908 -3088 - -8659 -9142 -1838 -10380 -7386 -4599 -9768 -3718 - -2941 -9112 -6492 -2847 -1562 -8956 - -7867 -4589 -9354 -3953 -7557 -2528 -8845 -8845 -1468 - -7065 -10043 -7109 -4063 -2987 - -11800 -5009 -5108 -4783 -12570 - -61504 - -5512 -1432 -6118 -6389 -2752 -5032 -1688 -5662 -6690 -4760 -6248 -3515 -6122 - -4127 -1192 -3521 -4583 -3060 -5306 -2783 -1949 -3633 -5486 -4799 -2056 -2800 -5770 - -19956 -11717 -16021 -3566 - -2387 -4083 -5811 -3849 -3496 -2213 -4107 -4588 -1995 -1228 -5055 -6133 -1759 - -33909 - -4517 -2866 -1068 -4227 -1063 -4361 -3775 -1875 -1073 -3639 -3237 -4783 -5372 -4323 -3275 - -13452 -14869 -23151 - -12595 -9113 -9304 -5185 -5235 -3787 - -6269 -1291 -2735 -3495 -2070 -5552 -4185 -3574 -4856 -4845 -1211 -4071 -5889 -3287 - -4307 -1452 -2411 -8024 -2614 -7541 -5120 -3104 -3937 -2592 - -37000 -12395 - -4725 -8239 -3949 -9498 -9488 -6151 -5996 - -1748 -3706 -6210 -5673 -3791 -5378 -6384 -2993 -4521 -1687 -2437 -3063 -4262 - -10776 - -1329 -2732 -4136 -3270 -7983 -6004 -4285 -7196 -7543 -7826 - -5324 -15037 -11331 -14308 -13527 - -1542 -4771 -4065 -3939 -5925 -6740 -5121 -6854 -1797 -2246 -2036 -5105 -5555 - -9669 -8993 -7817 -5442 -10974 -7509 -8967 - -46998 - -8151 -8919 -5590 -1172 -12588 -12730 - -1584 -7654 - -25613 - -10908 -3168 -6477 -2079 -1440 -6280 - -7201 -5717 -8338 -1740 -2479 -1984 -1751 -8594 -7637 -1089 - -14411 -3771 -7202 -3251 -2650 - -5964 -3451 -1718 -1723 -2658 -2163 -3113 -6200 -2399 -5498 -1571 -5872 -2842 -6443 - -2611 -3129 -3150 -4293 -3362 -5035 -5682 -1950 -4556 -6069 -1061 -3628 -5222 -2266 -2326 - -3979 -3488 -4876 -2074 -5871 -3413 -3968 -4870 -4654 -3475 -3151 -3581 -4218 -1086 - -1521 -3326 -3537 -3223 -2599 -2264 -3004 -2885 -6521 -4096 -3015 -2034 - -9175 -10101 -6721 -5683 -8376 -3584 - -8994 -12517 -5524 -8860 -1700 - -5976 -5345 -1916 -1376 -4610 -4637 -1222 -1823 -5969 -4598 -1266 -3058 -3274 -3196 -2533 - -4151 -4606 -2939 -7433 -7934 -1433 -7226 -3391 -6444 -3292 -3707 - -13678 -1900 -1316 -2999 -4739 - -10131 -8655 -3662 -6570 -9957 -2535 -3312 - -3632 -1192 -6521 -7333 -1874 -6379 -6505 -3737 -5705 -6127 -3099 -5289 - -13342 -10976 -7459 -17656 - -4441 -2033 -4373 -6988 -5037 -3301 -4940 -5675 -1654 -2206 -6505 -1171 - -23804 -22215 - -5917 -1679 -5720 -2327 -2111 -1479 -5369 -1455 -4047 -2609 -4059 -5461 -3726 -5245 -4617 - -3832 - -30019 -36074 - -2301 -2878 -2284 -2359 -6149 -5411 -4323 -2135 -3423 -5649 -5302 -2837 -4670 -5240 - -2535 -3698 -4005 -4530 -3483 -3840 -5770 -6032 -2261 -4189 -4715 -6289 -3112 -5324 - -5734 -4573 -2286 -1328 -5187 -6665 -5591 -2782 -4429 -5214 -7126 - -4378 -1546 -5909 -5252 -12837 -9857 - -6943 -7103 -6885 -2216 -2277 -5110 -3147 -1669 -2405 - -9766 -2431 -8424 -3505 -4371 - -7819 -3429 -2003 -7906 -4196 -4966 -6544 -2194 -5282 -3391 - -5196 -7087 -5152 -4841 -1323 -8180 -8375 -2274 -9193 - -2455 -9393 -3353 -3473 -6684 -8779 -8869 -1379 -6049 - -10423 -7768 -7405 -8893 -6566 -1104 -2981 -6618 - -2320 - -5330 -4166 -6922 -3242 -4383 -7546 -7715 -7988 -8012 -1877 - -10491 -3303 -2681 -2093 -4378 -6167 -2854 -5345 - -3312 -12989 -13062 -7486 -13302 -1205 - -58470 - -13413 -4298 -3133 -7842 -9040 - -4374 -7227 -10320 -2654 -5348 -12005 - -13208 -7384 -11355 -11780 -7356 -1871 - -1615 -6191 -1367 -1969 -4694 -1704 -6816 -3502 -5382 -4902 -4140 -3525 -5102 - -7778 -5765 -3407 -1334 -8488 -4870 -5197 -5158 -7332 -6025 - -3114 -15591 -23604 - -25210 -12504 -22559 - -1906 -6500 -1781 -2858 -4947 -3217 -3577 -4332 -1509 -6900 -1180 -5648 -3821 - -3982 -4400 -4655 -2599 -2430 -1743 -1817 -1626 -1880 -2769 - -9617 -7677 -3341 -4398 -8994 -10662 -5805 - -2984 -4321 -1939 -4864 -10130 -1227 -7189 - -3586 -4161 -3089 -2857 -2931 -8877 -3311 -5180 -4607 - -2539 -4289 -1168 -6262 -4551 -1731 -1292 -2442 -1423 -1619 -6126 -5220 -5577 - -1769 -4044 -1064 -1380 -2814 -7936 -2928 -3053 -3109 -2695 - -3502 -3521 -4581 -2917 -7040 -1876 -4819 -6214 -2779 -2169 -4885 -5352 - -9675 -13851 -9906 -1245 - -7934 -2860 -17685 - -4982 -3620 -2583 -1264 -2218 -6499 -4028 -9082 -2112 - -3761 -3665 -3717 -1112 -9380 -3463 -9677 -5469 -4111 - -6450 -14269 -17362 -1469 - -9305 -1360 -2214 -1625 -6197 -1322 -7217 -1076 -9466 - -2572 -6102 -7582 -13444 -8038 -1523 - -2212 -7180 -6025 -5842 -2433 -5261 -6975 -8067 -1247 -2153 -3311 - -1770 -5359 -6076 -5750 -4681 -8009 -5273 -3051 -7465 -6530 - -3373 -5040 -4365 -4906 -3988 -2941 -4778 -5635 -4277 -5298 -3161 -4611 -3880 -2808 -5151 - -15491 -3325 -4869 -12203 - -20880 -27057 - -5023 -7729 -7517 -6546 -1217 -7548 -8017 -7453 -6909 -7762 - -16756 - -1104 -2160 -4999 -2256 -2061 -2899 -1677 -1202 -4950 -6408 -2614 -1029 -6114 -3983 - -1676 -22625 -24638 - -6252 -6116 -6544 -4736 -4360 -6578 -2026 -8438 -4904 -5071 - -6250 -1604 -5152 -4034 -4210 -2452 -1982 -1462 -1338 -2083 -1618 -4563 -4859 - -1970 -7309 -2481 -7603 -7395 -6379 -6398 -6117 -7246 -2876 -3027 - -5903 -1822 -5861 -4894 -6005 -4571 -4555 -6531 -5464 -3609 -6464 -7134 - -1225 -21041 -7411 - -6970 -7008 -2951 -2131 -5453 -4772 -3154 -6810 -6825 -4469 -1413 - -1056 -5979 -7996 -11013 -4330 -12024 -10085 - -5270 -2532 -2411 -1372 -2690 -5956 -2638 -3667 -4929 -4946 -4141 -1727 -3957 -3987 -5032 - -11710 -2443 -8104 -9459 -5216 -4656 -9892 - -6455 -7683 -6891 -3883 -5618 -3631 -8120 -4878 -3746 - -8872 -14142 -7663 -14581 -7294 - -3656 -7094 -4543 -7459 -4517 -4732 -4501 -3358 -4838 -4205 -2077 -4579 - -7562 -2081 -8129 -6791 -10059 -2783 -4002 -5055 - -3431 -4855 -6062 -7023 -2386 -4158 -6753 -9088 -3315 - -1011 -3354 -5796 -9625 -3172 -5466 -2276 -8053 -4692 - -4232 -5937 -4857 -4515 -3142 -4902 -2726 -1425 -4999 -3980 -3225 -3083 -3054 -5380 -2547 - -1161 -5732 -5773 -1553 -1317 -3005 -1882 -7352 - -7392 -1908 -6482 -3445 -7074 -8522 -9787 -6791 - -3421 -5673 -5874 -4044 -4264 -2367 -4127 -1186 -4172 -5972 -3405 -2272 -1702 -5672 -4004 - -25299 -34008 - -4160 -6041 -8263 -4164 -2317 -2395 -9046 -5315 -7069 - -5362 -7912 -5760 -6799 -1462 -2520 -9667 -6333 -1055 - -35513 -6387 - -10814 -4122 -11320 -6445 -11264 -5322 -7651 - -5518 -3507 -6489 -11057 -7094 -2014 -3874 - -17936 - -2573 -7532 -1617 -5007 -4781 -4238 -5023 -7946 -7218 -6051 -6517 - -5524 -9035 -2723 -10089 -8048 -7010 -3673 - -11048 -4936 -11979 -4390 -2639 -9910 - -50344 - -5440 -5049 -7437 -2658 -8751 -3995 -1955 -4056 -7203 -3175 \ No newline at end of file diff --git a/2022/Day02/input b/2022/Day02/input deleted file mode 100644 index 0261bf1..0000000 --- a/2022/Day02/input +++ /dev/null @@ -1,2500 +0,0 @@ -A X -B Y -B Y -C X -B X -C Z -C Z -A Z -A Z -B Y -C Z -A Z -C Z -C X -B Z -C Z -C Z -C Z -B Y -C Z -C Z -C Z -A Z -A Y -B Z -B Z -A Y -B X -C Z -C Z -A Z -A Z -C Z -A Y -A X -A Z -A Z -B X -B Z -B X -A Z -B X -B Z -B Z -C Z -A Z -A Z -A Z -C Z -B Z -A Z -A Y -A Y -B Y -B Y -B Z -A Z -B Z -A Z -B Z -C Z -B Y -A Z -B Y -A Z -A Z -A Z -C Z -A Y -A Z -C Z -C Z -A Z -A X -B Y -C Z -A Z -A Z -C X -C Z -B X -C X -B X -A Z -C Z -C Z -A Y -A Z -B X -C X -A Z -A Z -C Z -C Z -B Y -C Z -A Z -A Z -A Y -B X -B Y -A Z -C Z -A Z -A Z -A Z -C X -C Y -C Z -B X -B X -B X -A Z -A X -C Z -A Z -B Y -B X -A Y -B X -A Z -C Z -C Z -A X -A Z -C Z -B Z -B X -A Z -C Z -C Z -C X -C Z -C Z -C Z -A Y -B X -A Y -A Z -B Z -B Z -C Z -B Z -B Z -B X -A Z -C Z -A Z -A Y -C Z -A Z -C X -A Z -A Z -A Y -A Y -A Z -C Z -B Y -A X -A Z -A Y -C Z -A Z -B X -A Z -B Y -A X -C X -B X -A Y -A Z -B Z -A Z -A Z -B X -A X -C Z -B X -B Y -A Z -B X -C Z -A Z -C Z -B X -A Z -A Y -A Z -A Z -B X -B X -B Z -A Z -B Y -C Z -B Z -C Z -C Z -B X -B X -A Z -C Z -C Z -A X -B X -B X -A Y -C Z -A Z -A Y -B X -A Z -A Z -B X -A Z -C Z -B X -B Z -B Y -B X -A Y -C Z -C Z -C Z -A X -C Z -A Z -C Z -C Y -C Z -C Z -C Z -B X -A Z -B X -B Z -A Z -C Z -B Y -B Y -B Z -C Z -C Z -C Z -B Z -B Y -A Z -B X -B Z -C Z -A Z -B Y -B Y -A X -C Z -B Y -A Y -B Y -B X -B Y -B Y -A Y -B Y -C X -A Y -A Y -C Z -A Z -A Y -C Z -A Z -A Z -C Z -C Z -C Z -B X -B Y -A Y -A Y -B Z -A Z -B Y -B X -B Y -A Y -A Y -A Z -B Z -C Z -C Z -C Z -A Z -C Z -A Z -A Z -A Z -A Z -C Z -B Y -C Z -B X -C Z -A X -A Z -B X -C Y -C X -A X -A X -A Z -A Z -B X -A Y -B Z -A Z -B Z -A Z -C Z -C X -C Z -C Z -C X -C Z -C Z -C X -C Z -B Z -A Z -B Y -A Z -C Z -B X -C Z -B Z -B Y -A Z -B Y -A Y -B X -B Z -B Z -A Z -B Z -C Z -C Z -A Y -A Z -A X -A Y -C Z -B X -A Z -C X -A Z -A Z -A Z -A Z -C Y -B Y -B Y -A X -C Z -A X -A Z -A Y -C X -A Y -A Y -A Z -C X -C Z -B Z -B X -A Z -C Z -C Z -B Z -B X -C Z -C Z -A Y -B Z -A X -B Y -A Z -C X -B X -C Z -B Y -A X -A Z -B Y -A Y -A Z -B Z -A Y -B Y -A Z -B Y -B X -B Z -A Z -B Y -B Z -A Y -A Z -C Z -B X -C Z -B X -C Z -B Z -C Z -C Z -B Z -A Y -A Y -C Z -B Z -A Z -A X -C Z -A Z -C Z -A Z -A X -A Z -A Z -A Y -B Z -B X -C X -B Y -C Z -B X -B Z -B X -A Z -A Z -A Z -B Z -B Y -A Z -B Y -C Z -B Z -A Z -A Y -C Z -A Z -B Y -B X -B Y -B X -C Z -C Y -A Z -C Z -C Z -A Z -C X -B Z -A Y -B Y -B Y -B Y -C Z -B Z -A Z -B Y -A Z -A Z -C Z -B Y -B Y -A X -A Z -A Z -C Z -A Z -C Z -C Z -A X -B Z -A Z -A Z -C Z -C Z -B Y -B Y -A Z -A Y -A Z -B Y -B Z -A Y -B Z -A Z -A Z -A Y -C Z -A Y -C Z -B X -A Z -A Z -C Z -A Y -C Z -A Z -A Y -A Y -C Z -A Z -A Y -B X -A Y -B X -A Z -A Z -A Y -B Y -B Y -B X -C Z -C Z -B Y -B X -C Z -B Y -C Z -B Y -B X -C Z -A Y -B Z -C X -A Y -C Z -C Z -C X -A Y -A Z -B X -C Z -A Z -B Y -C Z -B X -B Z -C Z -C Z -C Z -A Z -B X -C Z -A Z -A Y -B Y -C Z -A X -C Z -A Y -C X -A Y -B Y -C Z -B X -A Z -C Z -C Z -B Z -B Y -A Z -A Z -A Y -C Z -A Y -A X -A Y -B Z -C Z -C Z -A Z -A Z -C Z -A Y -C Z -C Z -B Z -C Z -C Z -A Z -C Z -B Z -C Z -B X -A Y -A Y -A Z -C X -C Z -C Y -C Z -C Z -C Z -B Z -A Z -C Z -C Z -A Y -B Y -B X -B X -C Z -A Z -B Y -C Z -C Z -B X -C Z -C Z -A Y -A Y -A Z -A Y -B Y -C Z -A X -A Y -C Z -A Z -C Z -C Z -A X -A Z -C Z -B Z -A Z -A Z -B Y -B X -A Z -A Z -B Z -C Z -C Z -A Y -A Z -B Z -B Z -C Z -B Z -A Y -B X -A Z -B X -C Z -A Z -A Y -C Z -C Z -A Z -A Z -A Z -A Z -A Z -B X -C Z -C Z -C Z -A Z -A Z -A Z -A Z -B X -C Z -B X -C Z -A Z -C Z -A X -A Y -A Z -C Z -B Y -C Z -C Z -B Z -C Z -B X -C Z -B X -A Z -A Z -B Y -B X -C Z -C Z -C Z -C Y -C X -B Y -B Y -C Z -A Z -A Z -C Y -C Z -B Y -C X -A Z -B X -A Z -C Z -C Z -A Z -C X -A Z -B Z -B Y -A X -C Z -A Z -B X -A Z -B Y -C Z -B X -C Z -B Y -C Z -A X -C Z -A Z -C Z -A Y -A Y -C Z -C Z -B X -B Z -A Z -C Z -A Z -C Z -A Y -B X -C Z -A Z -B X -C Z -C Z -B Y -C Z -C Z -C Y -B Y -B X -C Z -B Y -A Z -A Z -B X -B Y -B Y -B Y -B Y -B Z -C Z -C Z -A Z -C Z -C X -C Z -B Z -C X -C X -A Z -A Z -B Y -B Z -B Y -C Z -A Y -A Z -B Y -B Y -B X -A Z -A Z -A Z -C Z -C Z -C Z -B Z -A X -A Z -A Y -C Z -A Z -A Z -B Z -B Y -B Y -A X -C Z -C Z -B X -A Z -B Y -A Z -B Z -A Z -C Z -C X -A Y -A Z -C Z -C Z -C Z -A Z -C Z -C Z -B Y -A Z -A Z -A Z -A Y -C Z -A Z -C Z -B Z -A Z -C Z -C X -B Z -C X -B X -C Z -B Z -A Y -C Z -C Z -B X -B Y -B Y -A Z -B X -A Y -A Y -A Z -B Z -C Z -C Z -B Z -A Z -C Z -B Y -C X -B Z -C Z -B Z -C Y -C Z -A Y -A Z -C Z -A Z -A Z -C Z -C Z -C Z -B Z -A Z -C Z -C X -A Z -A Z -B X -B Y -C Z -A Y -A Z -C Z -B Z -C Z -A Y -A Y -C Z -A Z -A Z -B X -A Y -B Y -C Z -C Z -B Y -A Z -A Y -C X -C Z -C Z -A Z -C Z -A Y -C Z -A Z -A Z -C Z -A Z -A X -C Z -C Z -A Z -B Z -B Z -B X -A Z -B X -A Y -A Z -C Z -C Z -A Y -B Z -C Z -A Z -A Z -C X -B Z -B Y -B Y -A Y -B X -B X -C Z -B X -A Z -B X -A Z -C Z -C Z -A Z -B Y -C Z -C X -C Z -C Z -A Z -B X -C Z -C Z -A Y -C Z -C Z -B X -B X -B X -A Z -B Y -C Z -A Z -C Z -C Z -B Y -C Z -A Z -C Z -B Y -B Z -C Z -C Z -C X -C Z -B Z -C Z -B Y -B X -A Z -A Y -B X -A Y -B Y -A Z -C Z -C Z -C Z -B X -C Z -B X -A Z -B X -B Y -A Z -C Z -C Z -C Z -A Y -B Y -A Y -C Z -A Z -C Z -C Z -A Z -A Y -C Z -B X -A Y -A Z -C Z -B Y -C Z -A Z -C Z -B Y -C Z -C Z -B Y -C Z -C Z -B X -C Z -B Y -C Z -B Y -A Z -C Z -B Y -A Z -C Z -C Z -B Y -B X -B Z -A Z -A Y -A Z -A Y -C Z -C Z -B X -C Z -B Y -C Z -C X -C Z -A Y -A Z -C Z -C Z -C Z -A Z -B Y -C Z -C Z -A Z -B Y -C Z -A Y -B Z -B X -A Y -B Y -C Z -A Y -C Z -B Y -B Y -C Z -C Z -B Y -B X -C Z -B X -B Z -B Y -C Z -C Z -C Z -A Z -A X -A Z -B Z -A Z -C Z -A Z -C Z -C Z -A Z -A Z -B Z -C Z -C Z -C Z -A Z -B Y -A Z -A Y -C Z -B X -B X -A Y -C Z -C Z -B X -B Z -C X -B X -B Y -A Z -A Y -A Z -C Z -B X -C Z -B Z -C Z -A Y -C Z -A Y -C Z -B Y -B Z -C Z -C Z -C Z -C Z -C Z -A Z -B Y -C Z -C X -B Y -C X -B Y -B Z -B Y -A Z -A Z -B X -C Y -A Z -C Z -B X -B X -A Z -A Z -B Y -C Z -B Y -B Z -A Y -A Z -C Z -C Z -B X -A Z -A Z -A Z -C Z -C X -C Z -C Z -C Z -C Z -A Z -B Y -C Z -C Z -C Z -B Z -C Z -B X -C Z -A Z -A Z -C Z -C Y -B Y -A Z -A Y -B Z -A Y -B Y -C Z -A Y -C Z -A Z -C Z -B X -C Z -A Z -A Z -B Z -A Z -B Z -A Z -B Y -C Z -B Z -B Y -C Z -A Z -A Z -B X -B X -A Y -A Z -B Y -A Y -A Z -C Z -A X -C Z -A Z -A Z -C Z -A Z -B X -A Z -A Y -A Y -B Y -A Z -A Z -A Z -B Y -B Y -A Z -A Z -C Z -C Z -A Y -B X -B X -C Z -A Y -C Z -C Z -C Z -A Y -C Z -C X -C Z -B Y -A Z -B Y -A Z -C Z -A Y -C Z -A Y -B Z -B X -B Y -B X -B Y -B X -A Y -C Z -C Z -B Z -C Z -C X -B X -A X -A Z -A Z -B Y -C Z -C Z -B Y -C Z -C Z -B Y -A Z -B Z -C X -C Z -C Z -B Y -C X -C Z -B Z -A Z -C Z -B X -A Z -C Z -A Z -C Z -B X -B Z -C Z -C Z -C Z -A Z -B Y -A Y -A Z -C Z -C Z -C Z -B Y -A Z -C Z -C Z -A Z -B Z -B Y -C Z -A Y -A Z -A Z -C Z -C Z -C Z -C Z -A Z -C Z -C Z -A Y -A Y -A Z -C Z -A Z -A Z -B X -A Y -A Z -A Y -C Z -B Z -A Y -A Z -B X -C Z -A Z -A Z -A Y -B Y -C Z -C Z -A Z -B X -A Y -A Z -C Z -C Z -B Y -C Z -A Z -B Y -C Z -C Z -B Y -C X -A Z -C Z -C Z -C Z -C Z -A Z -B Y -A Y -B Y -B Z -C Z -A Z -B Z -C Z -A X -C Z -C X -A Z -A Z -A X -A Z -A Z -A Z -A Z -B X -A Z -A Z -A Z -C Z -C Z -C Z -C Z -A Z -A Y -B X -C Z -B Y -A Y -A Z -C Z -C Z -C Z -B Y -A Z -B Z -C Z -B X -B Z -B Z -B Y -C Z -C X -B Y -A Y -C X -C Z -C Z -B Y -A Z -C Z -A Z -A Z -C Z -C Z -C Z -C Z -B Z -C Z -B X -C Z -B X -B Z -A Z -B Y -C Z -A Z -C Z -A Z -A Y -A Z -C Z -B X -C Z -C Z -A Z -A Z -C Z -C Z -A Z -C Z -A Y -C Z -C Z -A Z -A X -A Z -C Z -A Z -C Z -C Z -A Z -B X -C Z -C Z -C X -A Z -A Z -A X -B X -C Z -C Z -A Z -B X -C X -A Z -C Z -B Y -C Z -A Z -C Z -A Y -A Z -C Z -C Z -B X -A Z -B Y -A Z -C Z -C X -B Z -C Z -A X -A Y -C Z -C Z -C X -B Z -A Z -A Z -B Z -A Y -C X -A Z -C Z -A Z -C Z -A Z -A Z -A Z -C Z -A Z -C Z -B X -A Y -A Z -C Z -B Y -C Z -A Y -C Z -C Z -C Z -C Z -A Z -A Z -B Z -C Z -A Y -C X -C Z -C Y -B Y -C X -A Y -C Z -C Z -B Z -B Y -B Z -A Z -B Y -C Z -C Z -B X -B Y -B Z -A Z -A Z -C Z -B X -A Z -B Y -C Z -C Z -B X -C Z -A X -C Z -B X -A Y -A Z -B Y -C Z -C Z -A Y -A Z -C Z -C Z -A Z -C Z -C Z -C Z -B X -C Z -B Y -B Y -C Z -B Z -C Z -C X -C Z -B X -A Z -B Z -B Z -B Z -C Z -A X -C Z -B X -A Z -A Z -A Z -A Y -C Z -C Z -C Z -C X -A Y -A Z -A Z -C Z -C Z -A Z -B X -C Z -B Y -A X -C X -B Y -B Y -A Y -C X -C Z -B X -A Z -A Z -B Z -A Y -C Z -C Z -A Z -C Z -C Z -A Y -C Z -C Z -B Y -C Z -C Z -A Z -A Z -B Z -A Z -C Z -C Z -C Z -C X -C Z -A Z -C Z -C Z -C Z -C X -C Z -C Z -A Z -B Y -C Z -B X -A Z -C Z -C Y -A Z -A Y -A Z -C X -C X -A Y -B X -A Y -B Y -B Z -B Y -B Y -B Y -B Y -B Y -B Y -B Y -B X -B Z -A Y -A Y -A Y -B Y -A Y -B X -C X -A Z -C Z -A Z -A X -C Z -C Z -B Z -C Z -B Z -B Z -A Z -A Y -A Z -B X -B Z -C Y -A Z -A Z -A Z -C Z -C Z -C Z -C Z -A Z -C Y -A Y -C X -C Z -B Y -C Z -A Z -A X -A Z -B Z -C Z -B X -B X -A Z -C Z -B X -C Z -C Z -A X -C Z -A Z -C Z -C Z -B Z -B Y -B X -B Z -A X -A Y -C Z -A X -A Y -B Y -A Y -C Z -C Z -B X -C Z -B Z -C Z -B Y -C Z -A Z -A Y -B Z -B Z -A Z -A Z -A Z -A Y -C Z -C X -A Z -A X -B Y -B X -A Z -C Z -A Z -A Z -C Z -B Z -B Z -B Y -B Y -A Y -C Z -A Z -A Z -C Z -A Z -C Z -C Z -B X -B Y -C Z -C Z -B X -C X -C Z -A Y -C X -B X -A Z -A Z -A Y -B Y -A Z -B Z -C Z -C Z -A Z -B X -A X -B Y -A Z -B Z -A Z -B Y -C Z -A Z -A Y -C Z -A Y -C Z -C Z -A Z -C Z -C Z -A Z -A Y -C Z -A Z -B Z -A Y -A Z -C Z -C Z -A Y -C Z -A Y -A Z -C X -B X -B Z -B Z -B Z -B Z -B Y -B X -A Z -C Z -B Z -C Z -C Z -C X -A Z -A Z -B X -C Z -A Y -C Z -B Z -A Z -C X -C Z -C Z -B Y -C Z -B Z -A Z -A X -C Z -B X -A Z -B Y -C Y -C X -C Z -A Z -B Z -A Z -B Y -C Z -C Z -A Z -C Z -C Z -C Z -C Z -B Z -C Z -B X -B Y -A Z -B Y -B Y -A Z -C Z -C Z -B Y -B Y -B Y -B Y -B Z -B X -A Z -B Y -B X -A Z -A Y -B X -B X -C Z -C X -B Y -C Z -C Z -A Z -C X -C Z -A Z -B Y -A Z -A Z -A X -C Z -B Y -A Z -C Z -C Z -A Z -B Y -B Y -B Z -B Z -B X -A X -A Z -A Z -C X -B Y -A Y -B Z -A Z -B Y -C Z -C Z -B X -C Z -C Z -A Z -C Z -A Z -A Z -C Z -C Z -C Z -B X -B Z -A Y -B X -C Z -A Z -C Z -A Y -B Y -A X -C Z -A Y -A Z -A Z -A Z -B Z -C Z -C Z -C Z -C Z -C Z -B Z -B X -C Z -A Z -C Z -A X -B Z -C Z -C Z -A Z -A Z -B Y -C Z -A Z -C Z -B Y -A Z -A Y -A Y -C X -C Z -A Z -B Y -C Z -C X -C Z -A Y -A Z -A Z -B X -C Z -B X -B Y -A Y -A Y -B Z -A Y -A Z -B Z -A Z -A X -B Z -C Z -C X -C Z -C Z -C Z -C Z -C X -C Z -A Z -A Z -B X -A Z -A Z -A Z -C Z -A Z -C Y -B Y -B Y -C Z -A Y -B Z -C Z -C Z -C Z -A Z -C Z -A Z -B Z -B Y -A Y -C Z -A Z -A Y -C Z -C Z -A Y -B Y -C Z -A Z -A Y -A Z -B X -C X -C Z -C Z -A Y -A Z -B X -C Z -A Z -C Z -C Z -A Z -C Z -B X -A Z -A Z -B Y -C Z -B X -C Z -C X -A Z -B X -C X -C Z -C Z -A Z -B Y -A Y -C Z -B Z -B Y -C X -B X -C Z -C Y -A Z -A Z -C Z -B X -A Z -C Z -B Y -B X -B Z -B X -A Y -C Z -C Z -C Y -A Z -A Y -C Z -B X -A Z -A Z -B Z -B Z -B X -A Y -A Z -C Z -A Z -A X -A Y -C Z -C Z -B Y -A Z -C Z -B Z -A Z -B Y -C Z -B Y -A Z -B Z -A Z -B Y -B Z -C Z -C Z -A Y -C Z -A Z -B X -C Z -B X -B X -A Z -C Z -B Z -A Z -C Z -C Z -C Z -C Z -A Z -C Z -B Z -C Z -A Z -B X -C Z -A Z -C Z -C Z -A Y -A Y -C Z -A Y -A X -C Z -A Z -A Z -B Z -A Z -A X -C Z -B Y -A Y -B Y -A Y -C Z -C Z -B X -A Z -B X -B Z -B Z -A Y -C X -A Y -C Z -B Y -A Z -A Z -C Z -A Z -A Z -B Y -C X -B X -A Z -A X -C Z -A Z -B Y -A Z -C Z -C Z -A Z -B X -B Z -A X -A Y -A Y -B Y -B Z -B X -B Z -C X -B Z -C Z -C Z -B X -B Y -B X -B Z -B Z -C Z -A Z -A X -B X -C Z -A Z -B Y -B Y -C X -A Z -B X -A X -C Z -B Y -A Y -B Y -A Y -B Z -C Z -C Z -C Z -B Y -B Y -A Y -C Z -C Y -B Z -A Z -C Z -C Y -B X -B X -A Z -B Y -A Z -B X -A Z -B Y -B Y -C Z -C Z -A Z -B Y -C Z -C Y -C Z -C Z -A Y -B X -C Y -A Y -B X -C Z -C Z -C Z -B Z -B Y -A Z -A Y -A Z -C Z -C Z -B Y -C Z -C Z -A Z -B Z -C Z -A Z -A Z -A Z -A Y -C X -B Y -B Y -A Y -C Z -B Y -B X -B Z -C Z -C Z -A Y -A Z -A Z -B Z -C Z -C Z -B Y -C Z -A Z -C Z -C Z -C X -B X -B Y -C Z -A Z -A Y -C Z -C Z -C Z -A Z -A Y -C Z -A Z -A Y -A Y -C Z -B X -C Z -C X -B Y -A Z -B Y -C Z -B X -A Z -A Y -C Z -A Z -C Z -A Z -C Z -C Z -A Y -A Z -A Z -B Z -A Z -A Z -C Z -A X -A Y -C X -A Z -A Z -B Z -B Y -A Z -C Z -B Z -C Z -A Z -C Z -B X -C Z -B Z -B Z -C Z -B Z -A Z -A Z -C Z -A Z -C X -C Z -A Y -A Z -A X -A Z -B Z -B Z -C Z -C X -A Y -C Z -A Z -A Z -A X -C Z -C Z -C X -B Z -B X -B Z -B Y -C Z -A Z -A Y -A Y -B X -A Y -A Y -C Z -C Z -B Z -A Z -B Z -C Z -A Z -B Y -B Y -C Z -A Z -C Z -A Z -B Y -A Z -C Z -B X -C Z -A Z -C Z -A Y -B Y -A Y -B Z -A Y -C Z -A Z -C Z -B X -B X -B Y -B X -C Z -A X -B Y -B Z -C Z -A Y -C Z -B Z -C Z -A Z -C X -C Z -A Z -A Y -C Z -C Z -B Y -C Z -B Y -C Z -C Z -B Z -A Z -C Z -B Y -B X -A Z -C Z -C Z -A Z -C Z -C Z -B Y -A Z -B X -C Z -B Y -B X -A Z -C Z -A Z -C Z -A Z -C Z -B Y -C Z -A Z -B X -C Z -A Y -A Y -A Z -A Y -A Z -A X -C Z -B X -B Z -C Z -A Z -C X -A Z -A Z -A Z -C Z -A Z -C Z \ No newline at end of file diff --git a/2024/Day01/Solution.cs b/2024/Day01/Solution.cs new file mode 100644 index 0000000..7ab42a8 --- /dev/null +++ b/2024/Day01/Solution.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.IO; + +namespace adventofcode.Year2024.Day01; + +public class Solution : BaseSolution, ISolver +{ + public void SolvePart1() + { + Console.WriteLine("part 1"); + + //var inputFilePath = GetInputFilePath("test"); + var inputFilePath = GetInputFilePath(); + //Console.WriteLine(inputFilePath); + + // Read input file + string[] lines = File.ReadAllLines(inputFilePath); + + List leftNumbers = new(); + List rightNumbers = new(); + + foreach (var line in lines) + { + //Console.WriteLine(line); + var left = line.Split(" ")[0]; + var right = line.Split(" ")[1]; + leftNumbers.Add(Convert.ToInt64(left)); + rightNumbers.Add(Convert.ToInt64(right)); + } + + leftNumbers.Sort(); + rightNumbers.Sort(); + + long sum = 0; + + for (int i = 0; i < leftNumbers.Count; i++) + { + //calculate distance between two numbers + var distance = rightNumbers[i] - leftNumbers[i]; + distance = Math.Abs(distance); + + sum += distance; + //Console.WriteLine($"{leftNumbers[i]} -=- {rightNumbers[i]} => {distance}, sum: {sum}"); + } + + Console.WriteLine($"Part 1: Total sum: {sum}"); + } + + public void SolvePart2() + { + //var inputFilePath = GetInputFilePath("test"); + var inputFilePath = GetInputFilePath(); + //Console.WriteLine(inputFilePath); + + // Read input file + string[] lines = File.ReadAllLines(inputFilePath); + + List leftNumbers = new(); + List rightNumbers = new(); + + foreach (var line in lines) + { + //Console.WriteLine(line); + var left = line.Split(" ")[0]; + var right = line.Split(" ")[1]; + leftNumbers.Add(Convert.ToInt64(left)); + rightNumbers.Add(Convert.ToInt64(right)); + } + + long similarityScore = 0; + + foreach (long left in leftNumbers) + { + long appearCount = 0; + appearCount = rightNumbers.FindAll(x => x == left).Count; + long score = appearCount * left; + similarityScore += appearCount * left; + //Console.WriteLine($"{left} => {appearCount} times, actual similarity: {score}, total similaritySocre: {similarityScore}"); + } + + Console.WriteLine($"Part 2: Total similarity score: {similarityScore}"); + } +} \ No newline at end of file diff --git a/2024/Day02/Solution.cs b/2024/Day02/Solution.cs new file mode 100644 index 0000000..ff7cccc --- /dev/null +++ b/2024/Day02/Solution.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; + +namespace adventofcode.Year2024.Day02; + +public class Solution : BaseSolution, ISolver +{ + public void SolvePart1() + { + //var inputFilePath = GetInputFilePath("test"); + var inputFilePath = GetInputFilePath(); + Console.WriteLine(inputFilePath); + + // Read input file + string[] lines = File.ReadAllLines(inputFilePath); + + int safeReports = 0; + + foreach (string report in lines) + { + string[] levels = report.Split(' '); + long previousLevel = Convert.ToInt64(levels[0]); + long nextLevel = Convert.ToInt64(levels[1]); + bool wayUp = false; + bool safe = true; + + if(previousLevel < nextLevel) + wayUp = true; + + // if(previousLevel == nextLevel) + // break; + + for (int i = 1; i < levels.Length; i++) + { + long actualLevel = Convert.ToInt64(levels[i]); + long diff = 0; + + if (previousLevel < actualLevel && wayUp) + { + diff = actualLevel - previousLevel; + if (diff == 0 || diff > 3) + { + safe = false; + break; + } + } + else if (previousLevel > actualLevel && !wayUp) + { + diff = previousLevel - actualLevel; + if (diff == 0 || diff > 3) + { + safe = false; + break; + } + } + else + { + safe = false; + break; + } + previousLevel = actualLevel; + } + + if(safe) + { + safeReports++; + } + } + + Console.WriteLine($"Count of safe reports: {safeReports}"); + } + + public void SolvePart2() + { + Console.WriteLine("Part 2"); + //var inputFilePath = GetInputFilePath("test"); + var inputFilePath = GetInputFilePath(); + Console.WriteLine(inputFilePath); + + // Read input file + string[] lines = File.ReadAllLines(inputFilePath); + + int safeReports = 0; + + List unsafeReports = new(); + + foreach (string report in lines) + { + string[] levels = report.Split(' '); + long previousLevel = Convert.ToInt64(levels[0]); + long nextLevel = Convert.ToInt64(levels[1]); + bool wayUp = false; + bool safe = true; + + if(previousLevel < nextLevel) + wayUp = true; + + // if(previousLevel == nextLevel) + // break; + + for (int i = 1; i < levels.Length; i++) + { + long actualLevel = Convert.ToInt64(levels[i]); + long diff = 0; + + if (previousLevel < actualLevel && wayUp) + { + diff = actualLevel - previousLevel; + if (diff == 0 || diff > 3) + { + safe = false; + break; + } + } + else if (previousLevel > actualLevel && !wayUp) + { + diff = previousLevel - actualLevel; + if (diff == 0 || diff > 3) + { + safe = false; + break; + } + } + else + { + safe = false; + break; + } + previousLevel = actualLevel; + } + + if(safe) + { + safeReports++; + } + else + { + unsafeReports.Add(report); + } + } + + Console.WriteLine($"part 2: first found safe reports {safeReports}"); + Console.WriteLine($"part 2: found unsafe reports {unsafeReports.Count}"); + + foreach (string item in unsafeReports) + { + string[] originalLevels = item.Split(' '); + + int skipIndex = 0; + + for (int i = 0; i < originalLevels.Length; i++) + { + skipIndex = i; + + string[] deleteOneLevel = new string[originalLevels.Length - 1]; + int newIndex = 0; + + for (int d = 0; d < originalLevels.Length; d++) + { + if (d != skipIndex) + { + deleteOneLevel[newIndex] = originalLevels[d]; + newIndex++; + } + } + + //old part repeated for finding more safe reports + //string[] levels = report.Split(' '); + long previousLevel = Convert.ToInt64(deleteOneLevel[0]); + long nextLevel = Convert.ToInt64(deleteOneLevel[1]); + bool wayUp = false; + bool safe = true; + + if(previousLevel < nextLevel) + wayUp = true; + + // if(previousLevel == nextLevel) + // break; + + for (int f = 1; f < deleteOneLevel.Length; f++) + { + long actualLevel = Convert.ToInt64(deleteOneLevel[f]); + long diff = 0; + + if (previousLevel < actualLevel && wayUp) + { + diff = actualLevel - previousLevel; + if (diff == 0 || diff > 3) + { + safe = false; + break; + } + } + else if (previousLevel > actualLevel && !wayUp) + { + diff = previousLevel - actualLevel; + if (diff == 0 || diff > 3) + { + safe = false; + break; + } + } + else + { + safe = false; + break; + } + previousLevel = actualLevel; + } + + if(safe) + { + safeReports++; + break; + } + + // end of old part + } + + + + } + + + Console.WriteLine($"Part 2: Count of complete safe reports: {safeReports}"); + } +} diff --git a/2024/Day03/Solution.cs b/2024/Day03/Solution.cs new file mode 100644 index 0000000..d5431e0 --- /dev/null +++ b/2024/Day03/Solution.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime; +using System.Security.Cryptography.X509Certificates; +using System.Text.RegularExpressions; + +namespace adventofcode.Year2024.Day03; + +public class Solution : BaseSolution, ISolver +{ + public void SolvePart1() + { + //var inputFilePath = GetInputFilePath("test"); + var inputFilePath = GetInputFilePath(); + + string[] lines = File.ReadAllLines(inputFilePath); + + string regexpattern = @"mul\(\d{1,3},\d{1,3}\)"; + + List allmatches = new(); + + long totalSum = 0; + foreach (var line in lines) + { + var matches = Regex.Matches(line, regexpattern); + + foreach(Match match in matches) + { + allmatches.Add(match.Value); + + string item = match.ToString().Replace("mul(", "").Replace(")", ""); + + long x = long.Parse(item.Split(',')[0]); + long y = long.Parse(item.Split(',')[1]); + + totalSum += x * y; + } + } + + Console.WriteLine($"allmatches.count = {allmatches.Count}"); + Console.WriteLine($"total sum is: {totalSum}"); + + } + + public void SolvePart2() + { + //var inputFilePath = GetInputFilePath("testtwo"); + var inputFilePath = GetInputFilePath(); + + string[] lines = File.ReadAllLines(inputFilePath); + + string regexpattern = @"(?:\w*mul\(\d{1,3},\d{1,3}\))|(?:\b(?:un)?do\(\))|(?:\bdon't\(\))"; + + List allmatches = new(); + + long totalSum = 0; + bool doit = true; + foreach (var line in lines) + { + var matches = Regex.Matches(line, regexpattern); + + foreach(Match match in matches) + { + allmatches.Add(match.Value); + + if(match.ToString().Contains("mul")) + { + if (doit) + { + string temp = match.Value; + + if (temp.Contains("mul")) + { + // Normalize anything ending in "mul" (e.g., xmul, _mul) to "mul" + temp = Regex.Replace(temp, @"\w*mul", "mul"); + } + + string item = temp.Replace("mul(", "").Replace(")", ""); + + long x = long.Parse(item.Split(',')[0]); + long y = long.Parse(item.Split(',')[1]); + + totalSum += x * y; + } + } + else + { + if (match.ToString().ToLower().Contains("don't")) + { + doit = false; + } + else + { + doit = true; + } + } + + } + } + + Console.WriteLine($"total sum is: {totalSum}"); + } +} diff --git a/Application.cs b/Application.cs new file mode 100644 index 0000000..68bac04 --- /dev/null +++ b/Application.cs @@ -0,0 +1,131 @@ +using System; +using System.Reflection; + +namespace adventofcode; + +public class Application +{ + public void Run(string[] args) + { + Console.WriteLine("Hello to adventofcode!"); + + // Check if arguments were passed + if (args.Length > 0) + { + Console.WriteLine("Command-line arguments received:"); + foreach (var arg in args) + { + Console.WriteLine(arg); + } + } + else + { + Console.WriteLine("No command-line arguments received."); + } + + PreparedArgs preparedArgs = CheckArgs(args); + + if(!preparedArgs.IsValid) + { + Console.WriteLine("Invalid arguments. Exiting..."); + return; + } + + Solve(preparedArgs); + } + + private PreparedArgs CheckArgs(string[] args) + { + int year = 0; + int day = 0; + int part = 1; + bool bothParts = false; + + try + { + if(args.Length > 3) + { + Console.WriteLine("Too many arguments. Please provide year, day, and part."); + return new PreparedArgs { IsValid = false }; + } + else if(args.Length == 3) + { + year = Convert.ToInt32(args[0]); + day = Convert.ToInt32(args[1]); + part = Convert.ToInt32(args[2]); + } + else if (args.Length == 2) + { + year = Convert.ToInt32(args[0]); + day = Convert.ToInt32(args[1]); + bothParts = true; + } + else + { + var today = new DateTime(); + today = DateTime.Now; + + var start = new DateTime(2023, 12, 01); + + if(today.Month != 12 || today.Day > 25) + { + today = start; + Console.WriteLine("It's not December or it's after the 25th. Setting today to December 1st, 2023."); + } + year = today.Year; + day = today.Day; + bothParts = true; + } + + Console.WriteLine("You selected year {0} day {1} part {2} to solve. Let's go and try it...", year.ToString(), day.ToString(), part.ToString()); + return new PreparedArgs { IsValid = true, Year = year, Day = day, Part = part, BothParts = bothParts }; + } + catch (Exception) + { + Console.WriteLine("Invalid format. Please ensure all arguments are positive integers."); + return new PreparedArgs { IsValid = false }; + } + } + + private void Solve(PreparedArgs preparedArgs) + { + try + { + if (preparedArgs.Year == 2024 || preparedArgs.Year == 2019) + { + Assembly assembly = Assembly.GetExecutingAssembly(); + var solution = $"adventofcode.Year{preparedArgs.Year}.Day{preparedArgs.Day.ToString("D2")}.Solution"; + Console.WriteLine(solution); + + Type type = assembly.GetType(solution); + + if (type == null) + { + Console.WriteLine("The solution could not be found. Please try again."); + return; + } + + object instance = Activator.CreateInstance(type); + + if (preparedArgs.BothParts) + { + MethodInfo solvePart1 = type.GetMethod("SolvePart1"); + solvePart1.Invoke(instance, null); + + MethodInfo solvePart2 = type.GetMethod("SolvePart2"); + solvePart2.Invoke(instance, null); + } + else + { + MethodInfo solve = type.GetMethod($"SolvePart{preparedArgs.Part}"); + solve.Invoke(instance, null); + } + } + } + catch (Exception ex) + { + Console.WriteLine("An error occurred while trying to solve the problem. Please try again."); + Console.WriteLine(ex.Message); + } + } +} diff --git a/BaseSolution.cs b/BaseSolution.cs new file mode 100644 index 0000000..123934b --- /dev/null +++ b/BaseSolution.cs @@ -0,0 +1,28 @@ +using System; +using System.IO; + +namespace adventofcode; + +public abstract class BaseSolution +{ + public string GetNamespace() => this.GetType().Namespace; + + public string GetYear() + { + // Extract year from namespace + string namespaceName = GetNamespace(); + return namespaceName?.Split('.')[1].Replace("Year", "") ?? "Unknown Year"; + } + + public string GetDay() + { + // Extract day from namespace + string namespaceName = GetNamespace(); + return namespaceName?.Split('.')[2].Replace("Day", "") ?? "Unknown Day"; + } + + public string GetInputFilePath(string fileName = "input") + { + return Path.Combine(Environment.CurrentDirectory,"input", GetYear(), $"Day{GetDay()}", fileName); + } +} diff --git a/Helper.cs b/Helper.cs index 9958977..8cd2dd1 100644 --- a/Helper.cs +++ b/Helper.cs @@ -1,5 +1,7 @@ using System; +using System.Diagnostics; using System.Drawing; +using System.IO; namespace adventofcode; @@ -17,4 +19,13 @@ public static class Helper (-1, -1) ]; + [Obsolete("This method is deprecated and will be removed in future versions.")] + public static string GetFilePath(int year, int day, string input = "input.txt") + { + string filepath = Path.Combine(Environment.CurrentDirectory, year.ToString("D4"), $"Day{day.ToString("D2")}", input); + Debug.WriteLine(filepath); + return filepath; + } + + } \ No newline at end of file diff --git a/LICENSE b/LICENSE index a912d52..57295b0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 deckelmouck +Copyright (c) 2019-2024 deckelmouck Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Models/PreparedArgs.cs b/Models/PreparedArgs.cs new file mode 100644 index 0000000..325c332 --- /dev/null +++ b/Models/PreparedArgs.cs @@ -0,0 +1,12 @@ +using System; + +namespace adventofcode; + +public class PreparedArgs +{ + public int Year { get; set; } + public int Day { get; set; } + public int Part { get; set; } + public bool IsValid { get; set; } + public bool BothParts { get; set; } +} diff --git a/Program.cs b/Program.cs index 501d0bd..502f3e3 100644 --- a/Program.cs +++ b/Program.cs @@ -1,197 +1,209 @@ using System; using System.Reflection; -using adventofcode; -namespace adventofcode + +namespace adventofcode; +class Program { - class Program + static void Main(string[] args) { - static int year {get; set;} - static int day {get; set;} - static int part {get;set;} + Application app = new Application(); + app.Run(args); + } - static void Main(string[] args) - { - DateTime start = DateTime.Now; - Console.WriteLine("Hello to adventofcode!"); + static void OldMain(string[] args) + { + int year = 0; + int day = 0; + int part = 1; - if(args.Length == 3) - { - year = Convert.ToInt32(args[0]); - day = Convert.ToInt32(args[1]); - part = Convert.ToInt32(args[2]); + DateTime start = DateTime.Now; + Console.WriteLine("Hello to adventofcode!"); - Console.WriteLine("you selected year {0} day {1} part {2} to solve. let's try it....", year.ToString(), day.ToString(), part.ToString()); + if(args.Length == 3) + { + year = Convert.ToInt32(args[0]); + day = Convert.ToInt32(args[1]); + part = Convert.ToInt32(args[2]); - solve(year, day, part); - } - else if (args.Length == 2) - { - year = Convert.ToInt32(args[0]); - day = Convert.ToInt32(args[1]); - solve(year, day); - } - else + Console.WriteLine("you selected year {0} day {1} part {2} to solve. let's try it....", year.ToString(), day.ToString(), part.ToString()); + + solve(year, day, part); + } + else if (args.Length == 2) + { + year = Convert.ToInt32(args[0]); + day = Convert.ToInt32(args[1]); + solve(year, day); + } + else + { + // for testing + var today = new DateTime(2023, 10, 1); + + if(start.Month == 12 && start.Day < 26) { - // for testing - var today = new DateTime(2023, 10, 1); - - if(start.Month == 12 && start.Day < 26) - { - today = start; - } - - Console.WriteLine($"set today for testing to {today.ToShortDateString()}"); - - solve(today.Year, today.Day); - - //solutionDay1 sd1 = new solutionDay1(2); - //solutionday02 sd2 = new solutionday02(2); - //solutionday03 sd3 = new solutionday03(2); - //solutionday04 sd4 = new solutionday04(1); - //solutionday05 sd5 = new solutionday05(2); + today = start; } - TimeSpan timeSpan = DateTime.Now - start; - Console.Write("Problem solved in "); - Console.ForegroundColor = ConsoleColor.Green; - Console.Write(string.Format("{0} ms", timeSpan.TotalMilliseconds.ToString())); - Console.ResetColor(); - //Console.WriteLine("Press any key to exit."); - //Console.Read(); + Console.WriteLine($"set today for testing to {today.ToShortDateString()}"); + + solve(today.Year, today.Day); } - static void solve(int year, int day) + TimeSpan timeSpan = DateTime.Now - start; + Console.Write("Problem solved in "); + Console.ForegroundColor = ConsoleColor.Green; + Console.Write(string.Format("{0} ms", timeSpan.TotalMilliseconds.ToString())); + Console.ResetColor(); + //Console.WriteLine("Press any key to exit."); + //Console.Read(); + } + + static void solve(int year, int day) + { + solve(year, day, 1); + + solve(year, day, 2); + } + + static void solve(int year, int day, int part) + { + if (year == 2024 || year == 2019) { - solve(year, day, 1); + Assembly assembly = Assembly.GetExecutingAssembly(); + var solution = $"adventofcode.Year{year}.Day{day.ToString("D2")}.Solution"; + Console.WriteLine(solution); + + Type type = assembly.GetType(solution); + object instance = Activator.CreateInstance(type); - solve(year, day, 2); + MethodInfo solve = type.GetMethod($"SolvePart{part}"); + solve.Invoke(instance, null); } - static void solve(int year, int day, int part) + if(year == 2022 || year == 2023) { - if(year >= 2022) - { - //Assembly assembly = Assembly.LoadFrom(@"C:\dev\adventofcode\bin\debug\net7.0\adventofcode.dll"); - Assembly assembly = Assembly.GetExecutingAssembly(); - //Console.WriteLine("{0}", assembly.FullName); - - var solution = $"aoc{year.ToString("D4")}.solutionDay{day.ToString("D2")}"; - Console.WriteLine(solution); + //Assembly assembly = Assembly.LoadFrom(@"C:\dev\adventofcode\bin\debug\net7.0\adventofcode.dll"); + Assembly assembly = Assembly.GetExecutingAssembly(); + //Console.WriteLine("{0}", assembly.FullName); - Type type = assembly.GetType(solution); - object instance = Activator.CreateInstance(type); + var solution = $"aoc{year.ToString("D4")}.solutionDay{day.ToString("D2")}"; + Console.WriteLine(solution); - MethodInfo solve = type.GetMethod($"SolvePart{part.ToString("D1")}"); + Type type = assembly.GetType(solution); + if (type == null) + throw new Exception($"Type {solution} not found"); + object instance = Activator.CreateInstance(type); - solve.Invoke(instance, null); - - Console.WriteLine("solved..."); - } + MethodInfo solve = type.GetMethod($"SolvePart{part.ToString("D1")}"); - if(year == 2021) - { - Console.WriteLine("not yet implemented"); - } + solve.Invoke(instance, null); + + Console.WriteLine("solved..."); + } - if(year == 2020) - { - switch (day) - { - case 1: - solutionDay01 sd1 = new solutionDay01(part); - break; - case 2: - solutionday02 sd2 = new solutionday02(part); - break; - case 3: - solutionday03 sd3 = new solutionday03(part); - break; - case 4: - solutionday04 sd4 = new solutionday04(part); - break; - case 5: - solutionday05 sd5 = new solutionday05(part); - break; - case 6: - solutionday06 sd6 = new solutionday06(part); - break; - case 8: - solutionday08 sd8 = new solutionday08(part); - break; - case 9: - solutionday09 sd9 = new solutionday09(part); - break; - case 10: - solutionday10 sd10 = new solutionday10(part); - break; - case 11: - solutionday11 sd11 = new solutionday11(part); - break; - case 12: - solutionday12 sd12 = new solutionday12(part); - break; - case 13: - solutionday13 sd13 = new solutionday13(part); - break; - case 14: - //solutionday14 sd14 = new solutionday14(part); - break; - case 15: - solutionday15 sd15 = new solutionday15(part); - break; - default: - break; - } - } + if(year == 2021) + { + Console.WriteLine("not yet implemented"); + } - if(year == 2019) + if(year == 2020) + { + switch (day) { - if(day == 1) - { - if(part == 1) - { - year2019day1.part1(); - } - else if(part == 2) - { - year2019day1.part2(); - } - } - else if(day == 2) - { - if(part == 1) - { - year2019day2.part1(); - } - else if(part == 2) - { - year2019day2.part2(); - } - } - else if(day == 3) - { - if(part == 1) - { - year2019day3.part1(); - } - else if(part == 2) - { - year2019day3.part2(); - } - } - else if(day == 4) - { - if(part == 1) - { - year2019day4.part1(); - } - else if(part == 2) - { - year2019day4.part2(); - } - } + case 1: + solutionDay01 sd1 = new solutionDay01(part); + break; + case 2: + solutionday02 sd2 = new solutionday02(part); + break; + case 3: + solutionday03 sd3 = new solutionday03(part); + break; + case 4: + solutionday04 sd4 = new solutionday04(part); + break; + case 5: + solutionday05 sd5 = new solutionday05(part); + break; + case 6: + solutionday06 sd6 = new solutionday06(part); + break; + case 8: + solutionday08 sd8 = new solutionday08(part); + break; + case 9: + solutionday09 sd9 = new solutionday09(part); + break; + case 10: + solutionday10 sd10 = new solutionday10(part); + break; + case 11: + solutionday11 sd11 = new solutionday11(part); + break; + case 12: + solutionday12 sd12 = new solutionday12(part); + break; + case 13: + solutionday13 sd13 = new solutionday13(part); + break; + case 14: + //solutionday14 sd14 = new solutionday14(part); + break; + case 15: + solutionday15 sd15 = new solutionday15(part); + break; + default: + break; } } + + // if(year == 2019) + // { + // if(day == 1) + // { + // if(part == 1) + // { + // year2019day1.part1(); + // } + // else if(part == 2) + // { + // year2019day1.part2(); + // } + // } + // else if(day == 2) + // { + // if(part == 1) + // { + // year2019day2.part1(); + // } + // else if(part == 2) + // { + // year2019day2.part2(); + // } + // } + // else if(day == 3) + // { + // if(part == 1) + // { + // year2019day3.part1(); + // } + // else if(part == 2) + // { + // year2019day3.part2(); + // } + // } + // else if(day == 4) + // { + // if(part == 1) + // { + // year2019day4.part1(); + // } + // else if(part == 2) + // { + // year2019day4.part2(); + // } + // } + // } } } -; \ No newline at end of file diff --git a/README.md b/README.md index 94fd74b..8a48bef 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ personal adventofcode.com solution # my personal solution using c# with .NET 7 +# overview 2024 +- day01 :star: :star: +- day02 :star: :star: + # overview 2023 - day01 :star: :star: - day02 :star: :star: @@ -51,4 +55,4 @@ using c# with .NET 7 - day 1 :star: :star: - day 2 :star: :star: (got two results :/) - day 3 :star: :star: -- day 4 :star: \ No newline at end of file +- day 4 :star: diff --git a/adventofcode.csproj b/adventofcode.csproj index 4eeaa46..0f61cd1 100644 --- a/adventofcode.csproj +++ b/adventofcode.csproj @@ -1,7 +1,10 @@ Exe - net8.0 + net9.0 + + + \ No newline at end of file diff --git a/cleanup.ps1 b/cleanup.ps1 new file mode 100644 index 0000000..d867544 --- /dev/null +++ b/cleanup.ps1 @@ -0,0 +1,16 @@ +# Clean the project +Write-Host "Cleaning the project..." +dotnet clean + +# Remove bin and obj directories +Write-Host "Removing bin and obj directories..." +Remove-Item -Recurse -Force bin, obj + +# Restore dependencies +Write-Host "Restoring dependencies..." +dotnet restore + +# Build the project and show target log +Write-Host "Building the project..." +dotnet build /tl + diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 0000000..35d3811 --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Bereinigen des Projekts +echo "Cleaning the project..." +dotnet clean + +# Entfernen von bin und obj Ordnern +echo "Removing bin and obj directories..." +rm -rf bin obj + +# Wiederherstellen der Abhängigkeiten +echo "Restoring dependencies..." +dotnet restore + +# Bauen des Projekts und Anzeigen von Zielzeit (tl = TargetLog) +echo "Building the project..." +dotnet build /tl + diff --git a/input b/input new file mode 160000 index 0000000..211af8b --- /dev/null +++ b/input @@ -0,0 +1 @@ +Subproject commit 211af8b1a34b7c00958b1f52224e44feabf30e1b diff --git a/2020/solutionBase.cs b/solutionBase.cs similarity index 100% rename from 2020/solutionBase.cs rename to solutionBase.cs