diff --git a/bin/adventofcode2025.dart b/bin/adventofcode2025.dart index 1980214..2a27388 100644 --- a/bin/adventofcode2025.dart +++ b/bin/adventofcode2025.dart @@ -2,6 +2,7 @@ import 'package:adventofcode2025/day1/command.dart' as day1; import 'package:adventofcode2025/day2/command.dart' as day2; import 'package:adventofcode2025/day3/command.dart' as day3; import 'package:adventofcode2025/day4/command.dart' as day4; +import 'package:adventofcode2025/day5/command.dart' as day5; import 'package:args/command_runner.dart'; @@ -11,5 +12,6 @@ void main(List arguments) { ..addCommand(day2.Day2Command()) ..addCommand(day3.Day3Command()) ..addCommand(day4.Day4Command()) + ..addCommand(day5.Day5Command()) ..run(arguments); } diff --git a/inputs/day5/large.txt b/inputs/day5/large.txt new file mode 100644 index 0000000..e474bd4 --- /dev/null +++ b/inputs/day5/large.txt @@ -0,0 +1,1193 @@ +404919393645906-405195345919978 +553879357268383-557519950412105 +84382683729551-84915866504386 +438979926080208-440531196077572 +279106100029137-279106100029137 +524224982415800-528087059852434 +76455093504299-77971949995619 +484039721372657-489782383021257 +515311482248159-515902682999019 +77221918667537-79036068725929 +184730683417631-186043961828140 +132660619588921-139884323295658 +161413890454702-167295354511925 +376077046357344-380360254101131 +407759930270410-408104753441198 +475490386384658-477423740455650 +409281076782251-410038621970838 +83782694486758-84382683729551 +428058285252005-428058285252005 +267161562227708-267161562227708 +72780006414786-74504825319147 +232006193118620-232552964600723 +232552964600723-233187845902377 +61308939495774-64297188335312 +432693525769349-434469334450316 +222907464227445-222907464227445 +407578030660756-408205533735062 +204723395882113-210449694520341 +86521205681659-87117125149972 +173212212812932-174730663826946 +239727010856768-239865234518849 +74204472318111-75579609068338 +304719909483986-306459355187024 +383059974687406-389923947064426 +262688018710018-267161562227708 +434015180482041-435691784346167 +216056508813799-218297876947061 +51744920403428-59514110306063 +410816522618286-411435179783470 +239478097169882-240041104043246 +315856386546839-318400177409334 +70448549245721-72237246128311 +396130798187353-401179654515341 +323744172606498-330508309681977 +515311482248159-515902682999019 +283329290949927-286243701391053 +240041104043246-240392193967378 +539928679232682-539928679232682 +475490386384658-481429662616328 +186980771430031-188644601508363 +408104753441198-408577889786600 +303005993285220-304414953857628 +238430303140365-238683279974396 +243165812011854-245625019443223 +467076186649821-471117361492077 +253374792666642-260980778920336 +254259787325323-257740552994298 +234316473857134-235158270722913 +185481688460522-187250419970092 +396130798187352-396130798187352 +405195345919978-406040477985746 +413393611404679-418511128973686 +309866183491657-311306377800810 +64297188335313-69508425301557 +234316473857134-235158270722913 +389923947064426-389923947064426 +515902682999019-516121667522474 +410038621970838-410624457067030 +353579668101705-359081987457993 +86521205681659-87117125149972 +32509020563391-35728282113839 +423845119551539-428058285252005 +78425040289552-79949637445284 +11182508052984-11182508052984 +407578030660756-408205533735062 +174730663826947-179200164208984 +519094029317153-519324033808485 +435002584048216-436747414559094 +517627255856381-518179945916218 +43367440282285-49825022247524 +239865234518849-240041104043246 +405748756662452-406040477985746 +243165812011854-249993865672402 +333888908817410-337901247345290 +193919221482568-199517971434556 +213514044744612-216056508813797 +528087059852436-532345524972985 +517819756607065-518179945916218 +286243701391054-290676996057668 +22450189134234-27921779976133 +486570875812113-489782383021257 +236603783537810-236813062383051 +518179945916218-518258398122786 +183470567297491-185258271898650 +409281076782251-409455301040147 +333888908817410-337901247345290 +114558582038217-114558582038217 +114558582038218-119249741740168 +308794423251097-310527223141574 +235904429561341-236370893288029 +306875776692960-308267003662370 +74997074094054-76938816872331 +305974568761553-307298732649801 +410295991429139-410624457067030 +440044079857174-442028024224573 +411213399607828-411435179783470 +86906205904673-87488529411943 +130083522228660-130083522228660 +85033064684692-85239197060395 +408671841411858-409281076782251 +22450189134234-25545727501642 +410953204398521-411747069114911 +403671538144791-404480166710482 +292749341210343-297129609347319 +240392193967378-240688214480513 +82121210392435-82467812961217 +153089087132780-159659837200437 +303718475244668-305438680810485 +235312756369204-236201033193761 +324591797079850-328575361009670 +83374200763882-84053360936756 +372793683893418-380360254101131 +82800216399828-83039859599056 +188070614522821-189649356343928 +84915866504386-85652992684124 +71898019061603-73616273389716 +2361616162636-8165600354367 +493645556542247-493645556542247 +236370893288029-236813062383051 +144035695944091-149198642735679 +232006193118620-232552964600723 +410624457067030-410953204398521 +42061394317944-46324473054592 +520064415395735-520328160073665 +237527574430777-237970009701457 +164945992116600-170445210014210 +80959958600751-81828942236043 +353579668101705-358176520841978 +237970009701457-238683279974396 +181224573632737-182877795476189 +406751874259808-407578030660756 +453337750155289-461406269551673 +87768851526436-88531609491610 +493645556542247-498975145198407 +88287515756943-88531609491610 +362821402029163-367638936783133 +514846194607767-515658376444001 +294440602822709-299688927234219 +83374200763882-83782694486758 +103620914965964-106338605633942 +87117125149972-87488529411943 +275017981540025-279106100029136 +103620914965964-106338605633942 +232856551607318-233253637499446 +85652992684124-86396969439719 +308046307689395-309347080891167 +437850310545694-439377803452464 +543698308351365-550541972430083 +82467812961217-82800216399828 +503188793311448-510922038996232 +301914416160414-303184738782824 +367638936783135-370447580138312 +518871759979309-519499063486207 +344111786880862-344111786880862 +134032754599235-137710588473550 +193919221482568-193919221482568 +543698308351364-543698308351364 +503188793311448-510922038996232 +91970539216526-95685419130288 +557519950412106-560762241492458 +456950840441805-458065973536000 +520064415395735-520841083999370 +517627255856381-518258398122786 +121239715522873-130083522228660 +436547787534206-438457249246740 +408577889786600-408671841411858 +344111786880862-351036318668261 +463253080842286-467855987887613 +95685419130290-98725625061226 +445747467287915-449306511952968 +11182508052984-15727593187713 +536970487773862-539928679232681 +87117125149972-87768851526436 +222907464227446-228663352403032 +182208909309536-183917189022917 +59514110306064-59514110306064 +81344892339775-81647378719492 +5607835677521-8165600354367 +144035695944091-149198642735679 +418511128973687-418511128973687 +188879831759634-190636000179389 +154570914565486-159659837200437 + +552706710627335 +271420995814978 +318271563722769 +38166221525912 +58283573678108 +536165325397085 +497185375700534 +94044241325101 +10505841589966 +431111656516758 +275732773885021 +364996968658019 +254074031758368 +218969785426320 +562912531953680 +377786137311736 +61302590162573 +131108518885870 +233812062298392 +196812886010019 +460470323627485 +67887747348766 +196837425149228 +108406362442739 +381554333046435 +35654218996296 +289650655268616 +394271800808257 +254136770951186 +458387798964647 +427423736196472 +50359614556043 +338238551514044 +519702770620437 +52408132720960 +197417293580222 +557929845774049 +52567998827946 +336498040933027 +323740458572771 +121279727472625 +466823389991833 +224240201348009 +503220046651534 +522714897606553 +448910879562210 +321749007201729 +256962920917742 +219942319150194 +546451095594577 +380967262658351 +15102425639187 +309343385918493 +488783218557487 +431408560972487 +421336364513494 +60294671470725 +75735730839709 +1681638346205 +183883820480609 +372175994423373 +339436995057044 +410788369941277 +546040392057005 +186706277356104 +275210437089204 +192861039110513 +33242165567308 +551704264240958 +515586638261105 +213399616701804 +524822464847818 +170371762604356 +92978533022432 +326460760405755 +532556898088972 +39291264916303 +63867182544824 +175390548921026 +142497707204800 +127586309777236 +434599075324799 +18674935184106 +552889677187858 +358713341385044 +225463409054589 +512354480315983 +534325277063152 +426946468347728 +209695055934969 +24048487069665 +361835991019573 +266111029196500 +89304201012143 +244002173918093 +11615449757497 +339190300161530 +183361961216962 +325124039458571 +136609004435633 +491733019175807 +78511805514958 +136057598476448 +15057643118481 +215824787940766 +295358093744493 +448173287201674 +249029078718757 +515756832590163 +137945327398823 +128763043196214 +237062999170614 +434920760849746 +274503250128720 +48872396867 +95841479028293 +492622608777515 +21036030513889 +381854056572063 +162368858363359 +116573057604378 +452503642584097 +410123916064763 +364952841423828 +163021253046140 +495416324849855 +241673867074358 +47495185067663 +280627455694384 +219287308107279 +31328630496758 +16630412558961 +47946209726580 +406896783906323 +141529720131162 +56692201154685 +351536770477932 +298608157058956 +421195236111712 +368581237303925 +259357734554381 +435698464477314 +258849464214405 +485662292882936 +280305454938217 +179255893975566 +111907739162822 +452012824344795 +562733853563131 +126770008586503 +124708611264162 +44682559283274 +344742358337957 +418836445035022 +357968009485222 +445860621372550 +439282768861234 +142701189731929 +43544976801029 +468898840561162 +358891019941402 +434787990619601 +280817648856492 +116517663646933 +442524082994779 +293160119428436 +402381989850761 +528221621586575 +223149361943671 +504419902053606 +429605344125601 +259907758756149 +155029368878465 +201943750902695 +206143942345670 +444969193806701 +131049117891496 +249326764093340 +322731728290417 +302982914434692 +229120515790815 +200770701315229 +200161348186763 +451524546155576 +488103380421492 +423679896283096 +309423054828971 +187457117975033 +357856340261780 +377618839508178 +151299663756105 +487496073105689 +285052570623954 +142832889720360 +155668603140708 +278756245779449 +304443131656980 +443415430362665 +229579871211145 +418485631420275 +241930047017163 +413469386695326 +375662954041256 +129156180533232 +13216419807714 +36014971006044 +3592306070855 +174321397961520 +379694456732262 +140736301401330 +218578263838734 +173335528588905 +218853691558610 +87206855714001 +21074060967560 +276842063657144 +532135287243109 +333869080427576 +248792385283571 +476730932333360 +51341756205778 +374741207210596 +337314860701846 +131492505675896 +529822229273976 +264737811080853 +50276976348615 +539188052655814 +105647303461167 +182028862106573 +290483029811897 +283754026859227 +219948017533256 +334707858835481 +175656320559554 +103650948928105 +483164402581927 +434868247207353 +71365260218588 +203224200424635 +508392573277475 +43150310924189 +541919721486076 +271603569058641 +317763962977948 +458061652091491 +496323359366596 +85145870930285 +258275368221258 +22099107750801 +4445616497904 +33369693410932 +348235983447665 +413432433786808 +500881660861990 +457250954920370 +285145267503099 +315471789481010 +540122906395768 +297610445696590 +388356705797181 +517332425381653 +18393783384697 +435400408987683 +146815756938998 +289957784176825 +223519920961449 +94693692911352 +208102038008852 +302670049504926 +299356222046444 +87337443923815 +206009591379686 +290898502482995 +41719030144254 +30068272699740 +182975824105998 +264800195242223 +212608438760805 +74530861437625 +8100145879363 +331008062411733 +17744496126809 +32934667222844 +41121538803711 +329719230905606 +142463803928014 +454550448469957 +160069836825961 +405427732034510 +441994033282816 +185568317043593 +218967974704568 +453356336238393 +315152437964982 +296279536360152 +54455128637605 +161510592900079 +73664184462906 +394371795184345 +459307958667631 +303792402543687 +538010151287725 +525395375171042 +356396805343158 +495483214524350 +170191551375833 +151453812059391 +231966838351940 +233276263076076 +400573624194012 +271443061076875 +531740699924987 +279102680545880 +323057833512817 +355177603116667 +464225906871186 +445091630495486 +61063384493981 +48508028679412 +185520227271565 +526960539219135 +204828109408483 +305640499244638 +377706528182375 +333757117433137 +562226905396885 +122442288072584 +378302813825156 +297516460629391 +354032835887248 +480314861502210 +525768063250993 +379199592856616 +504074135266571 +219752384799927 +407331069883797 +63389307078619 +484008710923621 +550524510491346 +111628950647994 +258982649219946 +237363140558851 +332536808896675 +387174921477013 +443005229513944 +519188783869975 +174500219900530 +908423528555 +97596647341853 +128195038152672 +20310392645973 +314934163522083 +483711310402848 +199626347969459 +444800101073808 +123520509481458 +450350677364248 +470644774377349 +97893283095569 +479518429640884 +448291158640257 +440898099421417 +403484472183416 +296017831142381 +440033418963645 +65040862905943 +294587333046262 +295090842664818 +242319846977770 +53777699897618 +215358489951869 +377069396580933 +103875580615863 +36064564867500 +81497055273091 +85428961785229 +557122108191872 +560206604527961 +454174790385891 +255316634726706 +273673432420604 +167016518805142 +113897037413570 +173908467982560 +471821868770845 +176643958302424 +432692902689243 +190145724880644 +343207409729324 +86863598209975 +253720636286842 +521815420779755 +505035670361307 +428236817406609 +158052187313172 +49992922126579 +384326165302572 +266198047826396 +73832493518016 +217892447334843 +277301605034866 +557654210191524 +461322967262581 +262656892684983 +28892052910734 +115616633452622 +490826504119473 +439800568709802 +133306947284920 +240233894966530 +511614428632516 +109934406271123 +355483295254961 +543501215247734 +87295280316450 +424524192117192 +295473107102741 +392772717334515 +346445759733582 +468194942300480 +62258149538239 +523612487594156 +501465286246014 +523189334115675 +259493705995803 +257620782117645 +463527953718063 +498411317730770 +454065494043642 +410089078239409 +468874327456387 +278211329190909 +540995169754410 +120763120125887 +264137124637177 +198956770038664 +380183213035224 +454810405164248 +251445209696637 +312022415913764 +235561426861365 +87480626942902 +228279681676662 +45720846054919 +252436172827372 +94825491229178 +18061021473474 +367475849496843 +159148843046927 +188265386982714 +177305727891846 +347637093771152 +328297345140919 +457195877344086 +410361229794213 +439549181822928 +65144312083694 +253668979702724 +75202345401756 +499819891643749 +237068703435700 +46339181991157 +512706583629950 +400077440238842 +87809973666843 +454095923813301 +270125538521594 +397854126772453 +131163165275863 +142807773129891 +548592253889371 +25803869545539 +293688123335292 +366452598557090 +111334505316527 +131692123312487 +287053943671664 +184568003198357 +125083811961706 +289827991531293 +130509399641067 +553359489621255 +539058644182445 +140230193142225 +152814798998936 +188345036615953 +168684861991218 +292741921008847 +388225033365575 +20918435574926 +14098959607460 +258704951904892 +375113007051104 +357495901647476 +562180629331176 +524607180350496 +123278617667501 +204876532737450 +227583889730116 +67231427951173 +298190217619943 +49012916811885 +92831191224751 +191655189510658 +421196679439495 +62875620075793 +501636983694215 +4049926940051 +302800838590064 +501868129694341 +405121385835922 +323575072216406 +126991695844795 +472363334109746 +308320399433910 +456102061436558 +46849245444992 +12305162632564 +329324000673962 +137558826647232 +250446561890375 +122817862085521 +347711860917969 +474896441851084 +477291637697309 +488983090968789 +391477625671728 +363124439912373 +196482700872433 +461221491825047 +232468624244053 +509244885389354 +288420731414171 +137056604979611 +236061602759770 +28188959626844 +354105235595196 +55868459106716 +538226357756227 +308993451953738 +461468199879108 +562600722881708 +38703772451422 +41859272580145 +147302054113783 +497566565616477 +57043358687649 +6159770712967 +188341240016660 +336035231173738 +116871964574294 +363974080941965 +536294434303805 +335685029370187 +344177440979951 +316568679474156 +431905121317209 +535642024685826 +342129276455481 +544067291980838 +450703144959608 +306485071682345 +125016745806467 +36106564606667 +86812608237625 +505526917071924 +166872848053644 +5433915959383 +478222397903928 +101971093524695 +189808976442088 +250156058766717 +229332609465732 +78539007285267 +378254856727863 +408324316722307 +535716095457415 +393614090351296 +250680870160184 +413111803280205 +71021125199730 +480121799128326 +514474550086084 +256204826832617 +13539175327425 +166029946536038 +449772929965821 +522876590890736 +11450110920356 +216051385500745 +27318931549190 +194512456091373 +407617100086048 +457826300260103 +438520035440943 +427137711317307 +24947827180785 +181529897796010 +130609984578077 +66923058744193 +557353641593540 +361061315770047 +351652071707180 +148984991513249 +45235627377771 +202352672679783 +36402896937795 +41701473394747 +332767031420170 +297201422163972 +24385487778406 +212519548696002 +112275834474023 +416498908923616 +433479725305768 +316687803094950 +30189186730882 +312772675762510 +552811240582576 +159506604635029 +326667091992354 +379578129161487 +53556090936916 +544277854885966 +472846586168860 +550366969203795 +518218811062488 +248035821568071 +306537048845510 +108347286384583 +323530957621308 +250908697548108 +480944838431735 +357917583851231 +243285436613383 +27316139461284 +199693513996590 +562072916834878 +221467715971794 +541830609203394 +265304700797928 +377250953265868 +284588134872683 +482567012227643 +506234796987864 +262410526535239 +547481623911409 +163088058198999 +100524016184235 +344232545977085 +365695363961197 +225154066233258 +246705885965098 +29137715883650 +63291380852154 +508259971485989 +104792088431676 +314703319122961 +140953672315557 +414401564826987 +355338903987336 +374004213391844 +90493840046219 +169220174680772 +85904939019735 +209356879896899 +162596167971451 +168287380098303 +301019315669842 +525043123561138 +31708189989432 +550638386669050 +265563715136559 +542614976180344 +125564256580300 +321174316526980 +294492965888708 +482894204688454 +116128553976770 +448684228722866 +517995569471898 +83311686992026 +70992585001834 +457225094704743 +247007982635941 +46497938346381 +417381566054328 +245548181704324 +551815333987440 +218062429945161 +484981456541731 +529310898128450 +433964123882394 +494996588672693 +127346421125053 +45234155401295 +149908436026111 +193994724866857 +136076565204420 +107704912781354 +557689974991726 +280983140688920 +418231872915865 +272328403294645 +546271207969066 +534114692435694 +55026648697178 +380541746587681 +408502208733790 +444540845110201 +52609322676586 +478299297135721 +96991269056049 +7934508902067 +85580467522811 +52348158742233 +138491379039823 +77790196016218 +559675477935622 +347348847830316 +509781766716784 +249612071466695 +426077316330849 +391451199455834 +414137726069234 +223504239905303 +509042051937625 +222509483957591 +96140620768190 +15203309577440 +55267203476785 +229506640830219 +465028783766903 +163826665541439 +543442423789272 +469507395805506 +78065907872119 +136463623641099 +375706542756611 +224234330389152 +324534778037756 +492248831933020 +326068667829937 +313413283397361 +225073930770672 +149395224461984 +85827016639550 +365930832060032 +431443724672683 +46505562403090 +112456880100948 +51454561979459 +435013897334488 +508654528889 +399116012108812 +65909756756240 +142300705480377 +448842963791206 +436646309350824 +388703165504887 +559730295154752 +302236597149696 +264371169660805 +228928166897925 +539047004905018 +78167707739631 +164054786438787 +225764984948041 +34991456254685 +422657963251058 +417769287205835 +458326348529411 +559385389788591 +464202828659830 +416336852655863 +210460443137052 +234441271971202 +328307488231377 +548852633932301 +480514093212365 +213536663232304 +430970860116922 +302247630898777 +222532992957622 +317729828485296 +192424395782312 +423585008942549 +507055485404455 +495271132238443 +17871601735197 +188419250404619 +272750802880477 +20939357281377 +544018633100744 +237872389655455 +133461465223715 +293137194460285 +346502060709522 +294670644833761 +215053921561436 +32007152099693 +460997943103647 +390341608215846 +15331281099936 +399191546953031 +128624263938166 +113636163078605 +275961584233436 +65110613800017 +559240415150663 +215987309911967 +176694617584472 +7036278664873 +56787772360723 +559428765119446 +56612859312911 +175233920327478 +245711195823162 +534742839284140 +360357892599154 +189691825784013 +280308179942106 +215636119297355 +325948435585720 +485933904877502 +69507066075850 +384194071426981 +55303109854353 +714527065949 +427433976002583 +379413414631503 +248622769980844 +474752524439241 +286375672290136 +64361026381578 +558575614317152 +21362955160012 +432286563209069 +62621406244189 +329626983008259 +434886817724673 +280067570646194 +492552882388639 +192036953150067 +15425831432242 +541381407520029 +528981131430938 +97426374436170 +396534976158331 +358536763403530 +175782737218310 +91969070288262 +444189453799197 +286174257561525 +295324363589174 +58011638341121 +27449464660042 +232874486601768 +109437097534286 +482720557954281 +387388681355878 +508298819899079 +327709563329802 +512338500404737 +385197888109833 +319039319988016 +556911826784723 +51700208210246 +497450463291999 +289349053968640 +98803215466267 +520016712766063 +59595742495569 +363095351015158 +30763014023167 +494385227576521 +55770866822835 +78519541593461 +194781675087480 +407413638793596 +429150602864890 +74444154319017 +203063573155576 +470124031386817 +404659959951642 +118858231812189 +357215366971371 +82413410521845 +378844813001971 +403710388376087 +107769568408131 +121915478374324 +500938974898826 +76608248878310 +250551788362503 +225197953357530 +556663265070210 +14595921157648 +10558519708052 +340552326267416 +295059723445961 +186719301483179 +194157413333250 +386422093128479 +372608258367355 +440222279413826 +58040798017975 +393090799151804 +411135863089563 +300972262810186 +165241212311506 +200712980823655 +429634973891478 +214610596969756 +88021693252739 +419920786835274 +205632073939851 +396072779026052 +498079715170956 +547475614899200 +143248382137866 +82665760421004 +26402056573557 +290379435186355 +100065482688144 +437265318971188 +202917801959632 +450590796320172 +411599306916493 +274642693893968 +258451347404578 +246009601066189 +270494734612481 +65288063580228 +439307455656358 +271221628823452 +30084763000616 +240140245270853 +289112783379180 +550460995243730 +351259170925199 +316167210565027 +507546801771177 +106996640577472 +506236020330303 +481813306171253 +11848250787611 +496676912557141 +284529966479992 +128392350435502 +376322544844253 +439987373428979 +449075976459315 +65963264058474 +486032949771724 +313156776137777 +272741879728233 +224529066921043 +491173113192109 +291984647389956 +465829086652638 +495402880799382 +127949661049717 +225753911200075 +323670285761820 +159261256913993 +170656490448896 +257858499144884 +49716684456931 +518303676068927 +465870838505806 +26559154519910 +233116840442025 +338665476304995 +364954636831203 +298879980489607 +526088238776481 +81675184350814 +33279383342739 +210603379927544 +46125227514319 +304055387590548 +154573149891989 +449933721655247 +7211079176727 +384523496797607 +415423189399127 +75669482655790 +276884320826016 +505111451940856 +238898420994128 +123592744775835 +259028667164504 +356835514888047 +348104355064554 +210462659010188 +114002258948522 +334350308080049 +336345689077552 diff --git a/inputs/day5/small.txt b/inputs/day5/small.txt new file mode 100644 index 0000000..2e9078d --- /dev/null +++ b/inputs/day5/small.txt @@ -0,0 +1,11 @@ +3-5 +10-14 +16-20 +12-18 + +1 +5 +8 +11 +17 +32 diff --git a/lib/day4/command.dart b/lib/day4/command.dart index fdc5e70..2f0474f 100644 --- a/lib/day4/command.dart +++ b/lib/day4/command.dart @@ -55,7 +55,7 @@ class Day4Command extends Command { final name = "day4"; @override - final description = "Run Advent of Code 2025 Day 3"; + final description = "Run Advent of Code 2025 Day 4"; Day4Command() { // we can add command specific arguments here. diff --git a/lib/day5/command.dart b/lib/day5/command.dart new file mode 100644 index 0000000..914212c --- /dev/null +++ b/lib/day5/command.dart @@ -0,0 +1,45 @@ +import "dart:convert"; +import "dart:io"; + +import "package:args/command_runner.dart"; + +class Day5Command extends Command { + // The [name] and [description] properties must be defined by every + // subclass. + @override + final name = "day5"; + + @override + final description = "Run Advent of Code 2025 Day 5"; + + Day5Command() { + // we can add command specific arguments here. + // [argParser] is automatically created by the parent class. + } + + // [run] may also return a Future. + @override + Future run() async { + // [argResults] is set before [run()] is called and contains the flags/options + // passed to this command. + + if (argResults!.rest.length != 1) { + print( + "Expected 1 positional arguments, found ${argResults!.rest.length}", + ); + exit(1); + } + var filePath = argResults!.rest[0]; + + print("Parsing file: $filePath"); + var inputFile = File(filePath); + var result = await inputFile + .openRead() + .transform(utf8.decoder) + .transform(LineSplitter()) + .map((line) { + return line; + }) + .toList(); + } +}