diff --git a/advent-of-code-2022.csproj b/advent-of-code-2022.csproj index 34c17b7..c124c02 100644 --- a/advent-of-code-2022.csproj +++ b/advent-of-code-2022.csproj @@ -88,6 +88,7 @@ + diff --git a/inputs/22.txt b/inputs/22.txt index b856ab6..92049d1 100644 --- a/inputs/22.txt +++ b/inputs/22.txt @@ -1,420 +1,202 @@ -on x=-25..22,y=-37..17,z=-38..8 -on x=-1..45,y=-43..11,z=-22..28 -on x=-20..26,y=-29..24,z=-16..29 -on x=-49..4,y=-9..40,z=-3..47 -on x=-36..10,y=-30..18,z=-14..30 -on x=-45..2,y=-32..16,z=-33..18 -on x=-7..39,y=-7..47,z=-31..17 -on x=-13..35,y=-41..13,z=-8..39 -on x=-20..27,y=-11..42,z=-2..48 -on x=-16..32,y=-9..42,z=-18..30 -off x=-11..5,y=-35..-25,z=15..30 -on x=-27..17,y=-9..39,z=-45..2 -off x=-40..-25,y=21..35,z=-24..-10 -on x=-12..38,y=-30..19,z=-38..11 -off x=8..19,y=25..37,z=6..23 -on x=-17..34,y=-10..43,z=-45..4 -off x=-44..-31,y=-22..-5,z=-22..-13 -on x=-8..43,y=-6..41,z=-25..25 -off x=-17..0,y=28..47,z=19..34 -on x=-45..0,y=-44..6,z=-33..15 -on x=-7874..5506,y=-20379..-3039,z=59810..88971 -on x=-21433..-6261,y=-46900..-34324,z=50271..88746 -on x=38450..68609,y=-7656..11913,z=-72939..-50513 -on x=10810..32231,y=62915..80230,z=27306..45793 -on x=16240..33178,y=-69605..-65010,z=23182..41140 -on x=74585..88021,y=-33713..-11811,z=8878..14352 -on x=8952..26425,y=-5524..18862,z=-92382..-59599 -on x=-5011..17567,y=-62318..-50559,z=47882..72780 -on x=74303..97592,y=-15251..3184,z=-10887..11253 -on x=-71741..-56752,y=-14773..-2871,z=44590..48159 -on x=7145..26216,y=-73908..-47204,z=45148..72408 -on x=3353..11909,y=70884..90962,z=-42418..-30798 -on x=-86705..-60907,y=-13957..4192,z=-47576..-27852 -on x=45879..55901,y=-64766..-35760,z=-50770..-23619 -on x=43802..76492,y=43658..54364,z=-29093..-11590 -on x=10370..26860,y=45297..57854,z=38221..70721 -on x=-63998..-46603,y=-20267..-6000,z=-59847..-56863 -on x=-18630..18378,y=40771..60137,z=62275..69541 -on x=55671..80730,y=-27426..-12642,z=-60454..-41374 -on x=-34693..-14417,y=-79191..-69262,z=-26703..3282 -on x=-38261..-30043,y=-31904..-3317,z=60552..74101 -on x=-63295..-41017,y=-66142..-47664,z=17578..31398 -on x=-13577..1488,y=54526..61735,z=-65440..-38952 -on x=48354..70605,y=14703..31697,z=-65071..-40580 -on x=62691..92710,y=3173..42903,z=-27555..-15004 -on x=-34060..-14740,y=-80185..-57343,z=17703..26938 -on x=-88335..-73992,y=7675..23682,z=-29991..-17731 -on x=-64720..-47504,y=45814..72187,z=-26042..-1648 -on x=57030..64993,y=35410..49151,z=-13732..9894 -on x=-77291..-65322,y=-25591..-24178,z=26942..36225 -on x=-11274..13032,y=-60620..-45108,z=-82331..-52549 -on x=-88590..-60753,y=-7850..4911,z=23234..57969 -on x=26408..43629,y=49378..89017,z=5396..16841 -on x=69300..87125,y=-47624..-20717,z=-6957..27242 -on x=43326..53338,y=41342..68666,z=-29928..-8141 -on x=-69964..-57576,y=-44817..-7703,z=24558..49911 -on x=-5529..3405,y=-70486..-57793,z=38667..71794 -on x=72365..86627,y=-25567..-16003,z=-13583..-4327 -on x=9348..39319,y=-73553..-55808,z=-30116..-18951 -on x=20947..43924,y=68210..91134,z=-10996..26549 -on x=-80994..-60522,y=-17003..2655,z=-6840..18812 -on x=7928..33299,y=54071..62569,z=29146..61880 -on x=-73188..-48824,y=33993..63516,z=-25454..-8089 -on x=-82484..-65282,y=-9918..10639,z=20102..31437 -on x=53747..68021,y=-49346..-36316,z=-21310..-15842 -on x=-5298..6291,y=-56004..-49801,z=-59794..-43568 -on x=37703..55636,y=-48346..-37782,z=27178..43960 -on x=28973..48768,y=30630..54886,z=-48787..-38801 -on x=40085..42058,y=58803..86868,z=-7156..-3537 -on x=-5244..14514,y=-17017..4800,z=71648..82401 -on x=66637..87713,y=-28138..-11871,z=22841..29706 -on x=-73391..-56078,y=-42567..-24073,z=-34558..-8746 -on x=-46758..-10848,y=-37005..-29780,z=-83643..-48720 -on x=32265..48746,y=44256..70123,z=40711..65344 -on x=7095..34285,y=47014..76227,z=-58356..-43652 -on x=30778..34567,y=-75173..-60339,z=-50645..-26616 -on x=-95002..-66778,y=-6534..21540,z=9811..31414 -on x=-78525..-56832,y=-52209..-37537,z=-27987..-18272 -on x=34941..61589,y=-66061..-52884,z=16427..26746 -on x=26607..44757,y=56550..76152,z=9943..15669 -on x=65247..79688,y=-1198..18004,z=-38529..-28860 -on x=-39043..-33901,y=-41363..-15844,z=57226..73240 -on x=517..18030,y=72575..94894,z=-32607..-9450 -on x=-48138..-33957,y=-8725..23156,z=-74829..-64476 -on x=14674..40415,y=-10310..8599,z=55548..76889 -on x=5411..28795,y=39926..72819,z=43387..60574 -on x=-11735..1244,y=-81181..-73820,z=-28100..-4131 -on x=-94982..-74210,y=6396..18510,z=-2618..15316 -on x=-14012..-6314,y=-84572..-63156,z=31111..52228 -on x=-118..20059,y=34462..58751,z=-80546..-56745 -on x=-42424..-16763,y=-61392..-46124,z=40506..70305 -on x=-68200..-52902,y=-53715..-33370,z=500..10204 -on x=-78742..-74311,y=-749..26775,z=-17380..-1983 -on x=-45225..-18627,y=-10476..6301,z=71396..78161 -on x=-41962..-13258,y=5655..31861,z=48787..82853 -on x=-4287..23298,y=-39395..-12857,z=-89437..-61466 -on x=70684..81806,y=1617..22727,z=-9322..17632 -on x=60320..64982,y=-11794..2549,z=35758..64707 -on x=-50895..-17858,y=-34644..-9840,z=-85306..-64871 -on x=12118..28830,y=-73335..-43482,z=29166..45459 -on x=11184..43399,y=-84603..-53931,z=13762..37604 -on x=42155..53212,y=38257..63651,z=-39259..-31414 -on x=-80486..-58420,y=-37408..-30208,z=-27620..-6908 -on x=-12226..5972,y=-82320..-53208,z=30951..48037 -on x=-72814..-45894,y=-51715..-34510,z=-29165..-7498 -on x=4315..28593,y=-50405..-29388,z=-72958..-48216 -on x=7546..29936,y=-32734..-29248,z=-88518..-50920 -on x=26049..50278,y=-65601..-42011,z=-55923..-45671 -on x=-14665..5917,y=63952..90182,z=5320..26209 -on x=-64305..-32115,y=-67815..-54683,z=15642..41774 -on x=40402..72364,y=-48615..-32584,z=11970..43341 -on x=-36423..-21574,y=27425..31751,z=-86149..-56524 -on x=38326..62079,y=45689..52640,z=38903..56896 -on x=-18427..3353,y=6007..19691,z=-85062..-73139 -on x=-4191..20389,y=-47833..-14927,z=65632..75890 -on x=57372..78099,y=-2471..13074,z=50..19993 -on x=-30736..-13109,y=-67034..-52066,z=27271..58053 -on x=-71822..-41486,y=-69702..-55488,z=15902..29808 -on x=-31535..-20720,y=75586..92489,z=-26956..-1456 -on x=-80124..-61667,y=-47297..-19803,z=-2412..28939 -on x=-24308..1478,y=-79483..-76964,z=-34232..-15794 -on x=56194..75420,y=21437..47033,z=25529..49225 -on x=4079..40058,y=-24280..5057,z=65772..77187 -on x=-62180..-45533,y=-51608..-32908,z=30378..45483 -on x=-13480..28,y=-75291..-63119,z=16709..51335 -on x=58818..66910,y=-62369..-43633,z=8382..17832 -on x=-43387..-27774,y=28522..39561,z=45765..73429 -on x=-64923..-30680,y=-62106..-53157,z=28636..45166 -on x=54328..67007,y=-74271..-36618,z=-12995..3637 -on x=-77163..-45508,y=26641..51588,z=7513..28872 -on x=-87028..-61596,y=-23424..-6875,z=29267..57373 -on x=-32999..-2171,y=-51771..-28704,z=-80305..-51440 -on x=-1213..13360,y=62211..71724,z=-52865..-26389 -on x=-59595..-40976,y=608..38385,z=-67678..-39972 -on x=-51375..-40493,y=52834..78732,z=-32478..-20512 -on x=-59461..-51678,y=-57205..-51776,z=-18552..6908 -on x=-67103..-58469,y=2666..27721,z=-59857..-31316 -on x=-31553..-20945,y=-56604..-41792,z=46058..64858 -on x=-82863..-52103,y=1792..32261,z=13005..32987 -on x=-53436..-31839,y=31585..55069,z=50592..61674 -on x=41525..49552,y=-25674..-19103,z=52676..72349 -on x=65926..70611,y=-37803..-18555,z=20771..41361 -on x=64024..83956,y=-37756..-22888,z=21054..36415 -on x=41255..70996,y=-60030..-36048,z=12729..25474 -on x=40757..43045,y=34970..56717,z=-44253..-30030 -on x=-58784..-42274,y=-73761..-50142,z=11208..29144 -on x=-34430..-8005,y=57336..71214,z=18509..46142 -on x=224..27032,y=-40856..-23310,z=-73458..-63394 -on x=-94313..-58262,y=-36381..-23880,z=-12765..10563 -on x=-3922..21855,y=22784..35285,z=56549..82919 -on x=-25358..1966,y=-82528..-76828,z=-13146..-10953 -on x=34104..47312,y=44304..79133,z=-48368..-24337 -on x=39991..75751,y=-46352..-19595,z=44418..52968 -on x=-39306..-16416,y=-26164..-186,z=61105..74914 -on x=55569..75595,y=24301..43891,z=-47519..-35261 -on x=26093..41420,y=57621..71127,z=-51351..-25437 -on x=35996..57167,y=-64743..-46879,z=-1650..7206 -on x=-28855..-11320,y=76234..80807,z=2935..13504 -on x=-67054..-36441,y=-63873..-43786,z=-28254..8947 -on x=-14509..3328,y=-73695..-39712,z=-55836..-51258 -on x=68827..93867,y=3505..11168,z=18139..41193 -on x=-62902..-53742,y=-62316..-29660,z=20939..50463 -on x=-49675..-30208,y=45417..70955,z=-37743..-14049 -on x=46586..53764,y=-33379..-5171,z=-72062..-39028 -on x=-20911..-1427,y=49674..65860,z=-63296..-37531 -on x=-54985..-36111,y=37281..62377,z=30172..45519 -on x=-4397..18030,y=-84894..-61794,z=10830..21585 -on x=11750..38443,y=-82567..-66253,z=13438..29233 -on x=59514..67757,y=-51804..-35103,z=7019..24467 -on x=27432..50977,y=-42003..-30595,z=-63979..-42141 -on x=-15819..-5759,y=-61346..-42796,z=-54195..-34015 -on x=-76984..-52460,y=28797..64073,z=-7149..25332 -on x=-52158..-26040,y=11304..26896,z=-80266..-51382 -on x=-9558..1461,y=72523..94866,z=-43893..-23592 -on x=-66298..-44000,y=25979..47853,z=-53578..-42707 -on x=6988..18659,y=51164..69431,z=33837..57752 -on x=-38858..-13161,y=-56417..-38120,z=-69115..-48732 -on x=40312..77361,y=42382..59137,z=20671..36281 -on x=-37374..-16194,y=-6138..22213,z=57535..93920 -on x=4822..17630,y=-78489..-55730,z=31282..65954 -on x=-51269..-21808,y=51723..72289,z=31278..65239 -on x=67584..92800,y=-7980..-46,z=-37946..-5803 -on x=-11191..7756,y=50336..65372,z=60030..68673 -on x=-35391..-26531,y=6204..17520,z=61001..78026 -on x=-28728..1160,y=-84803..-59728,z=-54020..-32667 -on x=59337..65724,y=33773..45079,z=21264..50548 -on x=-64482..-40710,y=47616..59937,z=8139..31218 -on x=-16863..13681,y=-30676..-9757,z=-92073..-59935 -on x=-24997..-9374,y=17287..40966,z=-84648..-60166 -on x=-25337..-3767,y=-74787..-62296,z=-35829..-10718 -on x=63697..85710,y=953..32652,z=20768..32117 -on x=-44147..-19389,y=-60163..-35869,z=-83248..-50697 -on x=-57894..-53539,y=48553..53550,z=26409..38273 -on x=48679..55245,y=15109..50451,z=35152..65388 -on x=25604..62419,y=-20961..7848,z=-79350..-64190 -on x=-22084..-10836,y=12754..33323,z=-83535..-61512 -on x=21009..43671,y=-32733..-5575,z=65432..73204 -on x=-7178..29385,y=-48608..-17272,z=-80620..-69880 -on x=25772..50009,y=65383..86566,z=-32131..-5636 -on x=634..12760,y=52120..69063,z=48427..64000 -on x=-5534..7408,y=57575..74937,z=-38916..-22273 -on x=-32741..-17540,y=-40077..-31838,z=-76144..-56680 -on x=40310..65131,y=-47993..-25612,z=40235..71257 -on x=44408..77248,y=13423..34189,z=-53040..-34392 -on x=70803..96452,y=9302..24010,z=-11413..9911 -on x=15449..37539,y=48012..67955,z=46095..64173 -on x=7151..40444,y=-25065..6244,z=-91166..-75247 -on x=-90737..-75720,y=-5475..16668,z=4153..29576 -on x=-33261..-13080,y=55167..75616,z=24910..40299 -on x=-65599..-40401,y=-18178..-728,z=-78145..-51418 -on x=-58978..-34779,y=-59342..-42300,z=-191..21488 -on x=18497..38363,y=-21451..-14602,z=-92202..-55994 -on x=-73368..-42678,y=45965..58851,z=-35584..-25807 -on x=68712..81585,y=-27605..-8858,z=20493..44638 -on x=-49956..-15982,y=-34609..-16081,z=52125..71155 -on x=-72367..-47140,y=32980..52447,z=22136..36531 -on x=-41906..-21763,y=-60745..-33327,z=-74200..-40503 -on x=74281..82455,y=-24387..-3961,z=-20290..15753 -on x=-6850..14006,y=29406..50293,z=-79525..-70587 -on x=-19273..13527,y=32325..50356,z=-76866..-55145 -on x=-58958..-39262,y=-12206..10909,z=59320..69684 -off x=52775..62708,y=-22725..-18131,z=-64772..-51042 -off x=-7316..18889,y=-9236..18079,z=75734..84988 -off x=-68904..-56803,y=7963..21320,z=28299..44607 -off x=56738..81745,y=-33655..-19734,z=27734..54876 -off x=-26307..-4399,y=-90257..-66498,z=-8368..6190 -on x=-63424..-48935,y=51182..61255,z=-35303..-9366 -off x=-59497..-39391,y=-48595..-21538,z=-65637..-43222 -off x=10314..35649,y=5352..24478,z=66042..95448 -on x=66990..86515,y=-26082..-17705,z=-18769..-11276 -off x=37208..65114,y=-31814..-16425,z=50870..76166 -off x=-6163..11246,y=-77431..-59123,z=-61149..-39103 -off x=-65580..-57918,y=-42189..-20880,z=-49370..-41832 -off x=-68181..-47291,y=-43131..-24122,z=-52032..-39969 -on x=-28183..-20075,y=55733..67672,z=-45712..-26158 -off x=-20854..-3684,y=10595..33536,z=62130..75618 -on x=-1550..8093,y=64709..84232,z=-13210..4539 -on x=-14584..8934,y=-89926..-70898,z=10403..26190 -off x=-23968..-2269,y=55599..70257,z=46101..49355 -on x=63447..78212,y=-1665..5767,z=-49492..-33869 -on x=-76609..-63970,y=11730..33874,z=-31397..-933 -off x=-81830..-56014,y=-53112..-33489,z=1528..28062 -off x=-8280..-4015,y=47133..68418,z=-64354..-42733 -off x=48414..73285,y=-28088..-1338,z=48697..64341 -off x=38375..56868,y=-75954..-47951,z=-13590..9529 -on x=43124..69757,y=45938..57740,z=-28736..-4974 -on x=-9344..-3482,y=55482..85763,z=-39420..-38492 -on x=-43081..-29483,y=9548..30431,z=61108..88470 -on x=-37982..-17628,y=48715..75366,z=36941..48193 -off x=-8331..2546,y=-78987..-61305,z=-30626..-2011 -off x=-81700..-62256,y=-10742..6586,z=722..26440 -off x=-24912..-11729,y=-25032..-3413,z=-88232..-75563 -on x=58167..74001,y=15467..21830,z=-37657..-16140 -on x=9988..37527,y=-48291..-30477,z=54921..80713 -on x=62474..73375,y=-17054..1407,z=35366..53946 -off x=-83614..-64521,y=29149..33522,z=-38377..-14053 -off x=-53987..-32165,y=11117..19957,z=-75785..-68730 -on x=42103..70775,y=-73724..-54732,z=-5872..7872 -on x=20494..44429,y=11307..21039,z=-76857..-61050 -on x=-20646..11084,y=62264..88883,z=26886..41113 -off x=-88900..-69393,y=1605..20025,z=-36353..-23657 -off x=-5057..19004,y=63779..92275,z=-19254..13570 -on x=-57000..-34567,y=-71407..-61402,z=-25281..-23453 -on x=-3652..25227,y=-26409..-7375,z=-78623..-67258 -off x=53792..79784,y=-46089..-39765,z=8293..18162 -off x=-76199..-59669,y=-45245..-28456,z=-13993..15531 -off x=12995..45491,y=56914..91086,z=-30682..-5699 -off x=15637..32089,y=-59007..-37524,z=-75718..-52527 -off x=-73386..-49956,y=-39740..-16542,z=-69266..-46619 -off x=-19602..6141,y=-6868..8551,z=67012..92514 -on x=21642..48389,y=-64658..-42774,z=34948..63725 -on x=-20429..-2111,y=9416..26675,z=71825..81116 -off x=-2501..21349,y=49578..64417,z=51184..71703 -off x=46241..68960,y=-27030..3257,z=-60862..-44951 -on x=-27054..-11006,y=59976..79200,z=5931..18842 -on x=-24276..-2701,y=-66183..-52326,z=-49472..-34192 -off x=-68877..-53836,y=-28126..-15302,z=-46581..-34719 -off x=-73359..-34792,y=13665..36009,z=-56369..-46033 -on x=32103..49141,y=-79415..-57451,z=-40343..-18996 -on x=73069..82323,y=-9569..9367,z=-14857..7647 -off x=-56161..-38162,y=29352..48859,z=43169..72145 -on x=-66774..-55959,y=-65235..-30961,z=13584..33678 -off x=27548..45916,y=-26792..283,z=-75012..-66571 -on x=-80711..-66751,y=-29628..-15357,z=-41564..-15914 -off x=71552..81414,y=-7863..9193,z=-14213..10187 -on x=36611..56676,y=45719..53058,z=-57614..-36899 -off x=62768..88220,y=-49020..-30531,z=138..22494 -on x=15720..31386,y=-31469..-20942,z=-79951..-69439 -off x=20888..41231,y=-64104..-39191,z=-58681..-44918 -on x=64912..75468,y=22232..45193,z=-29893..2078 -on x=361..31325,y=63314..77907,z=-54330..-28730 -on x=-19404..15732,y=73142..90411,z=25581..35682 -on x=61748..71694,y=19771..38115,z=13843..22810 -on x=-6187..8381,y=-42494..-25695,z=-86533..-60639 -on x=63798..82990,y=-40381..-13733,z=4229..28270 -on x=-81663..-57842,y=-666..22557,z=-68350..-41120 -off x=-47003..-20315,y=-62845..-55753,z=-52267..-35229 -on x=-94464..-67322,y=-40490..-19348,z=-5254..10478 -off x=43705..67726,y=-24299..-700,z=-75234..-57148 -off x=-41646..-12552,y=-68007..-46831,z=-43270..-39325 -on x=8135..18536,y=43749..52328,z=52189..74451 -off x=12530..45202,y=42121..58623,z=-64757..-34726 -on x=-38525..-6498,y=-85547..-69786,z=-3153..19751 -off x=28152..47986,y=57588..66161,z=25607..39999 -on x=-81199..-63920,y=-10524..3660,z=-1797..9134 -on x=-25334..-13304,y=58421..89837,z=-32681..-21215 -on x=-73427..-47035,y=26359..48721,z=-8616..13879 -on x=-35010..-13996,y=11972..23992,z=-91842..-56559 -off x=61555..72930,y=15378..28117,z=-45130..-33545 -on x=-76375..-71158,y=25706..30056,z=-5494..385 -off x=-32602..-6222,y=-79216..-72287,z=-9505..12380 -off x=-88346..-67085,y=-14944..7502,z=-27154..-10379 -off x=-31807..-5298,y=65364..79818,z=29230..47308 -on x=-57443..-23960,y=59901..70861,z=12729..28027 -off x=13199..37843,y=67820..79799,z=-5787..6066 -on x=-54982..-33556,y=56857..84194,z=-5511..17250 -on x=22920..41679,y=4390..24163,z=58350..76766 -on x=-59743..-28439,y=-84006..-54986,z=-7949..14308 -on x=61639..80928,y=16361..30223,z=2020..26391 -off x=-10984..10732,y=-89468..-59751,z=9884..41102 -off x=-79212..-64694,y=14128..32527,z=28460..47157 -off x=64235..86210,y=-42383..-17290,z=-28514..-12861 -off x=-1388..7043,y=61942..90427,z=-20381..-12457 -off x=63544..80468,y=-37417..-9915,z=36144..49273 -off x=-35734..-19033,y=53057..72367,z=-60953..-41489 -on x=35159..48100,y=-76380..-55607,z=-2127..3715 -on x=-75962..-58571,y=-54185..-42931,z=-7049..26522 -off x=40155..77172,y=-42052..-32487,z=37159..57286 -off x=28393..39783,y=-358..22551,z=-75711..-64727 -off x=-49182..-19539,y=-19313..11789,z=51776..88876 -off x=6323..22117,y=-66212..-50296,z=34106..55484 -off x=26923..57572,y=-84808..-57461,z=8216..22262 -off x=-55268..-27345,y=-34331..-26689,z=-66095..-50926 -off x=-16773..7149,y=40517..69874,z=57767..64060 -on x=-7644..5711,y=57323..80843,z=-46902..-23267 -on x=12990..46040,y=-85031..-65525,z=-14638..2525 -on x=36838..61816,y=43624..45798,z=-56805..-30128 -off x=-16625..-13438,y=15198..26225,z=56760..89970 -off x=-47586..-8125,y=38595..61503,z=-79954..-54733 -on x=68425..94332,y=-23770..-10888,z=-15853..-1516 -off x=45879..72720,y=10249..22803,z=31170..65673 -off x=-66838..-47717,y=22029..54053,z=17894..34996 -on x=-27131..-15091,y=-72018..-41671,z=-69529..-45135 -off x=49858..81214,y=-40371..-32977,z=12446..29253 -on x=-49045..-40498,y=35803..50496,z=-54698..-45453 -on x=37056..66261,y=-37677..-19546,z=49803..65703 -off x=-28190..-3348,y=-73123..-58301,z=30508..41418 -off x=-78271..-57241,y=-18397..11460,z=-41270..-21406 -off x=48500..57434,y=-15736..22263,z=55834..67267 -on x=-94862..-73351,y=-7423..9149,z=-27569..1987 -on x=43486..56652,y=39047..56815,z=17045..40948 -off x=-2337..16612,y=42633..69610,z=45684..73188 -on x=21127..49270,y=-30808..-25029,z=-81791..-62703 -on x=-30891..-21855,y=-28949..184,z=69030..89093 -on x=44543..50914,y=20954..34529,z=-70573..-46226 -on x=5780..19766,y=50550..70469,z=-48331..-34703 -off x=56501..93443,y=-4621..18563,z=11287..38665 -on x=42327..58505,y=-70210..-42337,z=-35047..-1223 -off x=18423..36939,y=-8454..6658,z=-91865..-58242 -off x=58609..79717,y=34512..43834,z=19543..51200 -on x=30744..40798,y=43451..74091,z=21225..50983 -off x=-16052..-514,y=-28879..585,z=67792..93741 -off x=-5109..4752,y=56092..80738,z=-56908..-27027 -on x=-91998..-65044,y=-497..38054,z=-22159..-5072 -off x=67089..80512,y=11116..39389,z=24842..41259 -off x=17874..33524,y=47720..80311,z=-53378..-23314 -on x=11894..29924,y=-80907..-60120,z=22583..34522 -off x=26908..30896,y=-78232..-56487,z=3888..26400 -on x=43517..74781,y=32409..38655,z=38475..57762 -on x=-33512..-10912,y=39239..68119,z=50194..76546 -on x=-31556..-23733,y=55040..76570,z=34651..56813 -on x=59734..87601,y=-46068..-27321,z=13508..43534 -off x=-28179..-2124,y=25183..50241,z=58671..87869 -on x=-69791..-45293,y=-74163..-44289,z=-17713..4452 -on x=-17404..695,y=45309..60367,z=-58557..-48788 -on x=-21736..-18077,y=68659..70975,z=21432..48567 -on x=23875..54273,y=-75359..-45864,z=-54931..-27989 -on x=-35409..-24375,y=-82394..-43946,z=31058..42523 -on x=-8343..13717,y=31327..58902,z=55577..83325 -off x=-48926..-32870,y=42263..59054,z=41809..53373 -off x=48808..87204,y=-57303..-27371,z=-32342..-7317 -on x=-67008..-39098,y=-51403..-26899,z=-54475..-39811 -on x=6581..35901,y=-85829..-56275,z=-41133..-19639 -off x=-88954..-64372,y=20411..33836,z=3213..34345 -on x=-7765..15787,y=59696..72865,z=46260..65892 -on x=-41030..-16419,y=72963..77043,z=793..25599 -on x=-34743..-14557,y=-71490..-52461,z=16977..35464 -on x=52820..76139,y=-16895..8754,z=-67504..-46523 -on x=26561..43699,y=35122..47583,z=-69853..-60751 -off x=53935..80807,y=-50668..-40940,z=-9088..11134 -on x=-9256..18245,y=-82833..-74237,z=-8555..9806 -off x=-54561..-36968,y=-16270..15979,z=49514..84021 -off x=-71537..-60947,y=-34759..-10335,z=16287..34069 -on x=62156..92714,y=71..22995,z=-2786..24138 -off x=-93224..-70481,y=-17263..-11214,z=-8572..14568 -off x=27687..38549,y=66418..78828,z=-26765..-1993 -off x=6373..44479,y=-20716..411,z=56296..85091 -off x=-10240..9238,y=76954..86558,z=-20574..-9567 -on x=59824..81660,y=42481..53777,z=12226..39439 -on x=10464..38714,y=-66090..-35600,z=-63269..-48994 -off x=10086..26680,y=-67885..-33884,z=-73115..-35932 -on x=46274..62715,y=-21783..14328,z=-66177..-46199 -on x=-45939..-26665,y=606..21920,z=47479..84070 -off x=67911..87660,y=-19150..18476,z=-7232..16762 -off x=-62714..-52605,y=-63367..-33979,z=-48407..-23827 -on x=55656..77456,y=-1928..20756,z=-59425..-29123 -on x=22311..52656,y=56599..78053,z=-8060..16138 -on x=-90012..-72349,y=-25411..-2567,z=-18968..1095 -off x=-75165..-59317,y=-35674..-8599,z=-42017..-25631 -on x=74039..92478,y=-4796..7717,z=-23856..-14498 -on x=37389..46931,y=50038..78098,z=-9817..5995 -off x=29297..54007,y=54429..66539,z=3163..26930 -on x=16320..36328,y=54585..75579,z=-30097..-3297 -on x=6120..22699,y=63678..70653,z=38784..45811 -on x=23070..32721,y=-41792..-30954,z=-66040..-45827 -off x=20355..29767,y=66334..89377,z=-28998..4344 -off x=5478..21486,y=-25991..5188,z=62514..90823 -off x=59573..72444,y=39402..64676,z=-17460..-4643 -on x=13708..27225,y=-57113..-21835,z=57734..67702 -on x=-67885..-35556,y=28851..63688,z=-56125..-21746 \ No newline at end of file + ...........#....#.........##............###.......#..............#..........#.#......#.............. + .................##.....#.#.........#..........#.....#....#..........#.....#.....#............#..... + .....#.........................................###.#........##..................#................... + .#......#..............................................#.........#..#....#.#.....#........#.#......# + ..........#.....#..#..#.#.....#..........................................#.....#........#....##..#.. + #..................#........#..............#.......#.#..............#....#...............#.#...#.... + .#......#...............##..........#.............##.##.....#..#.......................#.......#.... + ...#...#....................#..#......#.....#.......#.....#...........#....#......#.........##...... + ...........#.#.........#...............#.#.......................#...#...#.#....................#... + .....##......##...#.............#.....#....#....#......#..............................#............. + ...................#..#..#.#...#.#....##.##..........##.........................#.#...............#. + .......##..................................#......................##.#..#.#......#.................. + ..................#...........................#.....#.......#...............#...........#........... + ..#.............#..........#......................................#...................#.......#...#. + #...##......#........................#...#.............#..........#..#.#.......#.........#.......... + ...#.......##.....##..#..#.................#..........#...........#.....#.........#................. + .............#..#............#............#.................#..........##.....................##.... + ..........#......##.......#........#...........#..........#....................#........#........... + ....#....................................#........##......................#......................... + ...#....................#........#...................#......#...#..............#......#..........#.. + ...............#.......#....................#...#..................#.#.....###.........#............ + .......#...#...#...........#...#...#..............#..........#...#.......#........#....#..#.......#. + ................#..........#.....................#................#...........#.....#.............#. + ..#......#.........#.#....##......##......#.....#...............#......#.....#..#........#.......... + .....#....................#.##........#.......#.#........#...#....................#.........#..#...# + .......#........#...........#.#...#.#.#.......................................#.......#...#....#.... + .........#.....#...................###...........#......#..#....................#....#.............. + .......#..#....#................#......##...#..#............#.............#.......#................. + #..##.#.....#.#....#..#...#..............###............#.................#......#.............#..#. + .........#..................##..#...........#.................................#.....##.............# + ...........#.#.....#..........#.....#.......##.....#.........#..........#..#................#...#.#. + .#.......#..##.....#....#......#...............#............##.............#.........#.............. + .##.......#......#....................#......##...#............#....#......#.............#.......... + .#...............#.#.............#.##........#.....#....##.......#...........#..#................... + ...........#.......#..........#...#..........................#......##.#.............#.............. + ............#....#.....................#...#......#....#..#....................................#.... + ........#......................................##.......#.............#.........#..................# + ........#........#................#...........#.............#........#.................#.......#.... + ......#...........................#.........#...............................#.#.#.............#..... + ##....#...#........#..#.....#....#.....#...#...................................#.#........#....#.... + .........#....#....#...........#...#...#.............##......................#..........#....###.... + .....................#.......#..#........#...##................#.........##.#.#..#........#......... + ........#...#.................................#....#.#...##.....#..##...#.....................#..... + ....................#..##........................................#...........#.#.........##...#..... + ..........#......##............#......................#.....#.....#...................##............ + ........#.#....#..#.#..#.......#..................#........#.............#.......#...##.#.#......... + ........................#.........................#...#.....#.................#....#.............#.. + ......#....................................#..........#................#....#............#.......... + .#........#........................#........#....#...........................#........#.....##.....# + .........#.....#..#.......###..#....#.................#..........#............#................#.... + ....##....#....................#......#..#.......# + ..........#.#.....#...#..##....................#.. + .......#..#........#...........#.................# + .........................#..........#............. + ....#.....##....#.........#.............#.....#.#. + .#........#........#...................#......#... + .......................#.#........................ + ............#..................................... + .#......#....#....#..#.........................#.. + #......#........#.......##.#...................... + .......#....#....#.......#..#..................... + .......#....#......#....................#...#..#.. + ..............#.#...........#............#.##....# + ....................#..................#...#.....# + ...................#.#............................ + .#...........................#.....#...#....#..... + #..........#.........#......#..#......#..........# + ....#.....#...............................#....#.. + ..#....#..#.#.......#....#.#....#................# + ......#........#...#.....#........#...#.....#..... + ....#...........#.......#.....##......#......#.... + ...#..##......#................................... + ...#...................#....#........#.#...#...... + .....#.............##...................#.....#... + ....#..#.#....#........#........#................# + ............#....#...........#..###.#.........#... + #.........#...............#..................#..#. + .#.........#.................#...........#........ + ..##....#......#......#.....................#...#. + .#...#......##...........................#.....#.. + .........................#....................#... + ................#......#.#...................#.... + ...........#.............#........................ + ...............#.......................#.......... + .................................................. + ....#...###.#.........#.#...........#..#.#...#.#.. + ....................#........#...#.##....#........ + ..............#..........#....#..#.............#.. + ....................#..............#.............. + .....#..............................#...........#. + ...........#......................#....#.......#.. + ..#.........#...#..#.....#.........#.#............ + ..........#....#.....................#............ + #.......#......#...............##........#....#... + ..................................#..........#.... + #...#..........#..........##...#...#.............. + ..............#............................#...... + .................#......#........##.....#...#.#... + ..##.........#......................#............. + ..#.............##................................ +............................................##.........................#..........##................ +....#...................#....#........#...#.........#...##...#.....#.#.....#.........#......#....... +...#..........................#.............#....................##.#...........#.#.#.#....#.......# +.#...........#.........#.........#.#.#..................................................#........... +................#..#...#............#................#...........#.....#....#............#.......... +...........................#..............................#...............................#...##..#. +#.#.#..#............................#.........#.........#............#.......#.............#.#.....# +#.........#..................#......#...##...#.......................#...................#.......... +.#.#................#..........#.....#......#.....#.................................#.............#. +........................................................#....................##...........#.....#... +.................#..................#.............................................................#. +......#...#.......#..#.........#....##.....#........#..........#....#....................#.#........ +.....#...........#...#..........#..........#..#.................#...#...#...#..#.....#....#......... +.#........#...................#...##....#..#.##.......#.........#.......#........................... +.......#.#........#....#......#..........................#.......#....#......#...#.#................ +...#...#.#.#.....#.......................#........#...#.#...##...#...#.............#.#.............. +...#..........#..........#...................#..................#........#....#.....#..#....#.....## +....##.................................#..............#.....#..#......#........................#.... +..#.#.......................................#.......................................#............... +.#......#......................#...........#.............................#........###..#............ +.........#......................#....#..............................#............................... +....#......#....................#..........#........................................................ +.......#....................##...#..#.##..#.#..#...............#.......#.#............#.....#....... +.............#.............#..#.#..#..............#......#....................#.........#.....#..... +...........#.....#.#.......................##.............#........#......#......................... +..........#...........##.#..............#.........#..........#..#......................#............ +..............................#....#.....#.#....#...#............#.............#.......#............ +.......#......#.......#.........##......#...............#..............#.........#......#........#.. +...........#............##..#..#......#..........................#..#...........#................... +....#...........................#.........#.#..............#.#...#......#........#.........#........ +..............#..............................#..............#.#......................#......##...... +#...............#..............#....#.....................#.............#....#...................... +.#........#..........##...................#..............#....#......................##..#.......... +......#...#......#.......##....#.........#.......#.#...........#...................#.#.......#...... +....................................##.....#...........#.......#....#...#..............#............ +............................###...........#............#....#...##.#.....................#.#.#...... +..#.......##....#.........#.....#..........##..#.............##....#.#...##.....#....#.......#...... +........#..#.........#...##....#..................#.#...##...............#.......................... +.#...............................#....#.##.#...........##...#......................#............#... +..#.....#...........#......................................##........#.#......#...#..#...........#.. +........#...........#.....#.........#....#..#.............#......#.........#.#..#..#................ +....#.##........#..##..#.#............#........#....#....#...........#.#............................ +.............#................#.....................#.......................#...........#......#.... +....#.#......#...............#..............................................#........#.......##..... +.......#..................................#..................................#..#................... +........#...................##.....#.#.......#......##.............#........#..................#.... +.........#..##.......#.#.....#........##............#.......##.............#.......#....#........... +..#..........##...............#.................##...#......................#..............#.......# +......#.......#.............##.......#........#..#..........#....#...#..#.....#....#................ +.........#..#............................#......................#..............................#.#.. +.......#..#.....................##.##............. +...#..............#.......................#.#...#. +....##................#.....#..................#.. +.#....................................#......#...# +......#............#........#.#..........#........ +..........................#...........#........... +.........#...#..........#......................#.. +......#..##.#.....#.#.........#......#............ +.......#................##.........#............#. +....#.....##.....#....#..........................# +.......#.....#........................#..........# +.........#.##...#..............##.#.....##.....#.. +......#.......#.................#...............#. +.....#..##.............#...........#.#..#....#.... +..#............#..#.....#.#..................#.... +......#.........#..................#.............. +...........#.#...........................#..#.#... +..#......................#......#................. +..#............#.......#....#..................... +......#..#.........#......#...................#... +....#..............#......................##...... +.......#..........................#..............# +...........##.............#.........#............. +.#..............#........#....#......#........#... +.................#........#...#................... +.......................#.#.......#................ +............#.#.#.........................#.#..... +#........#..#........#..#.......#.....#.....#.#... +......#..........#....#.#..........#...#.....#.... +.....#.....#........#......#........#...#.....#.#. +....#....#.....#...#.............#...###......##.. +.......#...............................#.......... +.##.....#..................#.#........###......... +.......#....#.#.......#.#..........#.........#.#.. +#..#....#...............#......#...##......#...... +...........................#................#..... +..#...................#.........#................. +.#...#..................#......#.................. +..............#.......#.....................#..... +...#..........##.....#........#.#................. +....#.....#....#.....#.........................##. +.................#.#....#............#............ +..............#..............#...#....#.........#. +..#...#..........#..............................#. +..................#.................#...#......... +.........#.......................................# +.....#.........#.................................. +..#.......#............#....#..................... +..................................##...#.....#.... +...#.........................#................#... + +46R13L28L19R29L38L28R34L43R23R20L14R40L42L3L14L42L25R22R47R4L40R49R6R41R29R19L49L50R35R33R24R26R20L14L21R21R33L2R40L8R32R12L17R12R39L17R41R39R49R44R32L36R7R22L40R43R16L25R7L43L6R37R23R14L40R23L26R49R20R33R33L15L5R36L19L47L13R41R45L24L37R42R26L2L14L42R18R34L16L26L22R46R11R15R46R24R16R11R20L45L2R7R23L32R30L15R33L30R5R22R13R29R32R5L38L36L50R37R21R40L24R24R46R17L40R3L28L46L31L50R47L7L23L16L13R32R22L34L1L24R24L41L45L37R48L6L36R6R32R2R4L10R44R10L40R46L46L45L28R32R18L42R19L8R46L8R14R5L38L26R8L50L39R38R24L27L28L17L22L13R48L3L19R29L4R7R46R30R38R25R49R36L28R39L46R48R9R48L26R31R49L20L15L22R27R4R50L21L28R39R11L13R8L48R46L7R38R31L27L26R38L14R33R29R14L25R24L32R24R41L27L19L24R8L48L49R35R29L29L4L48L42R30L43R10L10L47L14L25R3L13R50L50L27R7R15L28L17L37R2L4L19R25R3L30L16L7R49L4L19R36L48L39L16R26L14R16R27L22R40R49R38L14L50R37R45R46L19R22L23L25R36L47L36R27R9R44L41R31R23R9R24L30L4R15R39L34R10L44L1L29R13R7L32L44R41R20R42R50R31L25R10R3R8R31L34L17R23R19L7R28R45R3R23L36L2R26R7R13L13R23R18L24L26L47L23R5R45L30L40R32L15L22L47R10L12L23L13L46R32L30R20R21R12R38L26R41R19L1L18L43L25R3R26R4R34L4L7R39L50R28R7L17L27R49L41L5R44L4L19L36R23L12L49R49R8R30L42R50L3L49L33R28L11L36R30R21L7L7L20L38R29R35R35L6L6R50R8L32L4L45R40L46L42R30R9R36L30R2L3R4R17L19L36L22R7R17R45R49L1R45L34R17R24R26L18R1L14R1R35R48R50L13L21R1L21R43L15R24R23L33L2R12R36L30R15R9L28L36R10L23L33R48R9L2R37R36L49L42L44L37R19R15R29L25L32L33R14R47R43R9L38R19R48R48R17L9L3L1L7L40L24L36R31R25L16R27R40R29R30R12L48R50L16L48R6R18R9R35R47R18R3L4L37L48R25R2R24R39L28L46R29L17R34R45L33R23R16L48L46L26L37R42R12R44R45L29R12L38L49L24L28L27R28L1R25R38R25R7R18R28R32L45L38R31L43R50L9R41L3L14R36L2R10R44R9L11R15R40R8L32R25L24L21R8L28L4R34R33R33R13R10L31L48L40R4R28L21L21R43L10L14L7L7R41L41R45L5L5L6R45R5R10L5R5R36L49R45L19R29R23R27L35R24L40R41R10R49L50R44R1L20R34L43L34R28R2R38R38L28R45L18L48R47R14L39R35R25L35R33R12L15L9L47L10R28R38R10L23L41L11L26R16R35L46L26L49R14L4R41R46R6L15R28R4R15L6R11R50R46L14R46L26R18L47L18R15R19L6R4R14L50L41R32R43L15R25R33L16R48L14R8L46L9L41L15R46R32L10R46R29R35L14R35L9L21R46L42R50L32R7R3L15R7L37L42L47R42L22R26R2R36L9L8L6L10L17R42L28L36L22R35L35L46R34L14L9L16L30L46L29L48R18L3R50L42R27R29R29L1L7R25L26L9L41L30R41L8L7L6R23R18L34L20L23L45L38L30R27L13L10L47R41R24L38L26L44L19L49R6L37L32R18L42R14R43L17L4L19R7L45R42R39L18R18L46L50R29L20R7R38L25L25R33L17R37R45L30L45L43R43L25R34R5L32L22L32R41L45R32L40L13R11R1L46R34R18L16R8L43R21L41L18L46L41L46L10L28L27R40R6R26R1R48R37R40R42R4R16L30L38L35L23R49L10L30R16R48R14R21R12R22L23L14L36L9R11L37R44R26L17L37R31R13L32R27R13R9R1R33L21R13R33L10L9R16L17R21R25L8R41L21R8R38R37R21R14L46L2L29L15L19R49L14L33R30L42L43R38R37R23R49R36L45L23R2R19R35R39R21R15R27L24L45L34L12R22L5R39R14R29L45R15R44R15L39L5R30R26R14L20L23L3R23L6L9R49L33L32R39L27R1R26L43L25L3R50R38R4L7R45R37R11R46R9R45R1R33R3L18R14R11L33R17R45L21L18R16R6R2L27R34R16L43R31L43L49R10L33L21R13R31L9L50L25R32L35R31R13R15L43R20R42R37R17L14L3R15L48L7R11R40L26L17L16R38L38R46L20R19R24R25L30L17R1L19R36L7L5L10R41L48L6L35L30R20L33L11R39L23L27R28R36R30L11L11L21L42L10R2L12R21R49L35R48L30R4L12L32L6R27R22R13R10R15L30L18R19L40L27R34R43R12L5R50R44L49R15L26R48R34L2R47L9L46L31L46R7L44R41R27L33R38L46L27R23L10L12L23R38L29R27L22R18L22R47L24L32L31L6R15R26R17L50R1R45R6R27R25L24R35L11L18L13L44L15L36R37L50L6R2L10L18L20L31R49R38L46R2R34R21R14R2R13L35L1R31L2R27R18L1L16L28L32L13R8R32L41L3L42R20L43R30R34R11R13L36R31R15R50L27L2L19L7R37L26R47L4R5L10R28L40L24L22R35L48L18R40L34L6L12R26L49R20R42L36R27L32L27R42L3R46L42L27R35R32L30R35R25R16L48L18L32L49L45R25R5R23R36L32R13R16R44L9L48L10L32L29R26L46R36L3L37L50R37L40R32R29L33L42R41L25L4R14L2R5L3R24R21R43R27L11R4L11R17L30L49L45L23L1L13R16L34L43R33L19L27L16L21R50R32R35R18L30L6R16L47L20R22R2R48R27L38R21R22R49R38R49L21R9R41R49L45R49R29L35R50R20R24L49L25L42R5L43L48R46R9L18R40L24L27L18R9R7L36L47R33R42L14R20R36R35R8L40R3R13L39L38R17L7R36R27L8L44L45R9R16L9R40R50L43R34R9R6R7R14L8R8R30L7L31L9L2R30R44R24R27R22R15L50L15R24L20L36L9L44L41R24R41L50L1L3L50R45L16L37L26L27R24R8R36R36R41L44L11R47L30R18L16R27R39R32R26R3R4L14R44R4R22R25R28L32L48L16R39R27L1L42L28L38L12R47R2L17R13L11R47L31L38R43L34R20L24L36R50R41R12L20R19R40L13L3L31R44L19R21L41L38L30R4R27R31R46R1R32L29R49L24L4R21R22R34R34R5R33R49R21L28L15L18L4R18L10L27R31L15R32L8L15R46R7L6R15R14R41R12R10R43L7L2L24L15R20R3L43R26R6R1L1R43L30L24R25R17R7R25L28R36L48L45L43R20R8L41L7L25R21R32L1L36L43L9L38L3R17R21R9L12R7R33R21R10R42R12L7R44L46L36L38L42R35L16L30L24L32R42L45L43L41L49R49R18R10R7R26L6R26L11R11L29L21R26R50R19L34R34R47R22R20R14R10L14L11R20L20L34R8L14L16R14L24R3L5L24L22R25L39R28L28L49L30L5L27L50R14R8R31L6L31L36R46R3R6R36R32R30L30R9L22R40R32L40R9L31R50L15R30L31L33L27R23R36L38R1R24R14R35L5R6L49R23R38L45L20R34R20R7L18L33L27R47L38R22L29R19R16L47R42L13L28L8R39R44L24L39L14L26R41L26R40R47R49L22L24L39L6L5R39L17R40L19R37L47L40L40L11R29R3L43R25L26L7L27R24L41R11L34L23L12R43R7R8R39L29L16L11L8R28L48L27R49R36R6L21L36L29L27R7R7R25L40L42R17L8L28R18R14R43R41L16R45L20L27L8R6L28R15R39R11L8L33L37L44L38L19R13R47L34R49L27L12L41L24R33L48R2L10L48R20L33R30R12L3L15L50R33R21R1R33R25L14R2L12L15R4R48L35R44L24L2L30R12L7R38R15R13R41R33R30L12R38R42R21R12R18L30R4L28L20L22L43L38R42L2L24L37L15L20R32R34R14L14L16R4L33L47R16L49R24L17R10L23L44R17R44R47R33R12L43L10L33R8R38L30R29R42R4L2L31R10R10L8R34R28L38L16R48R17R39L2R45L11R9R9L7R1R9L3R16R42L20R1R31L1L4L34L44L20L17R46R20L37R11L17R38R27R44L27L24R5R34L28L50L38L4R32R33R46R43L46R42L44R24R21R29L13R15R19R21L34R40L13L23L7L22R29L5R31L38L25L10L29R30L43R22R31R38R14R40L44L39L19L33L5R28L45R4R32R24L18L4R27L19L43L26R47L17R24R39L24L40L27L9L30L49L1R30L35L25L35L29L21L10R43R13R3R3R26R30L46L33L3L4L49R34R14L42L7R31R10R26R40L1R3R11R1L19L32R45L23L27L28R26R39L19L41L26L2R37R20R16L24R18L40R19R27R20R8L12R17R36L42L12L14R33R10R46L22L5L49 \ No newline at end of file diff --git a/inputs/22a.txt b/inputs/22a.txt new file mode 100644 index 0000000..7e25d99 --- /dev/null +++ b/inputs/22a.txt @@ -0,0 +1,14 @@ + ...# + .#.. + #... + .... +...#.......# +........#... +..#....#.... +..........#. + ...#.... + .....#.. + .#...... + ......#. + +10R5L5R10L4R5L5 \ No newline at end of file diff --git a/src/22.cs b/src/22.cs new file mode 100644 index 0000000..f8c537c --- /dev/null +++ b/src/22.cs @@ -0,0 +1,605 @@ +using System.Text; +using aoc2022.Util; + +namespace aoc2022; + +internal static class Day22Extensions +{ + public static int firstIndexOfTile(this Day22.tileType[] arr, Day22.tileType t) + { + for (int i = 0; i < arr.Length; i++) + { + if (arr[i] == t) + { + return i; + } + } + + return -1; + } + + public static int getLastNonEmptyTile(this Day22.tileType[] arr) + { + for (int i = arr.Length - 1; i >= 0; i--) + { + if (arr[i] != Day22.tileType.empty) + { + return i; + } + } + + throw new Exception("no non-empty tiles in list"); + } + + public static int getFirstNonEmptyTile(this Day22.tileType[] arr) + { + for (int i = 0; i < arr.Length; i++) + { + if (arr[i] != Day22.tileType.empty) + { + return i; + } + } + + throw new Exception("no non-empty tiles in list"); + } + + public static int getLastNonEmptyTile(this Day22.tileType[][] arr, int col) + { + for (int i = arr.Length - 1; i >= 0; i--) + { + if (arr[i][col] != Day22.tileType.empty) + { + return i; + } + } + + throw new Exception("no non-empty tiles in list"); + } + + public static int getFirstNonEmptyTile(this Day22.tileType[][] arr, int col) + { + for (int i = 0; i < arr.Length; i++) + { + if (arr[i][col] != Day22.tileType.empty) + { + return i; + } + } + + throw new Exception("no non-empty tiles in list"); + } + + // for sample data + // private static readonly Dictionary<(int region, ivec2 facing), (int region, ivec2 facing)> cubeMap = new() + // { + // {(1, ivec2.LEFT), (3, ivec2.DOWN)}, + // {(1, ivec2.UP), (2, ivec2.DOWN)}, + // {(1, ivec2.RIGHT), (6, ivec2.LEFT)}, + // {(2, ivec2.LEFT), (6, ivec2.UP)}, + // {(2, ivec2.UP), (1, ivec2.DOWN)}, + // {(2, ivec2.DOWN), (5, ivec2.UP)}, + // {(3, ivec2.UP), (1, ivec2.RIGHT)}, + // {(3, ivec2.DOWN), (5, ivec2.RIGHT)}, + // {(4, ivec2.RIGHT), (6, ivec2.DOWN)}, + // {(5, ivec2.LEFT), (3, ivec2.UP)}, + // {(5, ivec2.DOWN), (2, ivec2.UP)}, + // {(6, ivec2.UP), (4, ivec2.LEFT)}, + // {(6, ivec2.RIGHT), (1, ivec2.LEFT)}, + // {(6, ivec2.DOWN), (2, ivec2.RIGHT)}, + // }; + // for my data + private static readonly Dictionary<(int region, ivec2 facing), (int region, ivec2 facing)> cubeMap = new() + { + {(1, ivec2.LEFT), (4, ivec2.RIGHT)}, + {(1, ivec2.UP), (6, ivec2.RIGHT)}, + {(2, ivec2.DOWN), (3, ivec2.LEFT)}, + {(2, ivec2.RIGHT), (5, ivec2.LEFT)}, + {(2, ivec2.UP), (6, ivec2.UP)}, + {(3, ivec2.RIGHT), (2, ivec2.UP)}, + {(3, ivec2.LEFT), (4, ivec2.DOWN)}, + {(4, ivec2.LEFT), (1, ivec2.RIGHT)}, + {(4, ivec2.UP), (3, ivec2.RIGHT)}, + {(5, ivec2.RIGHT), (2, ivec2.LEFT)}, + {(5, ivec2.DOWN), (6, ivec2.LEFT)}, + {(6, ivec2.LEFT), (1, ivec2.DOWN)}, + {(6, ivec2.DOWN), (2, ivec2.DOWN)}, + {(6, ivec2.RIGHT), (5, ivec2.UP)}, + }; + + private static ivec2 translatePoint(ivec2 currPos, int prevRegion, int region, int widthPerRegion) + { + long row = 0; + long col = 0; + + // for sample data + // if (prevRegion == 1) + // { + // if (region == 3) + // { + // col = currPos.y - widthPerRegion; + // row = widthPerRegion; + // } + // else if (region == 2) + // { + // col = widthPerRegion - (currPos.x - (widthPerRegion * 2)) - 1; + // row = widthPerRegion; + // } + // else if (region == 6) + // { + // row = (widthPerRegion - currPos.y) + (widthPerRegion * 2) - 1; + // col = currPos.x + widthPerRegion; + // } + // } + // else if (prevRegion == 2) + // { + // if (region == 1) + // { + // col = (widthPerRegion - 1 - currPos.x) + (widthPerRegion * 2); + // row = 0; + // } + // else if (region == 5) + // { + // col = (widthPerRegion - 1 - currPos.x) + (widthPerRegion * 2); + // row = (widthPerRegion * 3) - 1; + // } + // else if (region == 6) + // { + // col = ((widthPerRegion * 2) - 1 - currPos.y) + (widthPerRegion * 3); + // row = (widthPerRegion * 3) - 1; + // } + // } + // else if (prevRegion == 3) + // { + // if (region == 1) + // { + // row = currPos.x - widthPerRegion; + // col = widthPerRegion * 2; + // } + // else if (region == 5) + // { + // col = widthPerRegion * 3; + // row = (widthPerRegion * 2) - currPos.x + (widthPerRegion * 3) - 1; + // } + // } + // else if (prevRegion == 4) + // { + // if (region == 6) + // { + // row = widthPerRegion * 2; + // col = (widthPerRegion * 2) - currPos.y + (widthPerRegion * 3) - 1; + // } + // } + // else if (prevRegion == 5) + // { + // if (region == 3) + // { + // row = (widthPerRegion * 2) - 1; + // col = ((widthPerRegion * 3) - currPos.y) + widthPerRegion; + // } + // else if (region == 2) + // { + // row = (widthPerRegion * 2) - 1; + // col = (widthPerRegion * 3) - currPos.x - 1; + // } + // } + // else if (prevRegion == 6) + // { + // if (region == 1) + // { + // col = (widthPerRegion * 3) - 1; + // row = (widthPerRegion * 3) - currPos.y; + // } + // else if (region == 2) + // { + // col = 0; + // row = ((widthPerRegion * 4) - currPos.x) + widthPerRegion; + // } + // else if (region == 4) + // { + // col = (widthPerRegion * 3) - 1; + // row = ((widthPerRegion * 4) - currPos.x) + widthPerRegion; + // } + // } + // for my input + if (currPos.x >= widthPerRegion || currPos.y >= widthPerRegion) + { + currPos = new ivec2(currPos.x % widthPerRegion, currPos.y % widthPerRegion); + } + + if (prevRegion == 1) + { + if (region == 4) + { + row = widthPerRegion - 1 - currPos.y; + col = 0; + } + else if (region == 6) + { + row = currPos.x; + col = 0; + } + } + else if (prevRegion == 2) + { + if (region == 3) + { + row = currPos.x; + col = widthPerRegion - 1; + } + else if (region == 5) + { + row = widthPerRegion - 1 - currPos.y; + col = widthPerRegion - 1; + } + else if (region == 6) + { + col = currPos.x; + row = widthPerRegion - 1; + } + } + else if (prevRegion == 3) + { + if (region == 2) + { + col = currPos.y; + row = widthPerRegion - 1; + } + else if (region == 4) + { + col = currPos.y; + row = 0; + } + } + else if (prevRegion == 4) + { + if (region == 1) + { + col = 0; + row = widthPerRegion - 1 - currPos.y; + } + else if (region == 3) + { + col = 0; + row = currPos.x; + } + } + else if (prevRegion == 5) + { + if (region == 2) + { + row = widthPerRegion - 1 - currPos.y; + col = widthPerRegion - 1; + } + else if (region == 6) + { + row = currPos.x; + col = widthPerRegion - 1; + } + } + else if (prevRegion == 6) + { + if (region == 1) + { + col = currPos.y; + row = 0; + } + else if (region == 2) + { + col = currPos.x; + row = 0; + } + else if (region == 5) + { + col = currPos.y; + row = widthPerRegion - 1; + } + } + + if (region == 1) + { + col += widthPerRegion; + } + else if (region == 2) + { + col += widthPerRegion * 2; + } + else if (region == 3) + { + col += widthPerRegion; + row += widthPerRegion; + } + else if (region == 4) + { + row += widthPerRegion * 2; + } + else if (region == 5) + { + row += widthPerRegion * 2; + col += widthPerRegion; + } + else if (region == 6) + { + row += widthPerRegion * 3; + } + + return new ivec2(col, row); + } + + public static (ivec2 pos, ivec2 facing) getCubeTransition(this Day22.tileType[][] arr, ivec2 curr, ivec2 facing) + { + int widthPerRegion = arr.Length < arr[0].Length ? arr.Length / 3 : arr[0].Length / 3; + int region; + // for sample data + // if (curr.y < widthPerRegion) + // { + // region = 1; + // } + // else if (curr.y < widthPerRegion * 2) + // { + // if (curr.x < widthPerRegion) + // { + // region = 2; + // } + // else if (curr.x < widthPerRegion * 2) + // { + // region = 3; + // } + // else + // { + // region = 4; + // } + // } + // else + // { + // if (curr.x < widthPerRegion * 3) + // { + // region = 5; + // } + // else + // { + // region = 6; + // } + // } + // for my data + if (curr.y < widthPerRegion) + { + if (curr.x < widthPerRegion * 2) + { + region = 1; + } + else + { + region = 2; + } + } + else if (curr.y < widthPerRegion * 2) + { + region = 3; + } + else if (curr.y < widthPerRegion * 3) + { + if (curr.x < widthPerRegion) + { + region = 4; + } + else + { + region = 5; + } + } + else + { + region = 6; + } + + var (newRegion, newFacing) = cubeMap[(region, facing)]; + var newPos = translatePoint(curr, region, newRegion, widthPerRegion); + + return (newPos, newFacing); + } +} + +internal class Day22 : Day +{ + internal enum tileType + { + empty, + open, + wall, + } + + private record instruction(int fwd, char turn); + + private readonly List instructions = new(); + + private tileType[][] grid = Array.Empty(); + + internal override void Parse() + { + int phase = 0; + var lines = new List(Parsing.ReadAllLines("22")); + var longestRow = lines.Take(lines.Count - 2).Select(line => line.Length).Max(); + grid = new tileType[lines.Count - 2][]; + for (int row = 0; row < lines.Count; row++) + { + var line = lines[row]; + + if (phase == 1) + { + StringBuilder sb = new(); + foreach (var ch in line) + { + if (ch is >= '0' and <= '9') + { + sb.Append(ch); + } + else + { + instructions.Add(new instruction(int.Parse(sb.ToString()), 'a')); + sb.Clear(); + instructions.Add(new instruction(0, ch)); + } + } + + if (sb.Length > 0) + { + instructions.Add(new instruction(int.Parse(sb.ToString()), 'a')); + } + + break; + } + + if (line.Length == 0) + { + phase++; + continue; + } + + grid[row] = new tileType[longestRow]; + for (int col = 0; col < line.Length; col++) + { + var ch = line[col]; + grid[row][col] = ch switch + { + ' ' => tileType.empty, + '.' => tileType.open, + '#' => tileType.wall, + _ => throw new Exception($"unexpected char {ch}"), + }; + } + } + } + + private static long getPassword(ivec2 pos, ivec2 facing) + { + var rowVal = pos.y + 1; + var colVal = pos.x + 1; + var facingVal = 0; + if (facing == ivec2.DOWN) + { + facingVal = 1; + } + else if (facing == ivec2.LEFT) + { + facingVal = 2; + } + else if (facing == ivec2.UP) + { + facingVal = 3; + } + + return (1000 * rowVal) + (4 * colVal) + facingVal; + } + + internal override string Part1() + { + var start = new ivec2(grid[0].firstIndexOfTile(tileType.open), 0); + + var curr = start; + var facing = ivec2.RIGHT; + foreach (var inst in instructions) + { + if (inst.fwd > 0) + { + for (int i = 0; i < inst.fwd; i++) + { + var next = curr + facing; + if (facing == ivec2.LEFT && (next.x < 0 || grid[next.y][next.x] == tileType.empty)) + { + var col = grid[curr.y].getLastNonEmptyTile(); + next = new ivec2(col, curr.y); + } + else if (facing == ivec2.RIGHT && (next.x >= grid[next.y].Length || grid[next.y][next.x] == tileType.empty)) + { + var col = grid[curr.y].getFirstNonEmptyTile(); + next = new ivec2(col, curr.y); + } + else if (facing == ivec2.DOWN && (next.y >= grid.Length || grid[next.y][next.x] == tileType.empty)) + { + var row = grid.getFirstNonEmptyTile((int) next.x); + next = new ivec2(curr.x, row); + } + else if (facing == ivec2.UP && (next.y < 0 || grid[next.y][next.x] == tileType.empty)) + { + var row = grid.getLastNonEmptyTile((int) next.x); + next = new ivec2(curr.x, row); + } + + if (grid[next.y][next.x] == tileType.open) + { + curr = next; + } + } + } + else + { + if (inst.turn == 'R') + { + facing.RotateRight(); + } + else if (inst.turn == 'L') + { + facing.RotateLeft(); + } + } + } + + return $"Final password: <+white>{getPassword(curr, facing)}"; + } + + internal override string Part2() + { + var start = new ivec2(grid[0].firstIndexOfTile(tileType.open), 0); + + var curr = start; + var facing = ivec2.RIGHT; + foreach (var inst in instructions) + { + if (inst.fwd > 0) + { + for (int i = 0; i < inst.fwd; i++) + { + var next = curr + facing; + var newFacing = facing; + if (facing == ivec2.LEFT && (next.x < 0 || grid[next.y][next.x] == tileType.empty)) + { + (next, newFacing) = grid.getCubeTransition(curr, facing); + } + else if (facing == ivec2.RIGHT && + (next.x >= grid[next.y].Length || grid[next.y][next.x] == tileType.empty)) + { + (next, newFacing) = grid.getCubeTransition(curr, facing); + } + else if (facing == ivec2.DOWN && (next.y >= grid.Length || grid[next.y][next.x] == tileType.empty)) + { + (next, newFacing) = grid.getCubeTransition(curr, facing); + } + else if (facing == ivec2.UP && (next.y < 0 || grid[next.y][next.x] == tileType.empty)) + { + (next, newFacing) = grid.getCubeTransition(curr, facing); + } + + if (grid[next.y][next.x] == tileType.open) + { + facing = newFacing; + curr = next; + } + } + } + else + { + if (inst.turn == 'R') + { + facing.RotateRight(); + } + else if (inst.turn == 'L') + { + facing.RotateLeft(); + } + } + } + + return $"Final cube password: <+white>{getPassword(curr, facing)}"; + } +} \ No newline at end of file