From 457630889f554147d8c1a19e50f9d40f31640400 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 11:37:27 +0200 Subject: [PATCH 1/9] add aoc solutions --- README.md | 4 + examples/aoc2023/day01/corner-cases.txt | 24 + examples/aoc2023/day01/input.txt | 1000 +++++++++++++++++++++++ examples/aoc2023/day01/part1.jou | 25 + examples/aoc2023/day01/part2.jou | 38 + examples/aoc2023/day01/sampleinput.txt | 4 + examples/aoc2023/day01/sampleinput2.txt | 7 + examples/aoc2023/day02/input.txt | 100 +++ examples/aoc2023/day02/part1.jou | 51 ++ examples/aoc2023/day02/part2.jou | 60 ++ examples/aoc2023/day02/sampleinput.txt | 5 + examples/aoc2023/day03/input.txt | 140 ++++ examples/aoc2023/day03/part1.jou | 69 ++ examples/aoc2023/day03/part2.jou | 85 ++ examples/aoc2023/day03/sampleinput.txt | 10 + 15 files changed, 1622 insertions(+) create mode 100644 examples/aoc2023/day01/corner-cases.txt create mode 100644 examples/aoc2023/day01/input.txt create mode 100644 examples/aoc2023/day01/part1.jou create mode 100644 examples/aoc2023/day01/part2.jou create mode 100644 examples/aoc2023/day01/sampleinput.txt create mode 100644 examples/aoc2023/day01/sampleinput2.txt create mode 100644 examples/aoc2023/day02/input.txt create mode 100644 examples/aoc2023/day02/part1.jou create mode 100644 examples/aoc2023/day02/part2.jou create mode 100644 examples/aoc2023/day02/sampleinput.txt create mode 100644 examples/aoc2023/day03/input.txt create mode 100644 examples/aoc2023/day03/part1.jou create mode 100644 examples/aoc2023/day03/part2.jou create mode 100644 examples/aoc2023/day03/sampleinput.txt diff --git a/README.md b/README.md index 98a32902..e3d85ab6 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ def main() -> int: See the [examples](./examples/) and [tests](./tests/) directories for more example programs. +So far, Jou is usable enough to do [Advent of Code 2023](https://adventofcode.com/). +We'll see whether I get 50 stars with Jou this year. +See [examples/aoc2023](./examples/aoc2023/) for the code. + Goals: - Minimalistic feel of C + simple Python-style syntax - Possible target audiences: diff --git a/examples/aoc2023/day01/corner-cases.txt b/examples/aoc2023/day01/corner-cases.txt new file mode 100644 index 00000000..f93a539f --- /dev/null +++ b/examples/aoc2023/day01/corner-cases.txt @@ -0,0 +1,24 @@ +eight3fiveninefivemtxm9eightwot +x1vzgnpdjtwonert +t3sixtwonedmj +9qzbqxmqonefiveknrnzpxoneightrq +4btqghfcqx25fivetwo95oneightxf +48sevensixfoureightwodx +15qhpvsevensixoneightt +7fiveeightoneightvs +fivesevenfour9jslninesevenjtttt7oneightssr +fivefour852eightwosx +4ssskfrfqhz9eightfour37oneightjm +25sixjrjqgl5fivekhtxstwovgxzfpvzfmoneightb +65rdlfdxjeightwox +ninercxgj4txpflzvhgtwoneqh +49seven7threeeightwokr +onetwonine4noneightvk +3eightfive88eightwor +6q9pjsdzponerfnqt6eightwob +1eightworg +8onecctzfxreighteightwoq +ptwo2fivedqxthreesdmbvdcdxrtwonegt +hdfdltsrtwoseventbqr7pckgcqtcgh8onetwonez +62xvvkpbhhbthreetwooneeightwozr +ninesevensrzxkzpmgz8kcjxsbdftwoner diff --git a/examples/aoc2023/day01/input.txt b/examples/aoc2023/day01/input.txt new file mode 100644 index 00000000..69b9d12a --- /dev/null +++ b/examples/aoc2023/day01/input.txt @@ -0,0 +1,1000 @@ +eightfivesssxxmgthreethreeone1sevenhnz +hzdlftdtfqfdbxgsix9onetwo13 +29threelgxljfhrjr +pxvmbjprllmbfpzjxsvhc5 +seven2jtgjltvzbcdnjtsfiveonebhkzld +twothreesixeight6eight6 +nptjqqxoneninert1927 +7beighttwob +6onesix +6fourfive97 +jxcgpx5ninemsqqfmkpnj +jsdkqjbgx1gz5 +9fourxxmdqmmlrbpqgznone8lvtxftmfpseven +qsdzrx6 +khone9fivefive2 +nine9eightseven +threefour3pzzxmrmvpn6sixmfckm +twoseventwohncgscdmbsdzh6zckqbvml +six5nine5jlhthreefive +7onesztpkqmjlfourhrrcf3threeone +83zgthreethreenine +ninevgvrhtsrrnbnxg2fourvlqkdqxxqcmfqbbmx3 +mqphlgz8sghhvsevenpblfrmxvsixcqpsdjvs +fourlltktxt93brbmpml8 +mqfkvscjj56 +fivehhh8four17fbqxtksseven +5rbzgfournplgvtsixbqvmd +sevenflknr33qtwosixstmsblmrzczdqflxg +dblfhbt7sevenninesix2threethree +81fourtwo +three87tgz3 +bkjnnzsjgmfive4vsvh +threeqkrsbzzjbmkjdmthree1ninethree7 +5oneqdzzpj +5fourlfrp +ninefbfhptcqql1f5eightfncmrvkff +mlhxgnxxxrr3ninefnlcdlvseven +sixfiveone5 +sevensixtwofivenine17vkshzpbkbhtssg +5seventvzqcjfzj4 +6eightspklnbxqcdshsdhgq8eightninej +eight3fiveninefivemtxm9eightwot +lsxlqlnsevenpstsbbzpkhphrkjdd42fbxqdmc7six +fr2dllkdtqfh3hgvf +cqjeightwothree9hvrmtg +74cxeight +seven8fivescftvkmvxh66rkcfqfjf8 +4twothree +six4onedhsevencngfntnsss8 +8262sixthreepxvgpqf4two +8qtthree +three6gqfcml3zfxhfsvr +jltxcptthjsixmszdqt9xkbg89 +zheightwotwo5threeqrgbr +1sevenpvgqtrtjfqtvklnt +1vspr99lvvn9mktnjv +lrj8lltb5three +ninevjmsfkqkns2 +1fiveeightmh2 +lck76 +gjkmgqhnvgnine7 +55jjzqxhtmmsevenseven2ffzqz3 +3eightfive +eightthreedpxcbsjbfive3cjfm +eightpvhqkkxfdfhg6three +lsevennxnkgthree35jg7one +3eightzdkkqgjvbz926 +nineninenine49five +lvgxbch8nnnlpbvtgpqqmmm +d2sevenjqbjbklssrrtr1eight +one4xxdbgfjzhdbmxqtfvbplmsxonekq2 +eight4fourfive +threec2twothree8 +ninefive7 +1sevenmvdgzdtwoone +4mmbddbxnb +tvfjz5htfnlbzmb85thtsix +24567 +zmkckdxpsixfivezhsxnqvcj3 +nine15nine1three5 +nineckmvzlctpk3nine3vsnpvkzsnx29 +7nqthreetwo +dkdgtzxz8 +sevenljjldccxhgxs6jbblhmtxkc3kqfnntgzbvcd +one99 +twoxvns165gfclnxrthree +soneightninetwo161vhmf +four494 +23xmxbxxrhgxthreebqjzx21one +two361 +qlzchlkb1six6 +sfmzztmtkd46sixpk6sevenjft +x1vzgnpdjtwonert +575khkzl +txlpc39hlcmlnxmb9nineptdsvhdhbz +eighttwo5 +76six4blfmlclrcj4one +fiveone4nssevenfiveninefvmv3 +kpltvpmfljxfhx53seven +7five1vxdhnvrjs +fivefoursevenone4sevenninefive +sevenfnmvbleightsixsevenxgzhnrdjkj8two7 +2twoone78seven +zbfczseven8jqqksl5 +sevennine1cvr12pxfdninejqzmrklrpd +three22fourbnfdtfghmrone +kphxprbrsevenjp7 +z973 +t3sixtwonedmj +four6hqntpmsix5four +nl71 +fourseven8sixqmjrbh3xmrmjvdkfourgvlnlq +dprxplthreezsnmqcfcz6fourninesevenbc +9threeseven1ninetmjgxqthhmfvkspznz +85eightsevenmnvmnvlvlqsixzrxnrflmnthree +4threeqpkztjv82four +onemrxrxfcgtwozmnglpsixgvprxd5khnmqbdf4 +sixsixsixxcmtfh3 +7zclrbhnpzlkkdlsgvk1sixxdvlfqp +5nineslhvxhn74 +7eightninefivenine5qmknztrm +hnbsgslpvjzfourk3 +1threemlxzdfjdtn5d +seveneight94frlpvqzrd +74tztnlxvr +xrsrhbjthreetgsix1fourbbrvkcdj +seveneightjxzjgtrtwof983four +voneightcqkcdvhxh4eight +36fzdqdnfvfoureight7six +szbrxngs8 +five6fnrkr4 +sixmf5twojhxgmphxrnxxknqsqqptc +1tmvhvfkhjsix +3sevenfqmnine +eight1sevenone +seventwo371bcct +62rcxzfivemshhfourxg +fnzhqklm3 +sixkp13 +1ksqxljtftwo +2ksjstft44fivenine6bgrnzxprvk +hpdjlcstgpqzmxrth25ninelxvrzd6 +vzhhfczjs3two +three65sixfour19 +3dmfxckkdrclzhvcsfkbl8five +rjscjrshbdhk1tclpsrbtgg8sixbjgtwo +7sevenseven +9qzbqxmqonefiveknrnzpxoneightrq +4btqghfcqx25fivetwo95oneightxf +8fivejvbvftzhcxlxhqfour +sevenfourzrxxft9twoninethree4 +eight9k +39zzfckvfknjsggxdlthreenine +three7pcdnvb +sgrcmfour1tzmdrkp +eightqfkmrzpbxr19 +q36six9 +eightkhcrhkq7nine2pbfnjb +52cldhzmfoursevenxjptnbfivemdvkp +3rts +six8clzsndmqncvtbjtjzlzv8crm3 +ffnqkrrrjfive2three17 +two8nbmvvvrqxqnhhj +9hlgsngnm +117qncndfc2rjvlhrljfxljrzjdnine4 +3gvx5 +4eightsix9vqq9three +mgeightwo8zcvfghnlth7btq6brhseven +nineb5six9fiverhpgdkjvmgsrbone +sevenmmjsrhqvfour1rhvsvtgtkxxhklnqzp +fourrs33sfrtj +7threeeightninezhbvcnpmst28 +bdffmszjmpqvz9five1eightthree +lbjfg9twozpmmbfxj7gpzpgh +26sevenzdrghllpnkbtvkrfpg +tcmgzjk2rv9lblsf +8five9six4seven +94two +8sevenbbqj2 +three2vldmbjdfthree5 +threethreetwo9six35 +8j24fiveqcprqmnkcb +eight7bnghgcjxdpmcqgjks8 +tbrrggrpzrjqxbgcs5 +6eightfoureightthreenxfmdrthree2 +9seventwoqndtmhrxvssixscsjkjd +3s6xztbkmmninegfnjz6seven5 +5one21lkv +465six4nhx3 +92cffdkftleight779 +eightninefivesixhfkfz3 +bgoneightkhgvqbfivefour1seven +rxbeight47eightthree7 +fourqjftdzjr327twopsgdfgvjdlk +5fourfourfournzvrteightthreekkszfknj +six58jns7 +cdmfngp9sixseven +twojkszvbeight2kzpxvmlmblgzphrpm +threesixthreeljeightseven4 +seveneightfive4bnttggznlnn +tfz7jpmcdlvsjh6 +31eighteight23gbgsevenznz +threetlzd3five4 +34fournkzcvkkb8pjvxnh6 +mkcdj3onefive5gone +sevengtgdpdh4 +q7377five9four +eightj481 +48sevensixfoureightwodx +sixkqtzzreight6seven8xtksj6rdllzmnb +p6jsxflvtpseven9 +9two8 +six7zdjgrdvgdtgksncbrxdmhzkxjtmv452 +83eightljzgv +697five +2three6five9 +53fourthreekvpjqxhjzdtwosevengsnfd7 +nine7hnhczxpqmxpvnrtrtl2threeseven4five +7knlqbhnineeight767 +eightj7threess3five8 +4five4three +fourjnkspcjv2threeone1ntmbblkcxgvtvjk +cfbpfkxfeighttwo3seven +7qcnb +3dppxtmnqggxbrdg5twoeightnine +ninenine49foureight +fivesixfive7 +7eightsixlmj +five2sbxf15 +onetmkkxv363knine +2spgn +hhtqxplnxconeninenine5sixxqgrjccpb3four +1gstcjk3 +eighttwosevennine4gdxqbslpsdm9 +29onetfhcfive +sevenvthreecclcfjtmdplbvhxhb7 +1sq2 +qceighttwo8qcdeightnine +xhbctnhk5lnxrmldqqndvcxvvshsrvrvpcczc +sevenzjmllngfnjbrkgc6 +twojtf6 +ccqrlcgeightsevensix25 +eightzkfbst2threeseven +sevenqdcnpcqbfoneflpzjkpfkmnine8 +6gkvmlrheight +bndmmzfiveonenttqzftp3fivemchdfr +99jcnkfks9vxtqltmxsvkjlnrfive4 +c51seven2 +eight8777one +4qpgjthreelrjrzdmjsrrchkheightcngp1 +jztwo3four54tngzbftvhtwojbznxhbdb +five8nine4sixxdhcnsghx7three +57oneninehpqpzvjbjb +fivenine7sixskmmzmzpml +tvoneight3xtbvffvthreezcbrgk85eightsixbdgqspftkr +zvqvpxjgbhd6npheight52nine +1dvs +6eightvhfnlv5nnljzsggseven2tsvsmqsxfm3 +four7rckdrdf71 +5bgfc4rnptrzx +two8onesix +m8one4foursix +8124six +97eighttwodqqmpdhxlvvtxxggfour +eightnine58zggqsjqszpxonevkmstfg +tpbrdr8fnxg8threektbjfltwo7 +25fivefrl6tkhcjninezp +4seven8635 +n9two6bxoneeight +vpkqpbg8g +7fjkhndseventwotwonine8four +zm58lgzzgtjfourlxnmbpthreetwo +5gtjxtqhpkqfour4 +9fnone7sixsevenzqtndjeight +333threeninetwodxsqtvgvjz +threejpfkkgcthree2eightmhfgrnine +t7five9bzgxh5rcjxt +two6two4six911mszcfbmbkn +nh76sixninefourone7 +2fhbglnppmsixdpvzf4four79six +two765slgxvmdht +nbfjvhfxx26clnvc +blhmsixceight9zchkdzgj1pkgjt +hjbdbkjjcgxxtfrhng37sevenxcvlnszxz +vdzzrpbc67sixdvmmjlcxf +ponefourfour4 +sevennsxpzdpms1twofivethreednfive +4eightrncxsvpfftrhqmlnine +15qhpvsevensixoneightt +nine5onepphninefoursixqj +srbsfourone5 +59threep5sixseven8 +five32eight5eight +9threelxrzmnhfxqlsnpttdtn29vmcbflsrtj +21five9 +jtwonentpp8tbzdgcbzjj35nine9jfnpgdpr6 +7fiveeightoneightvs +sixfive53two8 +16onesixfivexxzmthsconepjpl +7threetwofoureightnrfskqshmgqzsgkht7 +3cprgg +sixmgxfsfcg2qmrcvj1 +86dth59xkclmzsmpvv +pbtqqfsqgxfiveqqgtfxk61kone1 +jcvmbflcqvd5seven4eighthtx +four1sixbcmbdhprf +bdgkrgkrtj7231ktxnthreesevenrhvdmdt +9cvsmgzprlk +zbkzpjh47htcplzrxfourfive +four88one4 +47sixtdfkv +onesixg935nzsnxqspfqdrd +7hmfivefivesevenjdjpfive +72rqc76jmvr +1two4 +six6four +nine4nineseven5bdkm +twojkdkrt1twosixtm3gjcdqnf +two22 +xbfzg57159 +rnfd7fpvbjgg8 +glpgbksgc85fivethree3eightfour +threefive36tzrdfourpfsqzmh +seven1nineckpznbsevenone +fivegpgsvvtvoneseven3two +threesixqnxjgzjtdn9xgtkq +6fiversgtwo +43eight92 +2onethree6 +5three55bshbhfjfqclkvhdhmbdqjlqnnskkmxl +cthdhxxjvzdfnthreemghlvt4threeb +44mcvpleighteightbtbvqfvf8lnbstqrcbz +5542727zkslrpth +7sevenninetprljfmfdjdk1fourone +fourninesix91phfzbmzx +vjdjdbckqktwoctwo3three9seven2 +bmeightwosevengxnkccpppmseven1fivethreethree +njxtrd7nl3xxjmrzrk82xqhllvt +4bndqkqlfheighttwoqrsqscggksff6ngnvfdzztqq +dqhxhdthree7one2one +8nine329tqr +mfmgpxmdnpthree8two1 +frnbxnsfivetwo2 +pbrljz8pbppkhfqtkmpgqrfivexpxvfmngzzhs +1kmrjljlpszkfhxxxkfour2eight +threeseven6twothreeqzbhqpqjlzqxpvb +6threeqmlpxbnqnfivefvdlsxlmsph +nqkvvpsix3cqdnfpxzgnnt +four8three3dthgjm44 +2qhgmgbnsjlsqsmxq8eight7nzbjthreefour +8lhlpbpzszdckgcsfbone +4tqddpdjhg661onetqmqzsrnjqt +86eighteightonefzjrbgvtftmzvxrfmxmfp2 +jqbfjxpn5sixeighteightthree33 +ninetwo93zczhjtxfcz +stn83dthgbrpxdb +sixsrzsdrtkdqmrnmjz186four +43nine78rchxzd8 +851lhp +5mqgcc +threejsix1kjrseven7one +gqtqktdzltwojlldjfxfqqzss61two +pj6llpzkvjxccrxkpfjdlmcqcknstdgkcgpvtc +2sixsix26ffpghkdz +36nhgntqjnsixeightzrzslheighttwo7 +9sevennine2 +nine23phtznthree +gmqfzxqrgvdsdfs5 +onefiveqgksmnone2 +fivesixxbzzdnxg4fivesixglvqlfvfc +7fivesevenmmlnftf392vngtrkcgxj +7fourfnqthreefiveonefdjrsqbrtqqfpqppfndfnrg +eight3gnrskgn +two3eight +173xr6 +zkqfivesdflnvhmm4three6eighteightqctcnm +four64vrtktbbchfssz +2xjnqrzrrsixsix +58sevenvgcplhtndx9seven74nine +jzqtshfcjrlkfive3twoeight8eight2 +threepxmtonemccbhpljtgsmvqmqpnhkgxmd22 +1nn1eightseven +xztfgc3twofive2seveneight7 +lxgbm2ninemcss +frkkkkvlhdnbbtvbjtjbtpcpvjkkmfourmvthreeeight3 +fcztz33fsqllqt141 +qbjeightwo6bjgjdgrqqmkgninethree +zk793vvsvgkxvpkmqkrgccbvmprl +fivesix93 +58pdmclsncs3 +7ceighteightonethreefiveseven +6mfkz249fivebclxg +8eightvvzdt6gcsqlxrtdbmqhpdjjskeight +onesnine1 +onevhhqxbnqsr37twoonefour +seven932zjfhplnrc1fivefive +8jtchfqrdhnsn +sixninefour6lpmmhmzlbtvtrpxsjlldvqj9qvdsfdzft +cfour34542 +hdhkgdqcnt5nine87dxbhctgqxphrdpcv2xzrdljqt +75vplkxcgrsix3bxdkrncdkt +nsj288636htbthree +8sevenseven +58five16eight8 +six95four44 +rbxeightwo6sevenplbhnbctqzcpcvmp7xrtwo6eight +jsjtkmz6 +nine8six2ninenq8nstthr +eightddsckkqlls23 +2ch2gbxvkqrfflqcdfxdfour +nrmmjfxsmcddk7onepcpdfkvjvhdhxsevensix +five6snkgvkzlkh +fivesevenfour9jslninesevenjtttt7oneightssr +8five1jjdtpx +eightsixrkthjm8281 +six242 +eighttggfourctdjmb7fivethreeh +sevenfive88sfgczpncmx +jtxxcsfmvfrdsgzqjdjxxgsrfnm9fivenine +seven48onefbbbpdhj5sixbgvfzpnp +fiveonenkksknhtcpsevenrxn7 +ztv7onenldv9nine +nineoneeight719 +tzpfllbninemsixfive61three +2cbmdzdzhnnx +tnpthreelvczcqhsflseven4msfzzltvmnprlq4 +8twofour3twokbvfkgfpq +eightgtpfsqcqtwo9 +htmvcztjsq5five3xjlbmmxvlnv +fourp89 +4tdxjtl7fmhlqfvkz +pxqg2 +45zzsevenninevpbtlqsix1 +2threedrmgj98one +35ninenine +snjqxsgqvn3sevensevenbm3ptpfive4 +9onevmfdlrzninethreebdr3qpvtqp +1eight6fivedtmxsrqkg496lbkvsmz +48vkmdsqhpzjghhsonethreethreezgfgvclhg +vnkvrxpmkvfour3 +ninexdtwogzjbltfours6lpkdj +n7rzskk61zqk39 +5fourcjnzfp521 +rcdbsqtmhgnfjfjxdskeightckpp8five +kvbsevengxmlncszddnmhzkpxlxr2nmkhm9eight5 +5gssevenqhmxmnv4 +nppqflmknine7 +vxkprrkfgsevenmfxjmnsevenkrzzlbshc6rzb +663fourfourkzpmzkzfour +3946sixninepvf4two +5qpkcgpmp6vrqtcqvsqbmmvrjtzkbtrftnine +fnbcn53zrn1eight +qtwone4dffhkjhjrqtwotwo +rgdz3rgqlzljxnpqntvzz +fivefour852eightwosx +8129rshnpjoneqrf +1hnrgkptsp74fdpvp +sixfoursevenone42threedcbm +four9lbkpjdrfznine29two +five2pdzldgrcrfzhrv2rzsfgmx25 +5nineqccvxgsshonesixlh2kgx +eightjzfncrxvlxeighteight9eighttmc +n29onesevensevenqxqnthree +6dcmxbqjtcheight84 +88jcsltgmbntwo4cxmfourone +1four4two6six5 +oneprptq6mfnfnm +4fdvvlk5nineone +one8288 +pxsvfzxd1 +six3gtlqvsix4zrbvfpsxjs +nlctwone5fivexspzrtm +five9nmzjsvntxct +threexzpxdtdfive6sixldddpxmxbmghmpdbd +sixsix1onesix8ninenineone +eight56jldskgmsjbnine159 +27one +eighttwo93sixfivesmgqfzspxvkztzxssseven +seven99mnnsbhxsrzvnhsvdmbpzqqdscl6 +ninetwothree2 +fourtrkdhszg4pjh2goneone +six6three5ninezpvc +79qcrtm8fivex5three +ljtwonefivesjninetpzhsbfxthree2vknbffmq7d +fivesix3 +95threebfxqrj72 +vqkhzxhthv4hdrprgsxjp +fiveprmznltwo7 +62c53fourtwo9prxbqhjf +one3zndsclzslt71bftv +2mjtbmnkjspsix952mk +34nine +gtrcfour7threevzmvlvhpf6 +lx5seventvzxlng +2kdlxgrdlqlfivecvccqxpjr +tmsqtqszspnskbmcsevenllstfh4ztn +eightlninemr5 +6one1jlplpzppt6 +7cvmrrclkfcfiveeightxrvhqqsjbblglt7one +cpvpftjrgj5jc +koneightkk7dbtkdmmbf +2krk842mbqnpthree +three7three +one3nineseven +4ssskfrfqhz9eightfour37oneightjm +jgjsfouronetwoseven6 +bkcninekjtwo1two +5two8onetwo +keightwosevenzsxpsgrzsone4 +jcmbkmpfourthreefivepvhkbtpqln9 +4vcprm7 +7qckxksgfbk6four5onesqfxzxm +5ninesevenfour5six24 +7sixfourthree +6eight58ptdrvgqlbc +nine8sxdbrvgxv +threebhnb6threebjbjxcq +threecbdtbftvcv4sevenfour3 +onehfvsd24 +ninevgbshtbprzfourqmclssgtrseven8zsgnqd +vrbcbsjdqzbjztmphk5 +25sixjrjqgl5fivekhtxstwovgxzfpvzfmoneightb +44bbpdhhvnptwoone29 +8eight78four +gcfiveninezjnjzqfourthreelggdhvgj4 +lfgsctldtkfdlbsskc99gbvjd1eight +xftwojgjsctwoptwonj9 +xnnm4sbx8 +seven986hkfone7 +65rdlfdxjeightwox +26fourclxlrcxjpkjvdhfseventworqsfnhmnnq +nineninexrk2twovdn6 +onesspsrctxsfn6ninesix7 +5c382ktrlsdlthree5jm +eight5one2 +fxzjcbznjj4sbb +cndp3 +blztpftbr3fiveckzgninebkms +td6 +one3sixfivevrvrnzzzq +8sixfivenzmnlts +one4fivelrlhonenbdfb +1twofivenine7 +four9ninetwothree8three6 +foureightfoursix2fivepkgzgmbbbc +rfftwonekccnsn28btwosixk +threetwo1foneeight +bzrzgbzdm23 +onefgqfzjnine2dvqzn +xgbjxnh1jtt +67ninedczm +ninercxgj4txpflzvhgtwoneqh +8four9cxdrdzrkn55djgbchdxgn +49seven7threeeightwokr +sevenone7qtxp76 +391two87five7 +dtpzlzxkntcvzjsevensixvflshlqxbnxtmfjnr7 +kkzkpdztb868nine3p +rxeightwomvsnt5 +85jkzsrtszdgxssm3eight2fourfour +jpjbkglsevenrhjrvl9svmcgshll +onetwonine4noneightvk +nine5vnlone +44hqbb4 +1seventwonfbmllcfnfivesixfourfour8 +5four4rjjlxhcvtwo82 +eightcjksmqq9rvshzgjbnmffbz +onefive11381rl +2dpkzggxxnineninethree6onexkllm +zdvbclq85xmddtggv9fgcsjm3seven +eightsix9fourfour +fourhrx7 +fourlheighteight6 +sevenplhqxqp89six +5mdlbrq9three85sixcsb2 +t9svczrjvmrtwothree +oneseventhree25fdq5jmbjmcthzp7 +pgzb31xfhkghbfljone6oneqkbg +vxqslqlfvp4five2zxvqdrbkt +two9six +threeonetwofvlklrmrkseven7mtldnsxmbs +eight6sjflkmczj +32three52sixfnqtxnnzztrt +qqtdlghsp8ks5two2qrmpjgccj +dknbccdfpr1eight4sixtvhfc +9mbc +pmpfprdkgblrnbf335skpkvxgstlzsevensix +sixeightkfs173mbmsixsix +twoqgptf1mfnpvxvlkrnxnine +54hpmzgm2three +1four8 +three11vkzqjzjncgj +nine19sevenzfour +4onen5fiveone56 +eighttwo2325twofourcb +lfpgbrvrfv47sckdqlqdblkjn +1qsgxhxtwo +83mgshbbrdpmseven7 +dsix66fourdzvqdnqlssjnine9 +3eightfive88eightwor +1djmjfive +dvxlvjthvlkrrc1 +zfgpndbflxmnhnnq9zx4 +one5twooneseven67 +13sixdgpmgseven +mheightwo1six4onethreegcxzvspnrqpngsmbplvhc +86sixlkdnnqqrkf6fjkvzlfxhhcxxroneprgrthhz +bsrsqjlskjbh1onezprh2one3four +6pnxslvxhsxeightoneeightsixnbdtkszthree +vjpp1931jdbrtdjrzk +7one278ninexgfive +mjkqddthpnineonetwo5eight +2gfmgdjkzbbf +5phlkvzbqmmxbfckcjjhfvone +8xjsevenrlrlctclvkc54one +1tqsnt11 +mmksbhrfour4ninefour3 +91fivefive +5sevenjdxdrrgxbz +threetdcdl531 +685eight3two +nshfeight6eightonenineeighttwo +threenineonermgnbjjzx8 +one4oneseven +ninebdpztnllhdvcbbpvcptpdkpvjhxrtmnmhllrnxvlgm64 +twoxhgcjdpx65fivedztfxzbdfive +999nine +seven6three8bsrqkfseventwo +6jf +sevenzkrcbxp6tmzfjnineg +b8xlrbjnrm +nine9fourtwothreeggg +seven8ninemkqxcbjdzzmrhjggbg5tksxtfcmg +2vdqplbceight +5drone +jxqczvknhmbxrdthree659qjxlrxk +5onefiveone +seven583sevenninepnbzmeight +14qb153 +3twohvplgxqqlzsgsevenone +78mpjrpmkponefive +6fmqpjbtv616 +325dj5lvtvbx +dzjvsszzonelbbvpnlkrctztjxgg9eightclxrqrzpmmgpzpmsxlfive +6lsseventbb8 +9tnqfksfivenine9 +5dbssjr +slbqhmrg3 +48oneeight9two84 +zxgcx9kfmxcjsseven +4nhb7hksxlpn1seven9 +seven4qvvzlbjnbhpp42one8 +twoeightgcpkkninejgfvzfsrjbtwo1 +846kmvbjpseven +33ndkljvxbxpjcrgjvct513 +6tcghtcbcgh9xgz3onenine +five72rfcmktxkvxvnstwo +seven5tkqbjgpkdqtwo773kcfznv +ninesphdrdxzvvvdfcpsvc6 +6q9pjsdzponerfnqt6eightwob +ztmjlr1srmgkeight +lsix2bcfz43mhpgldvlng +6srrmfdvtgqgeighthcvzpctzpdone +zntvlvtfmvntcvjxqffthreectlnzst5onekpxvmsvnb42 +threethhkkrqhkpvmfivefour16three1 +53fdhjxldlxxthreethree3six +nzhdhtcjbseight47sevensevenlmdtjsqlpqcmqmbvp +4bvsj +1ninesixtsbgdvhseventhree9jpmrvpdzxb3 +czqzzbbfcnzfive3bvcrvvhvz +53bqfhhrsevensix +2lmrjtkffk5 +5fjbdvxjrcrtvmjdttjfs8 +x1jtzzclsdnfive7four +5jnvphzlpphfivesix +jfkhkxvlqrdkbc67rqfcfh4rvprmvcone +k9sndkdgvzjg9threenine2 +ltwone1 +five5jhnine +5sevenlcnxcpgdnzrftsn3threenine26 +h6fourgqfczsjtkfqpcmzfive +5eighteight2 +fclsdrjrthreebvjspsoneonefivenpfszjfqcd1 +twofourfive1qbrndpvone23one +six4ljzxxboneqrhgvg26 +klhsqnkrqhlsfivesixthreesixfive9 +9rslrdg +15xfdsix +zbzd15cgcrn31 +fbqvdzgsvlsix4twoeightpjzdhpxxjkq +79xlmrz3tcgvfvqf +5csjgmkpkthreefgjqvtdskbvxk12 +vrdlmzcpfour6trmt8gtjfpftdkgdlq6 +rctptptb5fourttds +gfkvkcbkfsbvmbcthxzbfs9rzdnine +4zmkhjrcbxvdp +8ftngfour +fivefourninefour5four +3vfjtjngsevensixfqngpjrpfkcsdgctseveneight +vpqeight11plkjc +threethreezldtgz3hscrb +4sixone7qlgv +twofmqgtnkddkrfdtnhrone7ntq8 +tvvzmvxhjseven7four5nine23 +two3fourdxscvcljhrjmjlpbxgcninefoursix +six4twothreesix1six +4rj4twohzjs +four8ninesevensx49m +onernjnjrqsjhnp9two +3hsjlskjpcvs1nine +587 +one7threethree2 +dtsfhss6sevenseven8 +honeight5one +1eightworg +6eightvpxctxffive +2x6pkjntnbrlhjfkgbvp3 +9rrhssqzdlcmmjvqvrkvqpfonetwofhfhzktfzzdbjbj +5mxhnqdg4htcqxtkccghgrzktsnzczfqrpl63 +sevenseven7fivepgc +8onecctzfxreighteightwoq +mpfjlf1twofbzzhl3ljpfc41 +ltwone3 +dfourfive2 +jlnxxb2one +1cnxtwo1 +rmfjddmhh16eightone +bgrzn28eight22 +vp55nnjtfzjh8rjmzxxxdjs6r +5ghbzsbxqt94threefive +6tjvvtrhbglntone1bflzxmzvtr9ngd +zqlfffptkp2eight +six8threersgxztgnvrpjzjhgtprqbgeighttgkmgxvlpxgkt +zxbnqeightvhsnm95svscpcjhth5ninefive +jmgpmfxtwohvxsfr3seventwo +ncpgtpqfivejnblppxtn8khcjzpk +sevenonethree95 +hkcvxrjjshkdxsixbpjl62fzrzpnvtqg +cxzvnn52ninesixtwoonergjdktpkl +93nine +11fivetwo +8qmhfoursix156 +twofivethree27 +sevenlnjqseveneight6fivepvmz6rdbxm +vlrvxfourshqpprchjx3dcknntththreeseven8 +2three7threemscjggthreemkxmgg1 +43hghlbtcbf +jhpcdczrxgpktvlseven4shllbs2three +hpthreerhkgdtksk66fivesevendxxzfm +four3dqqglksxk +eightrhmvhzxlrdjvjvpzhzzcnvxxdrjzl9sevenfourlcqksq +9sixxcfq7onebmp +8keightfiverntpleight +jtwone831 +qqsksdcfsmvx5lhfgrl6two954 +8lhjzsjgms +8ninenjsxtzqkmn +gpffcfqxlr84one4lzpfkzdkpc +svncmqmvstwoqgknfivepmjll4xt +five3kkqzrbtvvfcts4three1four +4sixseven8five3five +six9twosixqtldl +2fourfq +mjrtwo7ninedqsmxskpxfc9t +onenvjnsrvjzrqspsdbgjhdjrzrfmxcxnc9fourtvgpdqzxvb +478xp5mqgnninef +mtjtzgflgztgsqpxskp37zm +hgsxdpttj64mthreegzptcsfour +eight8vfgtgftwofqtjvskxnnthonemgdhjzh +threeseven6llbgbrbptthree3 +one8two9fivefour3six +52dqcrxhzqmzsixmhshnntwo +lsfive5nvvhgsnl +8twoxhgthreebdfgcn8jflhc +297seventwo4ctnbprxgztwonine +3onefourkthx6vn +nltzeight6fggtwo +84431lzgcftv +spf2qkvqcq +3gfbntwo1fournine2qlp +nckqg1four7mhltx4jvdzpjzvj +bllkbr2 +fjjgvvmfsfivetwo5sevendd +7bpmh2zrgsms +fourrdkrgfoursix1 +seventwo52zbdmftninensfdvkhssix7 +sixxkrf4qgtnine2kqhmb +eight7z +rnfhttjjrpdnxxqfkhs9lbsktsmvsixone +61threenfhkskphjjjstnzjtxcjf7five +zhtkvbqchlvthree5twonine3 +pl9dhnzntgkmjhglxtlcnsfc +7eight2sixnine43 +69xfqxbtvseven1four2qr +1k7 +twovdgh768 +6hmjcxsgkvd +7jftfkckhzlqjqtbvmhxrsix +fivencbmjhjbp7 +trgtjmjggtzzjnhd5fsnqnkppkninesevenphgfrfive5 +qcglfonesix23bffsmd +five7srldjmmnhllftzbcdrm +two33gjtxvtwo3ltrfqdmvvpseven +gccvxspxlm6one +zdfjvdeighttkslnjnft7dl74 +ninethreenbvmfpbgzgkv3 +ninenine7njgrzxmnn7 +rtwonenineqxvbgtj4 +sbcgvsrmvtwo2sevenj68 +6dfrjfqxjghbxt +rt5four2 +vscftsphsqsix3 +3eight68d5kf93 +vpbjpqjrmz9fiveninedpzsvdvdfb52grzxlbbqsr +gvtwone9vbmpdznhlfive8two +4bnfxslqgvnzcbsjcrfzv +xtcdvhlkgrjjjmone48 +mzoneight9995five2bdg +ptwo2fivedqxthreesdmbvdcdxrtwonegt +vgjvrfcvbxnnfds17 +27threeeightnine3nineseven +4fiveninethreeqn +68vhkqqcs +sjnzkhxvnine28 +3fiveghc1threems +45jvrhdh2three9l +pbntkjbps1 +slgsx9sevenone7xcghccxqs +twomlm4ksvonefournine3vdxp +four9pvmone7twofourcndpfour +hfdnzvfgqn2 +3fsshkvcseven545 +six45jgxzgjnlqk +slrv18five +78twoninepdghsneightone +two83npblhtp62three9 +hjmpkjvkzhxpzflz96 +fmcnine4vmmtxlmdrntwofoursix +352five7935 +891sixfive8 +4fourmdfpkcpb439sevenfive +3seven69czrrsrzhpm +two5six56sevenlpmrxdthree +npzg6hpmrczqxmn3twommkmzkzhgkcxrtwo +f498hhvtrnhgd16bdcd +5sixhxdjmkkmdbskls +fqfvbsfprqrhlgrmdprx1fvfzvcgssttknck +9one741 +seven54jsjkhseventwo69 +8threeonejjonefivefivekrlvtjt +xcdbx5mqkstvqkbhrdfllzfive +gbf89dsrg6ctwosixppxxbgs +83ktsdjqt +eightfourbcl6797vcbhbl1 +threefive6seven +9ptxjzxj7six4 +onefiveqjjhfqrfzonesix6pfqhxvsq +eight385 +mvsqltkmsrzqzdgkf66onellkvmtv3two2 +khztwofour7tfnvhmsqnnqkbfdjgj8 +msvhqzqfivetwoschjghsm6 +lmsxxt43four +hdfdltsrtwoseventbqr7pckgcqtcgh8onetwonez +1sixeight +1t3qtqgnvdrteightthree6 +6zb997 +four83dg +4four2xqnpqvgkmh +cbrkm6seven27 +9rxrddhlfiveeightninesixpdfznbhrfrvjnjd +one8seven +7onegpllvh59bmponefpjeight +one4fftcrjntqpnzqlfive +9hgfbffour67two +nine6tworqjv +4xggvdktqfour6fljjxflkflqzeightcbsf3 +eightmqphonehgthrpfvmfthreethree8 +1five4xrgqxn +vkmqljhpcbonejjsx6one5one +two1five2dgftmk13six +eightmrv1eight +gkzznsmt429 +fivetwo73mhpmbndgvpklzhqk7 +84sixlhfxnspqjveight3onedrksx +6six2lnxmr +7rqsmbkcv +4jkbdtpsppseven32sevenqqbvm4 +two8vhhdsnqv +qksb8klxlv74891 +ninesevenfivenine26c +sevensixnine81zjg +three7bbb66 +three7vmnine8xqkmtfmpnine8 +2zhtwo4eight4nzjcvmjtdcv +eight57 +six3xs7zpdvltmmtnhtk +fourvfxnjddkjs7two +1mzmfsfnbqfgqvft7two +vqbdzhncsj7one13twosixxlngtfive +threel94seven +threenine299 +jqkmcsqtclq5636six84 +8gvd68eight1 +t43 +3bv4one32 +3onepvjdjpfiveqbgzrmktm7tkhbp7 +459onetvsone +nineggxcstltptbsixthree6glqhxdgnjp6jmjcrm +hhnvqptdkj9one +nine8four8897rgfs +onenine16dgkjnfkmxqfninervgcqmxsbtwo +two7eightzrpone +xkbcjqnt4fourdpsgbqf1three4 +27jcbntptlmldhnzmkgqmm +vfcrlftnb5mzbbsixeighteight +tnqkf4gseven56czt +teightwo4 +8eight1seven36slslntk +tnqkj9 +five84psznfjvl5onefivefour +nsjlsrkfour33 +sftkhmxq89hsvcsznrdxfcgprmjcktbxkbnkvb1 +six33 +rmbnnbnrdg7sevenhsrrnjvn2 +qhthj75bglpd2hlpxst64 +lmcdttjzrnxdnn6pbszxcxzxmhxj +62xvvkpbhhbthreetwooneeightwozr +mtln1fvmflgtrq94threeeight +7five6 +8j +1threehvkrhfm3mgsk2six +zlrvhfhpglnkpnm4lzljvzlgrzthree5three +scqbffjvdjhsrfsix7twonine +eight97 +6five1eight +31kvxzjpgd3 +sevencsgvmxbtgtp7eight +sevenpjnbgtmsninexfbh4mjdmgsdtdb92 +five11nqgttpfj +tnxxs729k +1sevensixsptxkmncrkfxone +nine1fivefive16twoqm +575xtbkrbnlrrtr7hfourmmbrgtjvj +three8gseven6three9hkkvjzvzlz +eightstktmqdn8mf48four +298xqtwotwo4fourhhhcblpg +7xpqpjdlrmtwo399tccfour2 +64xs5njxdnqvonekrsbfhlvttdjp +threehgzhfbqjzktwo8 +1jjgvxnprfbmcthlskqjqqzrr1 +nvpbcbsgbf6eight +vvkvdd3four +7onesevenlrmngnineseven6one +22three +msfbjpnd1seven6 +2fivethree2cp1six +7two733 +8sevennine4hsgg +fourfive293three +onedtrbdcdseven6twosvlhbdfive9 +8five8threeeight +gbj5hcjtfgbxppzdcf +sevenbbbj7 +msevendfkqzz34 +skrzfqonemzrcxdpdb2 +twoeighthfsgbsmbmsqrsknrdxrcxshfndvmhfzj1lhhtkktlxeight +178fbvcglzshfzknffgprnxvxgqnhznine7 +two13pxfvzxnqrq2tkdfsfkbbgkdt9 +sevenjbs2fourmjglztjfive +58five6vhm311 +gngfzhcdhmczsffrkh5nclkcfcnfivefive28 +883nr7onesttq +eight8four147vmtpgzbpft +6dbsixtwoonenine +three3tlx +jlhlvvztsmctvxndlnvbxk1 +qlfmbmfkfm98m +fiveseven5786cmthree +7tgklbjhhcxndvk63sixnine +fgjqhqvtwozjfxgxpkz1six +3dxnvg4ninetwo +5twoone9lnvdxhctn +dnjpqnplxq9rxfour6one4slqlhsnc +tgkfourthreetwofive4npnnvthjgf8 +tjzjppnsksix4 +lmfkvgfzfmhxqrcvsgt28ssmhm5fivethree +fourninefjxpvpbnhm29oneninesix +hmxjs2sevenfive68nine +five3eightsfvftdxl +35sjcqtqpqz7fiveeight +lbchtbsnhmxlq1rcjrlvgmdjmjhtk +2gmzrn34eightkdpsgnine +sevenljzcxlgpskvkprjb6 +sixkbsdxjvsncj2four +1sixbl9seventwotgtfcstqgv4lc +89threeseven5tnshndjcsxc +42 +ninesevensrzxkzpmgz8kcjxsbdftwoner +4gbdzqtddmt4eightsixfive +dljxl7five6nrzfh5one diff --git a/examples/aoc2023/day01/part1.jou b/examples/aoc2023/day01/part1.jou new file mode 100644 index 00000000..9181f6d4 --- /dev/null +++ b/examples/aoc2023/day01/part1.jou @@ -0,0 +1,25 @@ +import "stdlib/str.jou" +import "stdlib/io.jou" +import "stdlib/ascii.jou" + + +def main() -> int: + f = fopen("input.txt", "r") + assert f != NULL + + result = 0 + line: byte[1000] + while fgets(line, sizeof(line) as int, f) != NULL: + first: byte* = line + while *first != '\0' and not is_ascii_digit(*first): + first++ + + last = &line[strlen(line) - 1] + while last > &line[0] and not is_ascii_digit(*last): + last-- + + result += 10*(*first - '0') + result += *last - '0' + + printf("%d\n", result) + return 0 diff --git a/examples/aoc2023/day01/part2.jou b/examples/aoc2023/day01/part2.jou new file mode 100644 index 00000000..ea9fe8e2 --- /dev/null +++ b/examples/aoc2023/day01/part2.jou @@ -0,0 +1,38 @@ +import "stdlib/str.jou" +import "stdlib/io.jou" +import "stdlib/ascii.jou" + + +def parse_prefix_digit(s: byte*) -> int: + if is_ascii_digit(s[0]): + return s[0] - '0' + + strings = [NULL as byte*, "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] + for i = 1; i <= 9; i++: + if starts_with(s, strings[i]): + return i + + return -1 + + +def main() -> int: + f = fopen("input.txt", "r") + assert f != NULL + + result = 0 + line: byte[1000] + while fgets(line, sizeof(line) as int, f) != NULL: + first: byte* = line + while *first != '\0' and parse_prefix_digit(first) == -1: + first++ + + last = &line[strlen(line) - 1] + while last > &line[0] and parse_prefix_digit(last) == -1: + last-- + + result += 10*parse_prefix_digit(first) + result += parse_prefix_digit(last) + + printf("%d\n", result) + return 0 + diff --git a/examples/aoc2023/day01/sampleinput.txt b/examples/aoc2023/day01/sampleinput.txt new file mode 100644 index 00000000..7bbc69a6 --- /dev/null +++ b/examples/aoc2023/day01/sampleinput.txt @@ -0,0 +1,4 @@ +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet diff --git a/examples/aoc2023/day01/sampleinput2.txt b/examples/aoc2023/day01/sampleinput2.txt new file mode 100644 index 00000000..41aa89cf --- /dev/null +++ b/examples/aoc2023/day01/sampleinput2.txt @@ -0,0 +1,7 @@ +two1nine +eightwothree +abcone2threexyz +xtwone3four +4nineeightseven2 +zoneight234 +7pqrstsixteen diff --git a/examples/aoc2023/day02/input.txt b/examples/aoc2023/day02/input.txt new file mode 100644 index 00000000..d3ee472b --- /dev/null +++ b/examples/aoc2023/day02/input.txt @@ -0,0 +1,100 @@ +Game 1: 3 green, 1 blue, 3 red; 3 blue, 1 green, 3 red; 2 red, 12 green, 7 blue; 1 red, 4 blue, 5 green; 7 green, 2 blue, 2 red +Game 2: 1 green, 19 blue, 1 red; 8 blue, 4 red; 3 red, 6 blue; 1 green, 1 red, 12 blue +Game 3: 3 green, 1 blue, 9 red; 1 blue, 2 green, 8 red; 1 blue, 2 red +Game 4: 6 green, 2 red; 2 red, 16 green; 3 red, 1 blue +Game 5: 5 blue, 1 green; 3 blue, 3 green, 3 red; 8 red, 1 blue, 2 green; 7 blue, 6 red; 4 red, 4 blue +Game 6: 5 red, 20 blue, 3 green; 4 red, 20 blue, 3 green; 12 blue, 3 green, 1 red; 3 red, 3 green, 19 blue +Game 7: 5 red, 3 blue, 9 green; 12 red, 3 blue; 5 green, 3 blue, 19 red; 6 red, 1 green, 3 blue +Game 8: 9 red; 2 green, 1 blue, 7 red; 5 red, 2 blue; 3 blue, 1 green; 1 green, 14 red, 1 blue; 3 blue, 4 red, 1 green +Game 9: 11 red, 2 green; 13 red, 8 green; 15 green, 3 red; 1 blue, 9 red, 18 green; 2 green, 12 red; 15 green, 9 red +Game 10: 1 green; 16 green, 3 red, 2 blue; 1 blue, 16 green, 4 red; 16 green, 5 red, 2 blue +Game 11: 2 red, 18 blue, 5 green; 4 green, 12 blue, 9 red; 6 red, 4 green, 5 blue; 8 red, 16 blue, 2 green; 1 green, 18 blue, 13 red; 13 blue, 9 red +Game 12: 5 red, 10 green, 4 blue; 8 green, 8 red, 14 blue; 10 green, 17 blue, 13 red; 7 blue, 9 red, 13 green; 6 red, 16 blue, 4 green; 16 blue, 14 red, 16 green +Game 13: 6 green, 1 red, 1 blue; 10 blue, 15 green; 1 blue, 2 red, 5 green; 2 blue, 1 red, 20 green; 3 blue, 3 red, 10 green +Game 14: 2 green, 2 blue; 2 green, 3 red, 4 blue; 8 red, 1 blue, 1 green +Game 15: 3 blue, 10 green, 1 red; 16 red, 1 blue, 20 green; 7 green, 6 blue, 13 red; 8 green, 20 red, 5 blue; 8 blue, 8 red, 18 green; 17 green, 8 red, 10 blue +Game 16: 6 blue, 5 red; 6 red, 16 blue, 11 green; 1 red, 3 green, 13 blue; 1 red, 5 green, 1 blue; 3 red, 14 green, 16 blue; 1 red, 1 green, 3 blue +Game 17: 8 green, 5 red, 7 blue; 2 blue, 2 green, 6 red; 3 green, 4 blue, 15 red +Game 18: 5 blue; 2 red, 9 blue, 3 green; 4 green, 20 blue, 2 red; 4 green, 2 red, 5 blue; 16 blue +Game 19: 15 red, 1 blue; 3 green, 16 red, 4 blue; 1 blue, 3 green, 4 red; 9 red, 2 green, 6 blue; 2 green, 5 blue, 4 red +Game 20: 12 red, 7 blue; 11 blue, 7 red, 1 green; 1 green, 10 red, 4 blue +Game 21: 9 blue, 1 green, 1 red; 4 blue, 2 green; 1 blue, 2 red +Game 22: 1 red, 10 green; 6 blue, 4 green, 1 red; 6 blue, 12 green, 1 red; 3 red, 4 blue, 10 green; 1 blue, 13 green, 1 red +Game 23: 14 red, 2 blue, 3 green; 8 green, 2 blue, 4 red; 2 blue, 7 green, 4 red; 4 blue, 7 red; 1 blue, 8 green, 13 red +Game 24: 1 blue, 6 green, 7 red; 6 green, 2 blue, 5 red; 1 blue, 3 green; 2 blue, 9 green; 1 green, 4 red; 5 green, 4 red +Game 25: 8 red, 2 green, 6 blue; 3 blue, 15 red, 1 green; 8 blue, 2 red; 2 blue, 1 green; 2 green, 18 red, 1 blue +Game 26: 9 red, 11 green, 6 blue; 1 blue, 2 red, 16 green; 15 green, 11 red, 6 blue; 3 red, 13 green, 6 blue; 20 red, 2 blue, 4 green +Game 27: 9 red, 10 blue, 17 green; 8 green, 15 blue; 4 green, 3 red; 11 blue; 14 green, 1 blue, 8 red; 10 blue, 5 green, 3 red +Game 28: 2 green, 17 red; 7 red, 6 green, 6 blue; 12 green, 16 red; 7 red, 7 green, 7 blue; 7 green, 8 red, 5 blue; 7 red, 5 blue +Game 29: 2 red, 2 blue, 3 green; 3 blue, 1 red; 3 green, 2 blue, 1 red; 6 red, 1 green, 4 blue +Game 30: 8 red, 15 blue, 4 green; 5 green, 9 red, 15 blue; 1 green, 1 blue, 11 red +Game 31: 6 blue, 2 red, 1 green; 2 blue, 2 red, 8 green; 2 blue, 1 red, 7 green +Game 32: 6 red, 7 green, 6 blue; 9 red, 6 blue, 6 green; 1 green, 13 red, 4 blue +Game 33: 3 green, 1 blue, 9 red; 2 blue, 12 red, 4 green; 1 blue, 5 red, 1 green; 4 green, 5 red, 2 blue; 1 red, 2 blue, 3 green; 3 green, 3 red, 1 blue +Game 34: 1 blue, 9 red; 3 blue, 4 red; 3 blue, 5 green, 10 red; 2 blue, 9 red, 5 green +Game 35: 3 red, 2 blue; 1 green, 10 blue, 4 red; 1 blue, 5 red, 2 green; 5 blue, 2 green, 1 red +Game 36: 9 green, 6 blue, 1 red; 16 blue, 8 green, 3 red; 9 green, 8 blue, 2 red; 3 green, 3 blue, 1 red; 16 blue, 3 red, 3 green +Game 37: 1 green, 1 red; 2 blue, 3 green; 1 red, 1 blue, 5 green; 1 red, 9 green, 2 blue; 12 green, 2 blue +Game 38: 16 blue, 12 red, 4 green; 15 blue, 5 green, 6 red; 7 red, 12 blue; 19 blue, 15 red, 1 green +Game 39: 1 red, 2 blue; 1 green, 10 red, 3 blue; 1 green, 2 red; 1 blue, 3 red +Game 40: 11 blue, 6 red, 3 green; 2 blue, 12 green, 1 red; 16 green, 5 red; 5 red, 10 green, 6 blue; 3 red, 13 green, 1 blue; 13 green, 3 blue, 7 red +Game 41: 19 red, 1 blue; 9 blue, 6 red; 10 red, 1 green, 17 blue +Game 42: 1 red, 8 green, 12 blue; 8 blue, 10 red, 12 green; 9 blue, 8 green, 9 red; 8 red, 11 green; 12 blue, 5 red, 2 green +Game 43: 6 blue, 7 red, 9 green; 4 blue, 6 red; 3 red, 4 blue, 5 green; 7 green, 15 blue; 15 blue, 9 green, 6 red; 6 green, 8 red, 7 blue +Game 44: 12 blue, 5 red; 7 red, 16 blue; 2 red, 4 blue, 8 green; 3 red, 10 blue, 3 green; 5 blue +Game 45: 3 green, 4 red, 6 blue; 1 green, 2 red, 11 blue; 6 red, 9 blue, 1 green; 8 blue, 3 green +Game 46: 1 blue, 9 green, 1 red; 1 blue, 2 red, 6 green; 10 green, 3 blue +Game 47: 2 green, 4 red; 2 green, 4 blue, 2 red; 2 blue, 3 green, 12 red; 12 red, 3 blue +Game 48: 4 blue, 3 green, 16 red; 1 green, 2 blue, 2 red; 9 green, 7 blue, 13 red +Game 49: 4 blue, 5 green, 17 red; 1 blue, 13 red, 2 green; 15 red, 1 blue, 5 green; 4 blue, 7 green, 19 red; 4 blue, 3 green; 2 green, 2 red +Game 50: 2 red, 3 green, 7 blue; 1 green, 9 blue, 1 red; 19 blue, 4 red; 1 green, 13 blue +Game 51: 2 blue, 4 green, 14 red; 8 blue, 17 green, 7 red; 1 blue, 6 green, 19 red; 20 red, 17 green, 6 blue; 2 green, 1 red, 9 blue +Game 52: 13 green, 17 blue, 2 red; 18 red, 12 blue, 10 green; 11 green, 17 red, 9 blue; 7 green, 11 red, 9 blue; 12 red, 15 blue; 7 green, 4 blue, 5 red +Game 53: 2 green, 1 red, 3 blue; 1 red, 1 blue; 1 blue; 1 blue, 1 green, 1 red +Game 54: 2 red, 5 green; 3 blue, 3 red, 2 green; 1 blue, 3 red, 5 green +Game 55: 7 green, 5 blue, 4 red; 8 blue, 7 red, 8 green; 12 blue, 2 red, 16 green; 3 green, 8 blue +Game 56: 9 green, 2 red, 1 blue; 1 blue, 11 red, 3 green; 9 red, 1 blue, 8 green; 10 red, 16 green +Game 57: 1 red, 5 blue, 9 green; 19 blue, 2 green, 5 red; 15 green, 3 red, 7 blue; 2 blue, 15 green, 9 red; 5 red, 9 green, 15 blue +Game 58: 5 green, 1 blue; 3 red, 2 blue; 2 blue, 1 red, 12 green; 8 green; 12 green, 2 blue; 4 green, 4 red +Game 59: 11 blue, 5 red, 4 green; 6 red, 1 green, 3 blue; 7 red, 10 blue, 4 green; 12 blue, 1 red, 1 green +Game 60: 3 green, 10 red, 10 blue; 10 green, 6 blue, 10 red; 1 blue, 6 green, 7 red; 3 red; 8 blue, 7 green, 8 red; 3 red, 19 green +Game 61: 11 green, 3 blue, 20 red; 3 green, 3 blue, 20 red; 10 green, 12 red, 8 blue; 4 green, 8 blue, 6 red; 7 blue, 10 red, 5 green; 6 green, 6 red +Game 62: 10 green, 9 red; 2 green, 2 blue, 5 red; 4 blue, 11 green, 12 red +Game 63: 5 blue, 4 green, 2 red; 5 blue, 3 red, 2 green; 6 blue, 2 green, 2 red; 1 red, 5 blue; 1 green, 3 blue +Game 64: 5 blue, 4 green, 8 red; 8 blue, 12 red, 10 green; 8 red, 7 blue; 7 green, 7 red; 5 blue, 1 red, 2 green +Game 65: 3 blue, 3 red, 15 green; 12 green, 3 blue, 12 red; 13 green, 6 red, 2 blue; 1 red, 7 blue, 3 green; 9 red, 5 green, 7 blue; 1 green, 5 blue, 9 red +Game 66: 1 green, 6 blue; 7 blue, 8 green; 2 blue, 9 red, 14 green +Game 67: 1 blue, 8 red, 1 green; 7 red, 10 green, 4 blue; 3 blue, 1 red, 4 green +Game 68: 8 blue, 8 green, 10 red; 4 red, 5 green; 4 blue, 12 red, 15 green +Game 69: 2 red, 3 blue, 2 green; 1 blue, 15 green, 4 red; 15 red, 20 green; 8 red, 4 green +Game 70: 6 red, 4 blue, 10 green; 5 blue, 6 red, 16 green; 9 green, 1 red, 1 blue; 2 blue, 6 green; 1 green, 3 blue, 5 red +Game 71: 9 red, 9 green, 4 blue; 1 blue, 5 green; 4 red, 2 blue, 5 green; 1 blue, 3 red, 2 green +Game 72: 14 blue, 1 red, 4 green; 18 blue, 1 red, 3 green; 1 red, 1 green, 10 blue +Game 73: 7 red, 6 green, 1 blue; 14 green, 1 blue, 4 red; 7 red, 18 green; 1 red, 5 green +Game 74: 9 green; 1 red, 7 blue, 4 green; 10 blue +Game 75: 4 red, 1 green; 1 green, 4 red, 2 blue; 3 green, 2 red, 7 blue +Game 76: 16 green, 7 blue, 1 red; 2 blue, 6 red, 2 green; 7 blue, 17 green; 5 red, 15 blue, 15 green +Game 77: 1 red, 7 blue, 8 green; 1 red, 6 blue, 5 green; 1 red, 5 blue, 4 green; 8 green, 1 blue; 2 blue +Game 78: 9 green, 3 blue; 6 red, 12 green; 5 red, 3 blue, 10 green; 3 blue, 14 green, 13 red +Game 79: 20 green, 1 blue, 3 red; 11 green, 4 red, 2 blue; 11 red, 1 blue, 5 green +Game 80: 14 red; 3 green, 2 blue, 7 red; 1 blue, 6 red +Game 81: 1 red; 11 blue; 11 blue; 9 blue, 5 green, 1 red +Game 82: 13 red, 17 blue, 9 green; 1 blue, 2 green; 9 red, 5 green, 6 blue; 10 green, 14 blue, 14 red; 5 green, 2 blue, 10 red; 4 blue, 4 green, 2 red +Game 83: 6 blue, 3 red, 5 green; 3 blue, 6 green; 13 red, 11 green, 1 blue; 7 blue, 1 green, 14 red; 9 green, 2 blue, 3 red; 8 green, 3 red, 2 blue +Game 84: 5 green, 8 blue; 7 red, 7 blue, 10 green; 7 blue, 7 green, 7 red; 7 blue, 1 green, 11 red +Game 85: 12 blue, 1 red, 2 green; 3 green, 13 red; 17 red, 1 blue, 2 green; 4 blue, 15 red; 9 blue, 7 red; 2 green, 11 red, 4 blue +Game 86: 15 green, 1 blue, 8 red; 1 blue, 18 green, 3 red; 3 red, 1 blue, 16 green +Game 87: 9 red, 17 blue, 9 green; 4 green, 6 red, 2 blue; 6 red, 5 blue +Game 88: 8 red, 6 blue, 17 green; 17 green, 5 blue, 12 red; 2 red, 14 green, 1 blue +Game 89: 14 red, 5 blue, 6 green; 1 blue, 6 green; 4 red, 9 green, 8 blue; 2 blue, 4 red, 11 green; 12 red, 1 green, 8 blue; 3 blue, 2 green, 5 red +Game 90: 3 red, 3 blue; 14 green, 8 blue; 4 red, 12 green, 8 blue +Game 91: 2 blue; 2 blue, 8 red; 4 red; 8 red, 1 blue; 1 green, 2 blue +Game 92: 16 green, 16 red; 5 green, 2 blue; 14 red, 16 green; 17 red, 1 blue, 12 green +Game 93: 9 blue, 14 red, 6 green; 2 blue, 6 red, 3 green; 1 green, 2 blue, 12 red; 6 green, 8 red, 5 blue; 5 blue, 9 green, 10 red; 7 blue, 10 green, 3 red +Game 94: 2 blue, 13 green, 7 red; 5 red, 2 blue, 14 green; 8 red, 9 green; 2 blue, 8 green, 1 red; 7 red, 12 green; 2 blue, 3 green +Game 95: 1 red, 8 blue, 4 green; 1 green, 3 blue, 2 red; 6 blue, 2 red, 1 green; 3 blue, 4 green; 3 green, 1 red +Game 96: 15 blue, 8 red, 5 green; 15 green, 16 blue, 4 red; 11 blue, 8 red; 16 blue, 6 green, 1 red; 10 blue, 9 red; 1 red, 3 green, 3 blue +Game 97: 11 green, 8 blue, 4 red; 12 green, 11 blue, 1 red; 4 red, 1 blue, 11 green; 6 green, 1 red, 7 blue; 5 blue, 12 green, 4 red; 5 blue, 8 green +Game 98: 4 green, 15 blue; 13 blue, 8 green; 10 blue, 6 green; 1 red, 7 green +Game 99: 1 green, 3 blue, 18 red; 8 blue, 19 red, 5 green; 7 red, 2 blue, 2 green; 10 red, 1 blue, 2 green +Game 100: 4 red, 3 green, 4 blue; 8 green, 5 red, 2 blue; 1 red, 2 blue, 7 green; 3 blue, 8 green, 5 red diff --git a/examples/aoc2023/day02/part1.jou b/examples/aoc2023/day02/part1.jou new file mode 100644 index 00000000..dfdf3ce9 --- /dev/null +++ b/examples/aoc2023/day02/part1.jou @@ -0,0 +1,51 @@ +import "stdlib/str.jou" +import "stdlib/io.jou" +import "stdlib/ascii.jou" + + +def game_is_possible(game_data: byte*) -> bool: + # loop in ; or , separated chunks + while *game_data != '\0': + chunk_len = strcspn(game_data, ";,") + chunk = game_data + + # \0 terminate the chunk and skip it + game_data = &game_data[chunk_len] + if *game_data != '\0': # check needed to avoid overflow at end of string + *game_data = '\0' + game_data++ + + trim_ascii_whitespace(chunk) + + n: int + color: byte[10] + assert sscanf(chunk, "%d %10s", &n, color) == 2 + + if strcmp(color, "red") == 0 and n > 12: + return False + if strcmp(color, "green") == 0 and n > 13: + return False + if strcmp(color, "blue") == 0 and n > 14: + return False + + return True + + +def main() -> int: + f = fopen("input.txt", "r") + assert f != NULL + + result = 0 + line: byte[1000] + while fgets(line, sizeof(line) as int, f) != NULL: + assert starts_with(line, "Game ") + game_id = atoi(&line[5]) + + id_end = strchr(line, ':') + assert id_end != NULL + + if game_is_possible(&id_end[1]): + result += game_id + + printf("%d\n", result) + return 0 diff --git a/examples/aoc2023/day02/part2.jou b/examples/aoc2023/day02/part2.jou new file mode 100644 index 00000000..58b6f1c6 --- /dev/null +++ b/examples/aoc2023/day02/part2.jou @@ -0,0 +1,60 @@ +import "stdlib/str.jou" +import "stdlib/io.jou" +import "stdlib/ascii.jou" + + +class Game: + red: int + green: int + blue: int + + def update(self, text: byte*) -> void: + n: int + color: byte[10] + assert sscanf(text, "%d %10s", &n, color) == 2 + + if strcmp(color, "red") == 0 and n > self->red: + self->red = n + if strcmp(color, "green") == 0 and n > self->green: + self->green = n + if strcmp(color, "blue") == 0 and n > self->blue: + self->blue = n + + def get_power(self) -> int: + return self->red * self->green * self->blue + + +def parse_game(game_data: byte*) -> Game: + result = Game{} + + # loop in ; or , separated chunks + while *game_data != '\0': + chunk_len = strcspn(game_data, ";,") + chunk = game_data + + # \0 terminate the chunk and skip it + game_data = &game_data[chunk_len] + if *game_data != '\0': # check needed to avoid overflow at end of string + *game_data = '\0' + game_data++ + + trim_ascii_whitespace(chunk) + result.update(chunk) + + return result + + +def main() -> int: + f = fopen("input.txt", "r") + assert f != NULL + + result = 0 + line: byte[1000] + while fgets(line, sizeof(line) as int, f) != NULL: + id_end = strchr(line, ':') + assert id_end != NULL + game = parse_game(&id_end[1]) + result += game.get_power() + + printf("%d\n", result) + return 0 diff --git a/examples/aoc2023/day02/sampleinput.txt b/examples/aoc2023/day02/sampleinput.txt new file mode 100644 index 00000000..295c36dd --- /dev/null +++ b/examples/aoc2023/day02/sampleinput.txt @@ -0,0 +1,5 @@ +Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green +Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue +Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red +Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red +Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green diff --git a/examples/aoc2023/day03/input.txt b/examples/aoc2023/day03/input.txt new file mode 100644 index 00000000..3030b760 --- /dev/null +++ b/examples/aoc2023/day03/input.txt @@ -0,0 +1,140 @@ +........897.......839...........651.399.............236...............................343...986...........308............................... +........*................*404......*............134.....953..508=.....................*....*..........325*..........744......392............ +...350..847..403...-..541.....622.................*....................356.......%..95...793....................830...........*.....163..... +.....&.......@...105.............$..745............42...785.............*..443.412............922..............*...........663........*..... +.253....../..........696.............*..................*..............817.$.....................*...........62........................373.. +...........244...419....*189....=........*...871.74...797...353.737................227..626.....429.726%...9......*956...803/.......*....... +.793...........=.....-...........119..683.18.*...............@......+.....182..372....$.&...................*..756...............945.610.... +....*.........496.....395.....................929.746................76..*.....*..............673-...*.....47........591..271............... +.....964..................241...........*............+.....+....590.......129.6....$.....@...........680....................*............... +..........523*448...........&....136.759.356............789.......*.................367.330..397.............483....354......354...869...... +...488................920........*...........................652...802....$.......*............*..............-.....................*....... +..../.........986....*......*....550.995......376...............+......641.....567.315.........887..66...863....552.936..........277........ +.................*.800...354.464.......*.533......................20.......704..........918........*.....*...........*....214........&434... +........%.....589...................596..*.......373...-..........*....785.@......941......*....521.......908...897..610.................... +........384..........827*101....698......978....*......947.614.571....*..........@.....+...1.......................=......#73...734......... +122%..........*...................*..........993............./.....260.........+.....466...............%........................*........... +...........938.992........246......305...449......335...739................588..681.........920.....164.........................431......... +..558....$........................................@.....*.....................=............-............847.....879..51................624.. +.....*.104....*818.......505.785.10...................161....210....................723..........55......*..424..&.....*.........723..*..... +...44......542.....975..................437...............51....*686.....*....../..*.........990*......708.....@....715...&....#.......997.. +...............801..@.............-....*.....702....&....*............238.236.706.183..+................................842.545............. +...........202*...................906..204...*...990......212....380%..................208...................66............................. +......./........../....878............................266.......................278...............920...................144.........423..... +....494..*.....976........@.....&.......*287...553-..*.............731...................649..247*........703......@....%....817....*....... +.........856.......592...........708.404............707.......274...*........-............#.....................%.567.........*......431.761 +.............663.........974...............%...446.............*............751....793..........811....225.&...48.....860..887.............. +................&...........*.......673..536......-.........447.....@...............@...$..................816..........*................... +....822................@....251....$............................413..306.164.............540.....313..476..........@...586./65....840....... +.....*......@.950.....266............$.........1...+...............*..........373..................*.............885.................*...... +......157.529....*.........341.....480.............60......765....122...633....+............$182....963.....................587..976.824.... +................172............685.....480....#........831*................*......747......................262..................-........... +....*......+438.....@......332./.......=...739..815...............356.....119.273.&.....317*674.......=...*....561..........192..........89. +....867..-........179..............319........../....74@..952*374...*.........*....................125....578...*...........*......652...... +..........549.............873.........*...=........*...............695.*.....126.........821.....................697.$......806.52....*54... +....792...........-...646*....770.....163.637....941........884.........744..............................#............800................... +.......*.......181............@.............../........92..#...................518...654.......421*995.310....450...............771......... +...+................./48...........968.........269................904.......=...../.....................................266.....*........... +.211....636.................630.17*.....%581........./843.....%..*.......878...............829.....119.33........211.........247............ +.......*......................-...................%..........559..873.............*138.439*....687*..........130....*681.................... +....522.................792........896.........471...480*321...................125..............................*...................291..... +........616.......818.....$..858.............................659*826.....109.....................................10.564=.331...156...+...... +........*.......@...*..29....*...@......546.............907.............*.....965.......217.808.....802..212...............*................ +....607.976..641..852.@...330...158....../.......630........247.......503........$.335+....*.........*..*....618...423&.335...803........... +......=..............................502........#........-..*.....923......664....................421...395.-..................#............ +........*.................625....646..@...99............901.59......*.....*..........517.$747.*....................315..............79...922 +.....289.789..............%......*.........*......................762....388..189.....*........277.........*222...*.................$....... +.................................738....406.....462...........................*.....915..............505/.......61.....+.......202*......646 +..749..............163............................*.....963..........907.......979....................................223..716.....265...... +.......&....741............362.......117.......837..96../.................#..............786.256.....942..=970...983........*............... +......133......*486.725.......*....../...............%................930.310...................*733.-.............$.....198.........189.... +....................*........256........68.......267...873........418*.....................573.................................219..*....... +......+.....439..525..187........495..............*...=.......923..........327..988..300........447*59..702../..840......40.....*........... +......731....*........*..........*..............547.......453.....6.$.........*.......*................-....447....@.......*.737............ +.907#.......375........195.....707..17.................9..........%..119...147..594.22.......81.........................485......446........ +.....................................*....#............*.....62...................*...........*....569...935.868....-...............*528.... +...#..........209........229.......787.470..............403........892.........816.....923..811...$.........*......104.907.849....*......... +..154.346.....*...361.........................10/...237................-................*.............600..............*.......998.606...... +.........%...216..*.......*.........*368.869.........#................6..98...........53.............*.....850@...102...751................. +....550............727...383.....818.....*...913.............879...........*.....420.....150.........708.................................... +705*.......@688.......................289.....*.........................431........*...+....*50.....................698...668*144........... +..................501..70.520....$32......562..458....170......279$............504......883............/...44........*...................... +..450..107@........*..................586*...........*.........................*....510............788.274............589...-26......&...... +...................342.........&.551+.................302...............286.....931....&....-649..$.............575................185...199 +............602..............470.........243*......@............818.690*.......................................*....863..793*............... +......934.....*......200.936.....46..........137.72.........377*......................443*372........498....320..#...........553......598... +........-...451./952..*...*....*.......................804..............305......700............675...&.........611......................... +......................393.......708....957........*697......808.....138*.........%......186....*....%...162*...........624........244.%..... +.....220*.........872......*...........*.........7.........................................=..6....391......562...880.....*......#....120... +...+.....608.........*...74.568........193.........379.........$682......933.927&.....&............................./..984.................. +93..553........*768.739...........421.........880.....*....737.............*.........69..................................................... +.........334...............................40*........910.................................+465..682.............141*.......248..80.......... +.........=..................323...172.............506..............503........568....785+.......%.......940*734.......#573....*...*.....130. +...163@........%17..42..108*.......*...$......700..*..81...../...............+....%.............................#285.........499.523....*... +.............-........*..........305.706.....*....942.....843........*.............378.861.......573.859.173............522............544.. +..........974.......517.756..762.............480.....................289................*...........*......*.228%..........*......628....... +....567........&274......+..../..........................................926.............391............214.............270...230..-........ +...........=...............52...../......155*150.......180&..*......482..&...884................-125...........................@............ +..........332..................318............................123......%......*...............=........................310.................. +....................856.154........@............161....192..................=..387.............384..*827................*..&400......588.... +.......283.............*....@.......12.....309...*...$...........643.......885..........862................210.......449.................... +.......*......937.........98.....&........*....560....884.......$.................866#.../.............622..*..901.............462.......... +.....279............273......896..17.661..880...............138...632......66...%.............93......*....349...*........./......=......... +..............430....*....+.....*.....*............350...............*..........226.......621*......312........=..266....574..111........... +..339........../.....770.451....122........990.....................811...780........*448.................325.249...............+...$...441.. +......................................$......%...........793..............@..787.766....................................64..+......252.*.... +.........556........../.....256/...267...336.....897..........524*417.........................950...930$.452........164......713.......592.. +....759....*...........672.................-.868....*....613......................401.....742..*..............560........=.........939...... +.....$...780.......195......578...............*...%...+....*.....=.....&.............*......#...645...636.797..........652...........*...... +......................*......................77...97.988.821...882...977.......127.609.914...............*.................................. +..........+...195&.....930.....872.......................................79..............&.....14...................-.......150..274........ +..........473................9*.............951&................./...827*.............46......-...13....751.........640.......*.....*504.... +898................-.............56*....378..............291..310..........58............937.....$.......*.../.............840..714......... +............-321.128.157............549..-....130....478*.........*.....................................123...164..............*....631..... +..516..989@..........*.........*670............................204..577.......&817....@514........790...............816.........148.*....... +.....*................233...........*838.....*951.....-954..........$.......&.................110.........99...........*..@187.......671.467 +224...205.....552................823......343................490*...........377..................*.......$...........779.......408.......... +............./..../.....................................166*..........120...........452.........148...=.......................*............. +.562..............768.........#.267.29...806*......476......214.........*....*......*...............867.211....248.$870....@...829...*...... +...*..826@...................1.....*.........251....+.....#...........211.893.403....702.......44.......*........+..........75......977..... +..368.........861$......867....=.......................834.....................................=.........507................................ +.......721*............*.......912.#497....................87-.....231...894.......968..........................659$.......@..........564... +...........690.......432....@..................332................*.........*756..*................302..214*.........803..855............... +..................26.......943...........633...*.....299.150....639.................796.....440.............428......+...........538.647.... +........31........*............................260.....-................=..261.............*............................644.303..%.....-.... +227..........#.161....*....&.....305...............345........328....639...*........$.......802....612.185................%../.............. +.......683.953.....224....58.....*.................*....799...............944.964....245.............*.%................@......28.19.242.97. +....93*........../.............908.........$249..480.......*......978..............................58........=209......373.802*.........*... +467...........201..........932.....997......................548................/.....-904.....796.....3+............................915..... +...................#......@.......*......748*965.................922......451..169..............$.945....372#..979........%..436...*........ +........&.....880&..789........14.805..............571....222/.....*.70......*........./958..........%.........&.../....61.....*...73....... +.......280.................................=.861......-.........144...........950................%.......907......910.......396............. +.....+.........592*149.820*511...........298....&.......*264..........-..527..............-.....679.......*...............@......50*270..... +...901......=....................@483.............$..936......625%...619....%..........748...............785...860......26..181.........747. +.........85..640...#........=.=.......49.......216.............................268*.............................#...........#.....53....*... +...........+.......744...933...766....*.................%...............*714.......909................................999...........*...311. +.............783....................947.................352...765..............897.....+430..869.................121.%............236....... +...45....*......*..752......617..................332...........*...236...........*..........*....@.528..........&......530.................. +..../.134.713.871..*.............*...........#.....%.930...........*....323....377........678.544..*........542.........$.......470.629*786. +..................259...&.....959.225......177.......*.....912*..........$.........................306..996.*....*.........*681...*......... +..........250*768......598.........................850.........598..............3*.........904*648........=.372...197...410......152...=.... +............................................507@.......960..............362.164...131...................................................115. +.....746.......117..678=........952...303*.......+......................./..*...........$636../...597......37................351...=........ +.......*.281...@...................*......337.258..814...687.....#922.=....772..611.153.......573....*.......*..............*.......518..... +....144.....*.......396...........240................+......*.........45.......+.......*...........479.&293..126.....784-...783............. +...........843...@....*..918*.............................986.....542...................117.....................................578.707..... +..984.............251........258....597$.650.........................*..................................928.409.684...547.......*....%...... +....&..489....931...........................$....356........................489..............302...............*............./...259.../996. +......./........*.................................*......385........63*911...*.........%........*578...633.175.........@804..421............ +..98...........188..........226....+...............909....*...................535.....798................$....*.796......................... +....*.....%...................+....531...563...........426......617*202.........................929-.......439....%..332.....+.23&.347...... +...364..149..............425............*.....662.481.......................788..$844..................506..........@.....693......&........ +..........................*....408...772....+.......-.......232*......*......*.............#.+294.....*.....706................435.......... +......566*972........631=.425.*...........14............984.....667..7.236....195..9.....222........757......*.....865..604&..*....344.&.... +.................439..........710..............477*714..............................*544........368............395*...........435...*..204.. +..........229......+..596.179........../................165.542*47........147..............653..*...................466...........119....... +.....690...@............@.......467..626........&......*.................*....=42.....724....+.816....262*.....237.@....549.383............. +......*.........750..............*..............202....967.914......279..................*........./......147.@...............*........480.. +...444.......84...#....+..........527......*351..............*......*................225..888.......806.............7......#...518.....*.... +.............*........628...............749......*976.200.....852..354...23....=........*...............................138............833.. +..........964.................................211...............................578.....986.............879......59......................... diff --git a/examples/aoc2023/day03/part1.jou b/examples/aoc2023/day03/part1.jou new file mode 100644 index 00000000..78b8c60a --- /dev/null +++ b/examples/aoc2023/day03/part1.jou @@ -0,0 +1,69 @@ +import "stdlib/ascii.jou" +import "stdlib/io.jou" +import "stdlib/mem.jou" +import "stdlib/str.jou" + + +def read_input() -> byte*: + huge = 1000*1000 + + result: byte* = malloc(huge) + assert result != NULL + memset(result, 0, huge) + + f = fopen("input.txt", "r") + assert f != NULL + fread(result, 1, huge, f) + fclose(f) + + assert result[huge-1] == '\0' # check if full + return result + + +# Check if there is a part number between start and end. +# Start and end should be pointers into input. +def is_part_number(input: byte*, start: byte*, end: byte*) -> bool: + if start >= end: + # empty range + return False + + for p = start; p < end; p++: + if not is_ascii_digit(*p): + return False + + line_size = strcspn(input, "\n") + 1 + + for dy = -1; dy <= 1; dy++: + y_offset = line_size * dy + check_start = &start[y_offset - 1] + check_end = &end[y_offset + 1] + + # stay within input + if check_start < input: + check_start = input + if check_end > &input[strlen(input)]: + check_end = &input[strlen(input)] + + for p = check_start; p < check_end; p++: + if *p != '.' and is_ascii_punctuation(*p): + return True + + return False + + +def main() -> int: + input = read_input() + sum = 0 + + for start = input; *start != '\0'; start++: + end = start + while *end != '\0' and is_ascii_digit(*end): + end++ + + if is_part_number(input, start, end): + sum += atoi(start) + start = end # skip rest of number + + free(input) + printf("%d\n", sum) + return 0 diff --git a/examples/aoc2023/day03/part2.jou b/examples/aoc2023/day03/part2.jou new file mode 100644 index 00000000..780b0b1c --- /dev/null +++ b/examples/aoc2023/day03/part2.jou @@ -0,0 +1,85 @@ +import "stdlib/ascii.jou" +import "stdlib/io.jou" +import "stdlib/mem.jou" +import "stdlib/str.jou" + + +def read_input() -> byte*: + huge = 1000*1000 + + result: byte* = malloc(huge) + assert result != NULL + memset(result, 0, huge) + + f = fopen("input.txt", "r") + assert f != NULL + fread(result, 1, huge, f) + fclose(f) + + assert result[huge-1] == '\0' # check if full + return result + + +def find_whole_number(input: byte*, a_digit: byte*, start: byte**, end: byte**) -> void: + *start = a_digit + while *start > input and is_ascii_digit((*start)[-1]): + --*start + + *end = a_digit + while **end != '\0' and is_ascii_digit(**end): + ++*end + + +def find_adjacent_numbers(input: byte*, p: byte*) -> int[10]: + # p should point somewhere in the input + assert input <= p and p < &input[strlen(input)] + line_size = strcspn(input, "\n") + 1 + + # -1 marks end of array + result = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] + result_len = 0 + + # Avoid duplicates, e.g. this will see the top 123 three times: + # + # ....... + # ..123.. + # ...*... + # ..123.. + # ....... + # + # We can't do the duplicate check with the int 123, because this counts as a gear. + last_start = NULL + last_end = NULL + + for dy = -1; dy <= 1; dy++: + for dx = -1; dx <= 1; dx++: + neighbor = &p[dx + line_size*dy] + if input <= neighbor and neighbor < &input[strlen(input)] and is_ascii_digit(*neighbor): + start: byte* + end: byte* + find_whole_number(input, neighbor, &start, &end) + if start != last_start or end != last_end: + last_start = start + last_end = end + result[result_len++] = atoi(start) + + return result + + +def main() -> int: + input = read_input() + sum = 0 + + for p = input; *p != '\0'; p++: + if *p != '*': + continue + + adjacent = find_adjacent_numbers(input, p) + printf("adjacent = [%d,%d,%d,%d,...]\n", adjacent[0], adjacent[1], adjacent[2], adjacent[3]) + if adjacent[0] != -1 and adjacent[1] != -1 and adjacent[2] == -1: + # it is a gear + sum += adjacent[0] * adjacent[1] + + free(input) + printf("%d\n", sum) + return 0 diff --git a/examples/aoc2023/day03/sampleinput.txt b/examples/aoc2023/day03/sampleinput.txt new file mode 100644 index 00000000..b20187f3 --- /dev/null +++ b/examples/aoc2023/day03/sampleinput.txt @@ -0,0 +1,10 @@ +467..114.. +...*...... +..35..633. +......#... +617*...... +.....+.58. +..592..... +......755. +...$.*.... +.664.598.. From e563148ab9b441c0fcd83af28d19aca4021f17db Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 12:17:56 +0200 Subject: [PATCH 2/9] hack the test script --- examples/aoc2023/day01/part1.jou | 2 +- examples/aoc2023/day01/part2.jou | 3 +-- examples/aoc2023/day02/part1.jou | 2 +- examples/aoc2023/day02/part2.jou | 2 +- examples/aoc2023/day03/part1.jou | 2 +- examples/aoc2023/day03/part2.jou | 3 +-- runtests.sh | 30 +++++++++++++++++++++++------- 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/examples/aoc2023/day01/part1.jou b/examples/aoc2023/day01/part1.jou index 9181f6d4..47b234b5 100644 --- a/examples/aoc2023/day01/part1.jou +++ b/examples/aoc2023/day01/part1.jou @@ -21,5 +21,5 @@ def main() -> int: result += 10*(*first - '0') result += *last - '0' - printf("%d\n", result) + printf("%d\n", result) # Output: 54630 return 0 diff --git a/examples/aoc2023/day01/part2.jou b/examples/aoc2023/day01/part2.jou index ea9fe8e2..050f62f4 100644 --- a/examples/aoc2023/day01/part2.jou +++ b/examples/aoc2023/day01/part2.jou @@ -33,6 +33,5 @@ def main() -> int: result += 10*parse_prefix_digit(first) result += parse_prefix_digit(last) - printf("%d\n", result) + printf("%d\n", result) # Output: 54770 return 0 - diff --git a/examples/aoc2023/day02/part1.jou b/examples/aoc2023/day02/part1.jou index dfdf3ce9..9bb5c0cf 100644 --- a/examples/aoc2023/day02/part1.jou +++ b/examples/aoc2023/day02/part1.jou @@ -47,5 +47,5 @@ def main() -> int: if game_is_possible(&id_end[1]): result += game_id - printf("%d\n", result) + printf("%d\n", result) # Output: 1853 return 0 diff --git a/examples/aoc2023/day02/part2.jou b/examples/aoc2023/day02/part2.jou index 58b6f1c6..6e537672 100644 --- a/examples/aoc2023/day02/part2.jou +++ b/examples/aoc2023/day02/part2.jou @@ -56,5 +56,5 @@ def main() -> int: game = parse_game(&id_end[1]) result += game.get_power() - printf("%d\n", result) + printf("%d\n", result) # Output: 72706 return 0 diff --git a/examples/aoc2023/day03/part1.jou b/examples/aoc2023/day03/part1.jou index 78b8c60a..66833f3a 100644 --- a/examples/aoc2023/day03/part1.jou +++ b/examples/aoc2023/day03/part1.jou @@ -65,5 +65,5 @@ def main() -> int: start = end # skip rest of number free(input) - printf("%d\n", sum) + printf("%d\n", sum) # Output: 556057 return 0 diff --git a/examples/aoc2023/day03/part2.jou b/examples/aoc2023/day03/part2.jou index 780b0b1c..4aa14df7 100644 --- a/examples/aoc2023/day03/part2.jou +++ b/examples/aoc2023/day03/part2.jou @@ -75,11 +75,10 @@ def main() -> int: continue adjacent = find_adjacent_numbers(input, p) - printf("adjacent = [%d,%d,%d,%d,...]\n", adjacent[0], adjacent[1], adjacent[2], adjacent[3]) if adjacent[0] != -1 and adjacent[1] != -1 and adjacent[2] == -1: # it is a gear sum += adjacent[0] * adjacent[1] free(input) - printf("%d\n", sum) + printf("%d\n", sum) # Output: 82824352 return 0 diff --git a/runtests.sh b/runtests.sh index 13f7c202..ca804f3f 100755 --- a/runtests.sh +++ b/runtests.sh @@ -13,7 +13,8 @@ set -e -o pipefail function usage() { echo "Usage: $0 [--valgrind] [--verbose] [--dont-run-make] [TEMPLATE]" >&2 - echo "TEMPLATE can be e.g. './jou %s', where %s will be replaced by a jou file." >&2 + echo "TEMPLATE can be e.g. 'jou %s', where %s will be replaced by a jou file." >&2 + echo "When the command runs, 'jou' points at the executable in repository root." exit 2 } @@ -33,9 +34,9 @@ done if [ $# == 0 ]; then # No arguments --> run tests in the basic/simple way if [[ "$OS" =~ Windows ]]; then - command_template='./jou.exe %s' + command_template='jou.exe %s' else - command_template='./jou %s' + command_template='jou %s' fi elif [ $# == 1 ]; then command_template="$1" @@ -139,11 +140,21 @@ function run_test() local correct_exit_code="$2" local counter="$3" + local dir=. + if [[ "$joufile" =~ ^examples/aoc ]]; then + dir=$(dirname $joufile) + joufile=$(basename $joufile) + fi + local command diffpath command="$(printf "$command_template" $joufile)" diffpath=tmp/tests/diff$(printf "%04d" $counter).txt # consistent alphabetical order - printf "\n\n\x1b[33m*** Command: %s ***\x1b[0m\n\n" "$command" > $diffpath + local command_msg="Command: $command" + if [ $dir != . ]; then + command_msg="$command_msg [in $dir]" + fi + printf "\n\n\x1b[33m*** %s ***\x1b[0m\n\n" "$command_msg" > $diffpath # Skip tests when: # * the test is supposed to crash, but optimizations are enabled (unpredictable by design) @@ -160,8 +171,13 @@ function run_test() show_run $joufile if diff --text -u --color=always \ - <(generate_expected_output $joufile $correct_exit_code | tr -d '\r') \ - <(ulimit -v 500000 2>/dev/null; bash -c "$command; echo Exit code: \$?" 2>&1 | post_process_output $joufile | tr -d '\r') \ + <(cd $dir; generate_expected_output $joufile $correct_exit_code | tr -d '\r') \ + <( + export PATH="$PWD:$PATH" + cd $dir + ulimit -v 500000 2>/dev/null + bash -c "$command; echo Exit code: \$?" 2>&1 | post_process_output $joufile | tr -d '\r' + ) \ &>> $diffpath then show_ok $joufile @@ -173,7 +189,7 @@ function run_test() } counter=0 -for joufile in examples/*.jou tests/*/*.jou; do +for joufile in examples/*.jou examples/aoc2023/day*/*.jou tests/*/*.jou; do case $joufile in examples/* | tests/should_succeed/*) correct_exit_code=0; ;; *) correct_exit_code=1; ;; # compiler or runtime error From a8e9f0abcc5cfd4f3556a838a9b0a0b52b31e52f Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 12:30:05 +0200 Subject: [PATCH 3/9] fixed --- .github/workflows/linux.yml | 6 +++--- compare_compilers.sh | 3 ++- examples/aoc2023/day01/part1.jou | 2 ++ examples/aoc2023/day01/part2.jou | 2 ++ examples/aoc2023/day02/part1.jou | 2 ++ examples/aoc2023/day02/part2.jou | 2 ++ runtests.sh | 19 +++++++++---------- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 2cd25d68..8ef22f5e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -22,8 +22,8 @@ jobs: - uses: actions/checkout@v3 - run: sudo apt install -y llvm-${{ matrix.llvm-version }}-dev clang-${{ matrix.llvm-version }} make valgrind - run: LLVM_CONFIG=llvm-config-${{ matrix.llvm-version }} make - - run: ./runtests.sh --verbose './jou ${{ matrix.opt-level }} %s' - - run: ./runtests.sh --verbose './jou ${{ matrix.opt-level }} --verbose %s' + - run: ./runtests.sh --verbose 'jou ${{ matrix.opt-level }} %s' + - run: ./runtests.sh --verbose 'jou ${{ matrix.opt-level }} --verbose %s' # Valgrinding is slow. Do it only when this file or something in the compiler has been modified. - name: Figure out if we need to run tests with valgrind id: check-need-valgrind @@ -35,7 +35,7 @@ jobs: echo doit=no >> $GITHUB_OUTPUT fi - if: ${{ steps.check-need-valgrind.outputs.doit == 'yes' }} - run: ./runtests.sh --verbose --valgrind './jou ${{ matrix.opt-level }} %s' + run: ./runtests.sh --verbose --valgrind 'jou ${{ matrix.opt-level }} %s' # valgrind+verbose isn't meaningful: test script would ignore valgrind output - run: make clean - name: Check that "make clean" deleted all files not committed to Git diff --git a/compare_compilers.sh b/compare_compilers.sh index d730e2b3..6f20b51b 100755 --- a/compare_compilers.sh +++ b/compare_compilers.sh @@ -28,7 +28,8 @@ for arg in "$@"; do done if [ ${#files[@]} = 0 ]; then - mapfile -t files < <( find stdlib examples tests -name '*.jou' | sort ) + # TODO: do not skip Advent Of Code files + mapfile -t files < <( find stdlib examples tests -name '*.jou' | grep -v aoc2023 | sort ) fi if [ ${#actions[@]} = 0 ]; then actions=(tokenize parse run) diff --git a/examples/aoc2023/day01/part1.jou b/examples/aoc2023/day01/part1.jou index 47b234b5..b0a28bb0 100644 --- a/examples/aoc2023/day01/part1.jou +++ b/examples/aoc2023/day01/part1.jou @@ -21,5 +21,7 @@ def main() -> int: result += 10*(*first - '0') result += *last - '0' + fclose(f) + printf("%d\n", result) # Output: 54630 return 0 diff --git a/examples/aoc2023/day01/part2.jou b/examples/aoc2023/day01/part2.jou index 050f62f4..1ff43ea4 100644 --- a/examples/aoc2023/day01/part2.jou +++ b/examples/aoc2023/day01/part2.jou @@ -33,5 +33,7 @@ def main() -> int: result += 10*parse_prefix_digit(first) result += parse_prefix_digit(last) + fclose(f) + printf("%d\n", result) # Output: 54770 return 0 diff --git a/examples/aoc2023/day02/part1.jou b/examples/aoc2023/day02/part1.jou index 9bb5c0cf..e9b2593c 100644 --- a/examples/aoc2023/day02/part1.jou +++ b/examples/aoc2023/day02/part1.jou @@ -47,5 +47,7 @@ def main() -> int: if game_is_possible(&id_end[1]): result += game_id + fclose(f) + printf("%d\n", result) # Output: 1853 return 0 diff --git a/examples/aoc2023/day02/part2.jou b/examples/aoc2023/day02/part2.jou index 6e537672..0cef5566 100644 --- a/examples/aoc2023/day02/part2.jou +++ b/examples/aoc2023/day02/part2.jou @@ -56,5 +56,7 @@ def main() -> int: game = parse_game(&id_end[1]) result += game.get_power() + fclose(f) + printf("%d\n", result) # Output: 72706 return 0 diff --git a/runtests.sh b/runtests.sh index ca804f3f..f5a30cd3 100755 --- a/runtests.sh +++ b/runtests.sh @@ -170,16 +170,15 @@ function run_test() fi show_run $joufile - if diff --text -u --color=always \ - <(cd $dir; generate_expected_output $joufile $correct_exit_code | tr -d '\r') \ - <( - export PATH="$PWD:$PATH" - cd $dir - ulimit -v 500000 2>/dev/null - bash -c "$command; echo Exit code: \$?" 2>&1 | post_process_output $joufile | tr -d '\r' - ) \ - &>> $diffpath - then + if diff --text -u --color=always <( + cd $dir + generate_expected_output $joufile $correct_exit_code | tr -d '\r' + ) <( + export PATH="$PWD:$PATH" + cd $dir + ulimit -v 500000 2>/dev/null + bash -c "$command; echo Exit code: \$?" 2>&1 | post_process_output $joufile | tr -d '\r' + ) &>> $diffpath; then show_ok $joufile rm -f $diffpath else From 39d396e569ab8833600d3b876517da630a8ff8aa Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 12:39:44 +0200 Subject: [PATCH 4/9] Update examples/aoc2023/day01/part2.jou --- examples/aoc2023/day01/part2.jou | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/aoc2023/day01/part2.jou b/examples/aoc2023/day01/part2.jou index 1ff43ea4..07541bed 100644 --- a/examples/aoc2023/day01/part2.jou +++ b/examples/aoc2023/day01/part2.jou @@ -7,7 +7,7 @@ def parse_prefix_digit(s: byte*) -> int: if is_ascii_digit(s[0]): return s[0] - '0' - strings = [NULL as byte*, "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] + strings = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] for i = 1; i <= 9; i++: if starts_with(s, strings[i]): return i From 7ee1f8fe83b91196cee0c8b1abfad752f32a0151 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 12:53:48 +0200 Subject: [PATCH 5/9] Delete aoc input files --- .gitignore | 5 + examples/aoc2023/day01/input.txt | 1000 ------------------------------ examples/aoc2023/day01/part1.jou | 4 +- examples/aoc2023/day01/part2.jou | 4 +- examples/aoc2023/day02/input.txt | 100 --- examples/aoc2023/day02/part1.jou | 4 +- examples/aoc2023/day02/part2.jou | 4 +- examples/aoc2023/day03/input.txt | 140 ----- examples/aoc2023/day03/part1.jou | 8 +- examples/aoc2023/day03/part2.jou | 8 +- 10 files changed, 21 insertions(+), 1256 deletions(-) delete mode 100644 examples/aoc2023/day01/input.txt delete mode 100644 examples/aoc2023/day02/input.txt delete mode 100644 examples/aoc2023/day03/input.txt diff --git a/.gitignore b/.gitignore index bec9aa61..8255fe1c 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,8 @@ jou_compiled # ide stuff /.vscode/ + +# Advent of Code input files https://adventofcode.com/ +# These are large text files, and each AoC user gets different input files. +# Tests use sampleinput.txt files, copied from problem descriptions +/examples/aoc2023/day*/input.txt diff --git a/examples/aoc2023/day01/input.txt b/examples/aoc2023/day01/input.txt deleted file mode 100644 index 69b9d12a..00000000 --- a/examples/aoc2023/day01/input.txt +++ /dev/null @@ -1,1000 +0,0 @@ -eightfivesssxxmgthreethreeone1sevenhnz -hzdlftdtfqfdbxgsix9onetwo13 -29threelgxljfhrjr -pxvmbjprllmbfpzjxsvhc5 -seven2jtgjltvzbcdnjtsfiveonebhkzld -twothreesixeight6eight6 -nptjqqxoneninert1927 -7beighttwob -6onesix -6fourfive97 -jxcgpx5ninemsqqfmkpnj -jsdkqjbgx1gz5 -9fourxxmdqmmlrbpqgznone8lvtxftmfpseven -qsdzrx6 -khone9fivefive2 -nine9eightseven -threefour3pzzxmrmvpn6sixmfckm -twoseventwohncgscdmbsdzh6zckqbvml -six5nine5jlhthreefive -7onesztpkqmjlfourhrrcf3threeone -83zgthreethreenine -ninevgvrhtsrrnbnxg2fourvlqkdqxxqcmfqbbmx3 -mqphlgz8sghhvsevenpblfrmxvsixcqpsdjvs -fourlltktxt93brbmpml8 -mqfkvscjj56 -fivehhh8four17fbqxtksseven -5rbzgfournplgvtsixbqvmd -sevenflknr33qtwosixstmsblmrzczdqflxg -dblfhbt7sevenninesix2threethree -81fourtwo -three87tgz3 -bkjnnzsjgmfive4vsvh -threeqkrsbzzjbmkjdmthree1ninethree7 -5oneqdzzpj -5fourlfrp -ninefbfhptcqql1f5eightfncmrvkff -mlhxgnxxxrr3ninefnlcdlvseven -sixfiveone5 -sevensixtwofivenine17vkshzpbkbhtssg -5seventvzqcjfzj4 -6eightspklnbxqcdshsdhgq8eightninej -eight3fiveninefivemtxm9eightwot -lsxlqlnsevenpstsbbzpkhphrkjdd42fbxqdmc7six -fr2dllkdtqfh3hgvf -cqjeightwothree9hvrmtg -74cxeight -seven8fivescftvkmvxh66rkcfqfjf8 -4twothree -six4onedhsevencngfntnsss8 -8262sixthreepxvgpqf4two -8qtthree -three6gqfcml3zfxhfsvr -jltxcptthjsixmszdqt9xkbg89 -zheightwotwo5threeqrgbr -1sevenpvgqtrtjfqtvklnt -1vspr99lvvn9mktnjv -lrj8lltb5three -ninevjmsfkqkns2 -1fiveeightmh2 -lck76 -gjkmgqhnvgnine7 -55jjzqxhtmmsevenseven2ffzqz3 -3eightfive -eightthreedpxcbsjbfive3cjfm -eightpvhqkkxfdfhg6three -lsevennxnkgthree35jg7one -3eightzdkkqgjvbz926 -nineninenine49five -lvgxbch8nnnlpbvtgpqqmmm -d2sevenjqbjbklssrrtr1eight -one4xxdbgfjzhdbmxqtfvbplmsxonekq2 -eight4fourfive -threec2twothree8 -ninefive7 -1sevenmvdgzdtwoone -4mmbddbxnb -tvfjz5htfnlbzmb85thtsix -24567 -zmkckdxpsixfivezhsxnqvcj3 -nine15nine1three5 -nineckmvzlctpk3nine3vsnpvkzsnx29 -7nqthreetwo -dkdgtzxz8 -sevenljjldccxhgxs6jbblhmtxkc3kqfnntgzbvcd -one99 -twoxvns165gfclnxrthree -soneightninetwo161vhmf -four494 -23xmxbxxrhgxthreebqjzx21one -two361 -qlzchlkb1six6 -sfmzztmtkd46sixpk6sevenjft -x1vzgnpdjtwonert -575khkzl -txlpc39hlcmlnxmb9nineptdsvhdhbz -eighttwo5 -76six4blfmlclrcj4one -fiveone4nssevenfiveninefvmv3 -kpltvpmfljxfhx53seven -7five1vxdhnvrjs -fivefoursevenone4sevenninefive -sevenfnmvbleightsixsevenxgzhnrdjkj8two7 -2twoone78seven -zbfczseven8jqqksl5 -sevennine1cvr12pxfdninejqzmrklrpd -three22fourbnfdtfghmrone -kphxprbrsevenjp7 -z973 -t3sixtwonedmj -four6hqntpmsix5four -nl71 -fourseven8sixqmjrbh3xmrmjvdkfourgvlnlq -dprxplthreezsnmqcfcz6fourninesevenbc -9threeseven1ninetmjgxqthhmfvkspznz -85eightsevenmnvmnvlvlqsixzrxnrflmnthree -4threeqpkztjv82four -onemrxrxfcgtwozmnglpsixgvprxd5khnmqbdf4 -sixsixsixxcmtfh3 -7zclrbhnpzlkkdlsgvk1sixxdvlfqp -5nineslhvxhn74 -7eightninefivenine5qmknztrm -hnbsgslpvjzfourk3 -1threemlxzdfjdtn5d -seveneight94frlpvqzrd -74tztnlxvr -xrsrhbjthreetgsix1fourbbrvkcdj -seveneightjxzjgtrtwof983four -voneightcqkcdvhxh4eight -36fzdqdnfvfoureight7six -szbrxngs8 -five6fnrkr4 -sixmf5twojhxgmphxrnxxknqsqqptc -1tmvhvfkhjsix -3sevenfqmnine -eight1sevenone -seventwo371bcct -62rcxzfivemshhfourxg -fnzhqklm3 -sixkp13 -1ksqxljtftwo -2ksjstft44fivenine6bgrnzxprvk -hpdjlcstgpqzmxrth25ninelxvrzd6 -vzhhfczjs3two -three65sixfour19 -3dmfxckkdrclzhvcsfkbl8five -rjscjrshbdhk1tclpsrbtgg8sixbjgtwo -7sevenseven -9qzbqxmqonefiveknrnzpxoneightrq -4btqghfcqx25fivetwo95oneightxf -8fivejvbvftzhcxlxhqfour -sevenfourzrxxft9twoninethree4 -eight9k -39zzfckvfknjsggxdlthreenine -three7pcdnvb -sgrcmfour1tzmdrkp -eightqfkmrzpbxr19 -q36six9 -eightkhcrhkq7nine2pbfnjb -52cldhzmfoursevenxjptnbfivemdvkp -3rts -six8clzsndmqncvtbjtjzlzv8crm3 -ffnqkrrrjfive2three17 -two8nbmvvvrqxqnhhj -9hlgsngnm -117qncndfc2rjvlhrljfxljrzjdnine4 -3gvx5 -4eightsix9vqq9three -mgeightwo8zcvfghnlth7btq6brhseven -nineb5six9fiverhpgdkjvmgsrbone -sevenmmjsrhqvfour1rhvsvtgtkxxhklnqzp -fourrs33sfrtj -7threeeightninezhbvcnpmst28 -bdffmszjmpqvz9five1eightthree -lbjfg9twozpmmbfxj7gpzpgh -26sevenzdrghllpnkbtvkrfpg -tcmgzjk2rv9lblsf -8five9six4seven -94two -8sevenbbqj2 -three2vldmbjdfthree5 -threethreetwo9six35 -8j24fiveqcprqmnkcb -eight7bnghgcjxdpmcqgjks8 -tbrrggrpzrjqxbgcs5 -6eightfoureightthreenxfmdrthree2 -9seventwoqndtmhrxvssixscsjkjd -3s6xztbkmmninegfnjz6seven5 -5one21lkv -465six4nhx3 -92cffdkftleight779 -eightninefivesixhfkfz3 -bgoneightkhgvqbfivefour1seven -rxbeight47eightthree7 -fourqjftdzjr327twopsgdfgvjdlk -5fourfourfournzvrteightthreekkszfknj -six58jns7 -cdmfngp9sixseven -twojkszvbeight2kzpxvmlmblgzphrpm -threesixthreeljeightseven4 -seveneightfive4bnttggznlnn -tfz7jpmcdlvsjh6 -31eighteight23gbgsevenznz -threetlzd3five4 -34fournkzcvkkb8pjvxnh6 -mkcdj3onefive5gone -sevengtgdpdh4 -q7377five9four -eightj481 -48sevensixfoureightwodx -sixkqtzzreight6seven8xtksj6rdllzmnb -p6jsxflvtpseven9 -9two8 -six7zdjgrdvgdtgksncbrxdmhzkxjtmv452 -83eightljzgv -697five -2three6five9 -53fourthreekvpjqxhjzdtwosevengsnfd7 -nine7hnhczxpqmxpvnrtrtl2threeseven4five -7knlqbhnineeight767 -eightj7threess3five8 -4five4three -fourjnkspcjv2threeone1ntmbblkcxgvtvjk -cfbpfkxfeighttwo3seven -7qcnb -3dppxtmnqggxbrdg5twoeightnine -ninenine49foureight -fivesixfive7 -7eightsixlmj -five2sbxf15 -onetmkkxv363knine -2spgn -hhtqxplnxconeninenine5sixxqgrjccpb3four -1gstcjk3 -eighttwosevennine4gdxqbslpsdm9 -29onetfhcfive -sevenvthreecclcfjtmdplbvhxhb7 -1sq2 -qceighttwo8qcdeightnine -xhbctnhk5lnxrmldqqndvcxvvshsrvrvpcczc -sevenzjmllngfnjbrkgc6 -twojtf6 -ccqrlcgeightsevensix25 -eightzkfbst2threeseven -sevenqdcnpcqbfoneflpzjkpfkmnine8 -6gkvmlrheight -bndmmzfiveonenttqzftp3fivemchdfr -99jcnkfks9vxtqltmxsvkjlnrfive4 -c51seven2 -eight8777one -4qpgjthreelrjrzdmjsrrchkheightcngp1 -jztwo3four54tngzbftvhtwojbznxhbdb -five8nine4sixxdhcnsghx7three -57oneninehpqpzvjbjb -fivenine7sixskmmzmzpml -tvoneight3xtbvffvthreezcbrgk85eightsixbdgqspftkr -zvqvpxjgbhd6npheight52nine -1dvs -6eightvhfnlv5nnljzsggseven2tsvsmqsxfm3 -four7rckdrdf71 -5bgfc4rnptrzx -two8onesix -m8one4foursix -8124six -97eighttwodqqmpdhxlvvtxxggfour -eightnine58zggqsjqszpxonevkmstfg -tpbrdr8fnxg8threektbjfltwo7 -25fivefrl6tkhcjninezp -4seven8635 -n9two6bxoneeight -vpkqpbg8g -7fjkhndseventwotwonine8four -zm58lgzzgtjfourlxnmbpthreetwo -5gtjxtqhpkqfour4 -9fnone7sixsevenzqtndjeight -333threeninetwodxsqtvgvjz -threejpfkkgcthree2eightmhfgrnine -t7five9bzgxh5rcjxt -two6two4six911mszcfbmbkn -nh76sixninefourone7 -2fhbglnppmsixdpvzf4four79six -two765slgxvmdht -nbfjvhfxx26clnvc -blhmsixceight9zchkdzgj1pkgjt -hjbdbkjjcgxxtfrhng37sevenxcvlnszxz -vdzzrpbc67sixdvmmjlcxf -ponefourfour4 -sevennsxpzdpms1twofivethreednfive -4eightrncxsvpfftrhqmlnine -15qhpvsevensixoneightt -nine5onepphninefoursixqj -srbsfourone5 -59threep5sixseven8 -five32eight5eight -9threelxrzmnhfxqlsnpttdtn29vmcbflsrtj -21five9 -jtwonentpp8tbzdgcbzjj35nine9jfnpgdpr6 -7fiveeightoneightvs -sixfive53two8 -16onesixfivexxzmthsconepjpl -7threetwofoureightnrfskqshmgqzsgkht7 -3cprgg -sixmgxfsfcg2qmrcvj1 -86dth59xkclmzsmpvv -pbtqqfsqgxfiveqqgtfxk61kone1 -jcvmbflcqvd5seven4eighthtx -four1sixbcmbdhprf -bdgkrgkrtj7231ktxnthreesevenrhvdmdt -9cvsmgzprlk -zbkzpjh47htcplzrxfourfive -four88one4 -47sixtdfkv -onesixg935nzsnxqspfqdrd -7hmfivefivesevenjdjpfive -72rqc76jmvr -1two4 -six6four -nine4nineseven5bdkm -twojkdkrt1twosixtm3gjcdqnf -two22 -xbfzg57159 -rnfd7fpvbjgg8 -glpgbksgc85fivethree3eightfour -threefive36tzrdfourpfsqzmh -seven1nineckpznbsevenone -fivegpgsvvtvoneseven3two -threesixqnxjgzjtdn9xgtkq -6fiversgtwo -43eight92 -2onethree6 -5three55bshbhfjfqclkvhdhmbdqjlqnnskkmxl -cthdhxxjvzdfnthreemghlvt4threeb -44mcvpleighteightbtbvqfvf8lnbstqrcbz -5542727zkslrpth -7sevenninetprljfmfdjdk1fourone -fourninesix91phfzbmzx -vjdjdbckqktwoctwo3three9seven2 -bmeightwosevengxnkccpppmseven1fivethreethree -njxtrd7nl3xxjmrzrk82xqhllvt -4bndqkqlfheighttwoqrsqscggksff6ngnvfdzztqq -dqhxhdthree7one2one -8nine329tqr -mfmgpxmdnpthree8two1 -frnbxnsfivetwo2 -pbrljz8pbppkhfqtkmpgqrfivexpxvfmngzzhs -1kmrjljlpszkfhxxxkfour2eight -threeseven6twothreeqzbhqpqjlzqxpvb -6threeqmlpxbnqnfivefvdlsxlmsph -nqkvvpsix3cqdnfpxzgnnt -four8three3dthgjm44 -2qhgmgbnsjlsqsmxq8eight7nzbjthreefour -8lhlpbpzszdckgcsfbone -4tqddpdjhg661onetqmqzsrnjqt -86eighteightonefzjrbgvtftmzvxrfmxmfp2 -jqbfjxpn5sixeighteightthree33 -ninetwo93zczhjtxfcz -stn83dthgbrpxdb -sixsrzsdrtkdqmrnmjz186four -43nine78rchxzd8 -851lhp -5mqgcc -threejsix1kjrseven7one -gqtqktdzltwojlldjfxfqqzss61two -pj6llpzkvjxccrxkpfjdlmcqcknstdgkcgpvtc -2sixsix26ffpghkdz -36nhgntqjnsixeightzrzslheighttwo7 -9sevennine2 -nine23phtznthree -gmqfzxqrgvdsdfs5 -onefiveqgksmnone2 -fivesixxbzzdnxg4fivesixglvqlfvfc -7fivesevenmmlnftf392vngtrkcgxj -7fourfnqthreefiveonefdjrsqbrtqqfpqppfndfnrg -eight3gnrskgn -two3eight -173xr6 -zkqfivesdflnvhmm4three6eighteightqctcnm -four64vrtktbbchfssz -2xjnqrzrrsixsix -58sevenvgcplhtndx9seven74nine -jzqtshfcjrlkfive3twoeight8eight2 -threepxmtonemccbhpljtgsmvqmqpnhkgxmd22 -1nn1eightseven -xztfgc3twofive2seveneight7 -lxgbm2ninemcss -frkkkkvlhdnbbtvbjtjbtpcpvjkkmfourmvthreeeight3 -fcztz33fsqllqt141 -qbjeightwo6bjgjdgrqqmkgninethree -zk793vvsvgkxvpkmqkrgccbvmprl -fivesix93 -58pdmclsncs3 -7ceighteightonethreefiveseven -6mfkz249fivebclxg -8eightvvzdt6gcsqlxrtdbmqhpdjjskeight -onesnine1 -onevhhqxbnqsr37twoonefour -seven932zjfhplnrc1fivefive -8jtchfqrdhnsn -sixninefour6lpmmhmzlbtvtrpxsjlldvqj9qvdsfdzft -cfour34542 -hdhkgdqcnt5nine87dxbhctgqxphrdpcv2xzrdljqt -75vplkxcgrsix3bxdkrncdkt -nsj288636htbthree -8sevenseven -58five16eight8 -six95four44 -rbxeightwo6sevenplbhnbctqzcpcvmp7xrtwo6eight -jsjtkmz6 -nine8six2ninenq8nstthr -eightddsckkqlls23 -2ch2gbxvkqrfflqcdfxdfour -nrmmjfxsmcddk7onepcpdfkvjvhdhxsevensix -five6snkgvkzlkh -fivesevenfour9jslninesevenjtttt7oneightssr -8five1jjdtpx -eightsixrkthjm8281 -six242 -eighttggfourctdjmb7fivethreeh -sevenfive88sfgczpncmx -jtxxcsfmvfrdsgzqjdjxxgsrfnm9fivenine -seven48onefbbbpdhj5sixbgvfzpnp -fiveonenkksknhtcpsevenrxn7 -ztv7onenldv9nine -nineoneeight719 -tzpfllbninemsixfive61three -2cbmdzdzhnnx -tnpthreelvczcqhsflseven4msfzzltvmnprlq4 -8twofour3twokbvfkgfpq -eightgtpfsqcqtwo9 -htmvcztjsq5five3xjlbmmxvlnv -fourp89 -4tdxjtl7fmhlqfvkz -pxqg2 -45zzsevenninevpbtlqsix1 -2threedrmgj98one -35ninenine -snjqxsgqvn3sevensevenbm3ptpfive4 -9onevmfdlrzninethreebdr3qpvtqp -1eight6fivedtmxsrqkg496lbkvsmz -48vkmdsqhpzjghhsonethreethreezgfgvclhg -vnkvrxpmkvfour3 -ninexdtwogzjbltfours6lpkdj -n7rzskk61zqk39 -5fourcjnzfp521 -rcdbsqtmhgnfjfjxdskeightckpp8five -kvbsevengxmlncszddnmhzkpxlxr2nmkhm9eight5 -5gssevenqhmxmnv4 -nppqflmknine7 -vxkprrkfgsevenmfxjmnsevenkrzzlbshc6rzb -663fourfourkzpmzkzfour -3946sixninepvf4two -5qpkcgpmp6vrqtcqvsqbmmvrjtzkbtrftnine -fnbcn53zrn1eight -qtwone4dffhkjhjrqtwotwo -rgdz3rgqlzljxnpqntvzz -fivefour852eightwosx -8129rshnpjoneqrf -1hnrgkptsp74fdpvp -sixfoursevenone42threedcbm -four9lbkpjdrfznine29two -five2pdzldgrcrfzhrv2rzsfgmx25 -5nineqccvxgsshonesixlh2kgx -eightjzfncrxvlxeighteight9eighttmc -n29onesevensevenqxqnthree -6dcmxbqjtcheight84 -88jcsltgmbntwo4cxmfourone -1four4two6six5 -oneprptq6mfnfnm -4fdvvlk5nineone -one8288 -pxsvfzxd1 -six3gtlqvsix4zrbvfpsxjs -nlctwone5fivexspzrtm -five9nmzjsvntxct -threexzpxdtdfive6sixldddpxmxbmghmpdbd -sixsix1onesix8ninenineone -eight56jldskgmsjbnine159 -27one -eighttwo93sixfivesmgqfzspxvkztzxssseven -seven99mnnsbhxsrzvnhsvdmbpzqqdscl6 -ninetwothree2 -fourtrkdhszg4pjh2goneone -six6three5ninezpvc -79qcrtm8fivex5three -ljtwonefivesjninetpzhsbfxthree2vknbffmq7d -fivesix3 -95threebfxqrj72 -vqkhzxhthv4hdrprgsxjp -fiveprmznltwo7 -62c53fourtwo9prxbqhjf -one3zndsclzslt71bftv -2mjtbmnkjspsix952mk -34nine -gtrcfour7threevzmvlvhpf6 -lx5seventvzxlng -2kdlxgrdlqlfivecvccqxpjr -tmsqtqszspnskbmcsevenllstfh4ztn -eightlninemr5 -6one1jlplpzppt6 -7cvmrrclkfcfiveeightxrvhqqsjbblglt7one -cpvpftjrgj5jc -koneightkk7dbtkdmmbf -2krk842mbqnpthree -three7three -one3nineseven -4ssskfrfqhz9eightfour37oneightjm -jgjsfouronetwoseven6 -bkcninekjtwo1two -5two8onetwo -keightwosevenzsxpsgrzsone4 -jcmbkmpfourthreefivepvhkbtpqln9 -4vcprm7 -7qckxksgfbk6four5onesqfxzxm -5ninesevenfour5six24 -7sixfourthree -6eight58ptdrvgqlbc -nine8sxdbrvgxv -threebhnb6threebjbjxcq -threecbdtbftvcv4sevenfour3 -onehfvsd24 -ninevgbshtbprzfourqmclssgtrseven8zsgnqd -vrbcbsjdqzbjztmphk5 -25sixjrjqgl5fivekhtxstwovgxzfpvzfmoneightb -44bbpdhhvnptwoone29 -8eight78four -gcfiveninezjnjzqfourthreelggdhvgj4 -lfgsctldtkfdlbsskc99gbvjd1eight -xftwojgjsctwoptwonj9 -xnnm4sbx8 -seven986hkfone7 -65rdlfdxjeightwox -26fourclxlrcxjpkjvdhfseventworqsfnhmnnq -nineninexrk2twovdn6 -onesspsrctxsfn6ninesix7 -5c382ktrlsdlthree5jm -eight5one2 -fxzjcbznjj4sbb -cndp3 -blztpftbr3fiveckzgninebkms -td6 -one3sixfivevrvrnzzzq -8sixfivenzmnlts -one4fivelrlhonenbdfb -1twofivenine7 -four9ninetwothree8three6 -foureightfoursix2fivepkgzgmbbbc -rfftwonekccnsn28btwosixk -threetwo1foneeight -bzrzgbzdm23 -onefgqfzjnine2dvqzn -xgbjxnh1jtt -67ninedczm -ninercxgj4txpflzvhgtwoneqh -8four9cxdrdzrkn55djgbchdxgn -49seven7threeeightwokr -sevenone7qtxp76 -391two87five7 -dtpzlzxkntcvzjsevensixvflshlqxbnxtmfjnr7 -kkzkpdztb868nine3p -rxeightwomvsnt5 -85jkzsrtszdgxssm3eight2fourfour -jpjbkglsevenrhjrvl9svmcgshll -onetwonine4noneightvk -nine5vnlone -44hqbb4 -1seventwonfbmllcfnfivesixfourfour8 -5four4rjjlxhcvtwo82 -eightcjksmqq9rvshzgjbnmffbz -onefive11381rl -2dpkzggxxnineninethree6onexkllm -zdvbclq85xmddtggv9fgcsjm3seven -eightsix9fourfour -fourhrx7 -fourlheighteight6 -sevenplhqxqp89six -5mdlbrq9three85sixcsb2 -t9svczrjvmrtwothree -oneseventhree25fdq5jmbjmcthzp7 -pgzb31xfhkghbfljone6oneqkbg -vxqslqlfvp4five2zxvqdrbkt -two9six -threeonetwofvlklrmrkseven7mtldnsxmbs -eight6sjflkmczj -32three52sixfnqtxnnzztrt -qqtdlghsp8ks5two2qrmpjgccj -dknbccdfpr1eight4sixtvhfc -9mbc -pmpfprdkgblrnbf335skpkvxgstlzsevensix -sixeightkfs173mbmsixsix -twoqgptf1mfnpvxvlkrnxnine -54hpmzgm2three -1four8 -three11vkzqjzjncgj -nine19sevenzfour -4onen5fiveone56 -eighttwo2325twofourcb -lfpgbrvrfv47sckdqlqdblkjn -1qsgxhxtwo -83mgshbbrdpmseven7 -dsix66fourdzvqdnqlssjnine9 -3eightfive88eightwor -1djmjfive -dvxlvjthvlkrrc1 -zfgpndbflxmnhnnq9zx4 -one5twooneseven67 -13sixdgpmgseven -mheightwo1six4onethreegcxzvspnrqpngsmbplvhc -86sixlkdnnqqrkf6fjkvzlfxhhcxxroneprgrthhz -bsrsqjlskjbh1onezprh2one3four -6pnxslvxhsxeightoneeightsixnbdtkszthree -vjpp1931jdbrtdjrzk -7one278ninexgfive -mjkqddthpnineonetwo5eight -2gfmgdjkzbbf -5phlkvzbqmmxbfckcjjhfvone -8xjsevenrlrlctclvkc54one -1tqsnt11 -mmksbhrfour4ninefour3 -91fivefive -5sevenjdxdrrgxbz -threetdcdl531 -685eight3two -nshfeight6eightonenineeighttwo -threenineonermgnbjjzx8 -one4oneseven -ninebdpztnllhdvcbbpvcptpdkpvjhxrtmnmhllrnxvlgm64 -twoxhgcjdpx65fivedztfxzbdfive -999nine -seven6three8bsrqkfseventwo -6jf -sevenzkrcbxp6tmzfjnineg -b8xlrbjnrm -nine9fourtwothreeggg -seven8ninemkqxcbjdzzmrhjggbg5tksxtfcmg -2vdqplbceight -5drone -jxqczvknhmbxrdthree659qjxlrxk -5onefiveone -seven583sevenninepnbzmeight -14qb153 -3twohvplgxqqlzsgsevenone -78mpjrpmkponefive -6fmqpjbtv616 -325dj5lvtvbx -dzjvsszzonelbbvpnlkrctztjxgg9eightclxrqrzpmmgpzpmsxlfive -6lsseventbb8 -9tnqfksfivenine9 -5dbssjr -slbqhmrg3 -48oneeight9two84 -zxgcx9kfmxcjsseven -4nhb7hksxlpn1seven9 -seven4qvvzlbjnbhpp42one8 -twoeightgcpkkninejgfvzfsrjbtwo1 -846kmvbjpseven -33ndkljvxbxpjcrgjvct513 -6tcghtcbcgh9xgz3onenine -five72rfcmktxkvxvnstwo -seven5tkqbjgpkdqtwo773kcfznv -ninesphdrdxzvvvdfcpsvc6 -6q9pjsdzponerfnqt6eightwob -ztmjlr1srmgkeight -lsix2bcfz43mhpgldvlng -6srrmfdvtgqgeighthcvzpctzpdone -zntvlvtfmvntcvjxqffthreectlnzst5onekpxvmsvnb42 -threethhkkrqhkpvmfivefour16three1 -53fdhjxldlxxthreethree3six -nzhdhtcjbseight47sevensevenlmdtjsqlpqcmqmbvp -4bvsj -1ninesixtsbgdvhseventhree9jpmrvpdzxb3 -czqzzbbfcnzfive3bvcrvvhvz -53bqfhhrsevensix -2lmrjtkffk5 -5fjbdvxjrcrtvmjdttjfs8 -x1jtzzclsdnfive7four -5jnvphzlpphfivesix -jfkhkxvlqrdkbc67rqfcfh4rvprmvcone -k9sndkdgvzjg9threenine2 -ltwone1 -five5jhnine -5sevenlcnxcpgdnzrftsn3threenine26 -h6fourgqfczsjtkfqpcmzfive -5eighteight2 -fclsdrjrthreebvjspsoneonefivenpfszjfqcd1 -twofourfive1qbrndpvone23one -six4ljzxxboneqrhgvg26 -klhsqnkrqhlsfivesixthreesixfive9 -9rslrdg -15xfdsix -zbzd15cgcrn31 -fbqvdzgsvlsix4twoeightpjzdhpxxjkq -79xlmrz3tcgvfvqf -5csjgmkpkthreefgjqvtdskbvxk12 -vrdlmzcpfour6trmt8gtjfpftdkgdlq6 -rctptptb5fourttds -gfkvkcbkfsbvmbcthxzbfs9rzdnine -4zmkhjrcbxvdp -8ftngfour -fivefourninefour5four -3vfjtjngsevensixfqngpjrpfkcsdgctseveneight -vpqeight11plkjc -threethreezldtgz3hscrb -4sixone7qlgv -twofmqgtnkddkrfdtnhrone7ntq8 -tvvzmvxhjseven7four5nine23 -two3fourdxscvcljhrjmjlpbxgcninefoursix -six4twothreesix1six -4rj4twohzjs -four8ninesevensx49m -onernjnjrqsjhnp9two -3hsjlskjpcvs1nine -587 -one7threethree2 -dtsfhss6sevenseven8 -honeight5one -1eightworg -6eightvpxctxffive -2x6pkjntnbrlhjfkgbvp3 -9rrhssqzdlcmmjvqvrkvqpfonetwofhfhzktfzzdbjbj -5mxhnqdg4htcqxtkccghgrzktsnzczfqrpl63 -sevenseven7fivepgc -8onecctzfxreighteightwoq -mpfjlf1twofbzzhl3ljpfc41 -ltwone3 -dfourfive2 -jlnxxb2one -1cnxtwo1 -rmfjddmhh16eightone -bgrzn28eight22 -vp55nnjtfzjh8rjmzxxxdjs6r -5ghbzsbxqt94threefive -6tjvvtrhbglntone1bflzxmzvtr9ngd -zqlfffptkp2eight -six8threersgxztgnvrpjzjhgtprqbgeighttgkmgxvlpxgkt -zxbnqeightvhsnm95svscpcjhth5ninefive -jmgpmfxtwohvxsfr3seventwo -ncpgtpqfivejnblppxtn8khcjzpk -sevenonethree95 -hkcvxrjjshkdxsixbpjl62fzrzpnvtqg -cxzvnn52ninesixtwoonergjdktpkl -93nine -11fivetwo -8qmhfoursix156 -twofivethree27 -sevenlnjqseveneight6fivepvmz6rdbxm -vlrvxfourshqpprchjx3dcknntththreeseven8 -2three7threemscjggthreemkxmgg1 -43hghlbtcbf -jhpcdczrxgpktvlseven4shllbs2three -hpthreerhkgdtksk66fivesevendxxzfm -four3dqqglksxk -eightrhmvhzxlrdjvjvpzhzzcnvxxdrjzl9sevenfourlcqksq -9sixxcfq7onebmp -8keightfiverntpleight -jtwone831 -qqsksdcfsmvx5lhfgrl6two954 -8lhjzsjgms -8ninenjsxtzqkmn -gpffcfqxlr84one4lzpfkzdkpc -svncmqmvstwoqgknfivepmjll4xt -five3kkqzrbtvvfcts4three1four -4sixseven8five3five -six9twosixqtldl -2fourfq -mjrtwo7ninedqsmxskpxfc9t -onenvjnsrvjzrqspsdbgjhdjrzrfmxcxnc9fourtvgpdqzxvb -478xp5mqgnninef -mtjtzgflgztgsqpxskp37zm -hgsxdpttj64mthreegzptcsfour -eight8vfgtgftwofqtjvskxnnthonemgdhjzh -threeseven6llbgbrbptthree3 -one8two9fivefour3six -52dqcrxhzqmzsixmhshnntwo -lsfive5nvvhgsnl -8twoxhgthreebdfgcn8jflhc -297seventwo4ctnbprxgztwonine -3onefourkthx6vn -nltzeight6fggtwo -84431lzgcftv -spf2qkvqcq -3gfbntwo1fournine2qlp -nckqg1four7mhltx4jvdzpjzvj -bllkbr2 -fjjgvvmfsfivetwo5sevendd -7bpmh2zrgsms -fourrdkrgfoursix1 -seventwo52zbdmftninensfdvkhssix7 -sixxkrf4qgtnine2kqhmb -eight7z -rnfhttjjrpdnxxqfkhs9lbsktsmvsixone -61threenfhkskphjjjstnzjtxcjf7five -zhtkvbqchlvthree5twonine3 -pl9dhnzntgkmjhglxtlcnsfc -7eight2sixnine43 -69xfqxbtvseven1four2qr -1k7 -twovdgh768 -6hmjcxsgkvd -7jftfkckhzlqjqtbvmhxrsix -fivencbmjhjbp7 -trgtjmjggtzzjnhd5fsnqnkppkninesevenphgfrfive5 -qcglfonesix23bffsmd -five7srldjmmnhllftzbcdrm -two33gjtxvtwo3ltrfqdmvvpseven -gccvxspxlm6one -zdfjvdeighttkslnjnft7dl74 -ninethreenbvmfpbgzgkv3 -ninenine7njgrzxmnn7 -rtwonenineqxvbgtj4 -sbcgvsrmvtwo2sevenj68 -6dfrjfqxjghbxt -rt5four2 -vscftsphsqsix3 -3eight68d5kf93 -vpbjpqjrmz9fiveninedpzsvdvdfb52grzxlbbqsr -gvtwone9vbmpdznhlfive8two -4bnfxslqgvnzcbsjcrfzv -xtcdvhlkgrjjjmone48 -mzoneight9995five2bdg -ptwo2fivedqxthreesdmbvdcdxrtwonegt -vgjvrfcvbxnnfds17 -27threeeightnine3nineseven -4fiveninethreeqn -68vhkqqcs -sjnzkhxvnine28 -3fiveghc1threems -45jvrhdh2three9l -pbntkjbps1 -slgsx9sevenone7xcghccxqs -twomlm4ksvonefournine3vdxp -four9pvmone7twofourcndpfour -hfdnzvfgqn2 -3fsshkvcseven545 -six45jgxzgjnlqk -slrv18five -78twoninepdghsneightone -two83npblhtp62three9 -hjmpkjvkzhxpzflz96 -fmcnine4vmmtxlmdrntwofoursix -352five7935 -891sixfive8 -4fourmdfpkcpb439sevenfive -3seven69czrrsrzhpm -two5six56sevenlpmrxdthree -npzg6hpmrczqxmn3twommkmzkzhgkcxrtwo -f498hhvtrnhgd16bdcd -5sixhxdjmkkmdbskls -fqfvbsfprqrhlgrmdprx1fvfzvcgssttknck -9one741 -seven54jsjkhseventwo69 -8threeonejjonefivefivekrlvtjt -xcdbx5mqkstvqkbhrdfllzfive -gbf89dsrg6ctwosixppxxbgs -83ktsdjqt -eightfourbcl6797vcbhbl1 -threefive6seven -9ptxjzxj7six4 -onefiveqjjhfqrfzonesix6pfqhxvsq -eight385 -mvsqltkmsrzqzdgkf66onellkvmtv3two2 -khztwofour7tfnvhmsqnnqkbfdjgj8 -msvhqzqfivetwoschjghsm6 -lmsxxt43four -hdfdltsrtwoseventbqr7pckgcqtcgh8onetwonez -1sixeight -1t3qtqgnvdrteightthree6 -6zb997 -four83dg -4four2xqnpqvgkmh -cbrkm6seven27 -9rxrddhlfiveeightninesixpdfznbhrfrvjnjd -one8seven -7onegpllvh59bmponefpjeight -one4fftcrjntqpnzqlfive -9hgfbffour67two -nine6tworqjv -4xggvdktqfour6fljjxflkflqzeightcbsf3 -eightmqphonehgthrpfvmfthreethree8 -1five4xrgqxn -vkmqljhpcbonejjsx6one5one -two1five2dgftmk13six -eightmrv1eight -gkzznsmt429 -fivetwo73mhpmbndgvpklzhqk7 -84sixlhfxnspqjveight3onedrksx -6six2lnxmr -7rqsmbkcv -4jkbdtpsppseven32sevenqqbvm4 -two8vhhdsnqv -qksb8klxlv74891 -ninesevenfivenine26c -sevensixnine81zjg -three7bbb66 -three7vmnine8xqkmtfmpnine8 -2zhtwo4eight4nzjcvmjtdcv -eight57 -six3xs7zpdvltmmtnhtk -fourvfxnjddkjs7two -1mzmfsfnbqfgqvft7two -vqbdzhncsj7one13twosixxlngtfive -threel94seven -threenine299 -jqkmcsqtclq5636six84 -8gvd68eight1 -t43 -3bv4one32 -3onepvjdjpfiveqbgzrmktm7tkhbp7 -459onetvsone -nineggxcstltptbsixthree6glqhxdgnjp6jmjcrm -hhnvqptdkj9one -nine8four8897rgfs -onenine16dgkjnfkmxqfninervgcqmxsbtwo -two7eightzrpone -xkbcjqnt4fourdpsgbqf1three4 -27jcbntptlmldhnzmkgqmm -vfcrlftnb5mzbbsixeighteight -tnqkf4gseven56czt -teightwo4 -8eight1seven36slslntk -tnqkj9 -five84psznfjvl5onefivefour -nsjlsrkfour33 -sftkhmxq89hsvcsznrdxfcgprmjcktbxkbnkvb1 -six33 -rmbnnbnrdg7sevenhsrrnjvn2 -qhthj75bglpd2hlpxst64 -lmcdttjzrnxdnn6pbszxcxzxmhxj -62xvvkpbhhbthreetwooneeightwozr -mtln1fvmflgtrq94threeeight -7five6 -8j -1threehvkrhfm3mgsk2six -zlrvhfhpglnkpnm4lzljvzlgrzthree5three -scqbffjvdjhsrfsix7twonine -eight97 -6five1eight -31kvxzjpgd3 -sevencsgvmxbtgtp7eight -sevenpjnbgtmsninexfbh4mjdmgsdtdb92 -five11nqgttpfj -tnxxs729k -1sevensixsptxkmncrkfxone -nine1fivefive16twoqm -575xtbkrbnlrrtr7hfourmmbrgtjvj -three8gseven6three9hkkvjzvzlz -eightstktmqdn8mf48four -298xqtwotwo4fourhhhcblpg -7xpqpjdlrmtwo399tccfour2 -64xs5njxdnqvonekrsbfhlvttdjp -threehgzhfbqjzktwo8 -1jjgvxnprfbmcthlskqjqqzrr1 -nvpbcbsgbf6eight -vvkvdd3four -7onesevenlrmngnineseven6one -22three -msfbjpnd1seven6 -2fivethree2cp1six -7two733 -8sevennine4hsgg -fourfive293three -onedtrbdcdseven6twosvlhbdfive9 -8five8threeeight -gbj5hcjtfgbxppzdcf -sevenbbbj7 -msevendfkqzz34 -skrzfqonemzrcxdpdb2 -twoeighthfsgbsmbmsqrsknrdxrcxshfndvmhfzj1lhhtkktlxeight -178fbvcglzshfzknffgprnxvxgqnhznine7 -two13pxfvzxnqrq2tkdfsfkbbgkdt9 -sevenjbs2fourmjglztjfive -58five6vhm311 -gngfzhcdhmczsffrkh5nclkcfcnfivefive28 -883nr7onesttq -eight8four147vmtpgzbpft -6dbsixtwoonenine -three3tlx -jlhlvvztsmctvxndlnvbxk1 -qlfmbmfkfm98m -fiveseven5786cmthree -7tgklbjhhcxndvk63sixnine -fgjqhqvtwozjfxgxpkz1six -3dxnvg4ninetwo -5twoone9lnvdxhctn -dnjpqnplxq9rxfour6one4slqlhsnc -tgkfourthreetwofive4npnnvthjgf8 -tjzjppnsksix4 -lmfkvgfzfmhxqrcvsgt28ssmhm5fivethree -fourninefjxpvpbnhm29oneninesix -hmxjs2sevenfive68nine -five3eightsfvftdxl -35sjcqtqpqz7fiveeight -lbchtbsnhmxlq1rcjrlvgmdjmjhtk -2gmzrn34eightkdpsgnine -sevenljzcxlgpskvkprjb6 -sixkbsdxjvsncj2four -1sixbl9seventwotgtfcstqgv4lc -89threeseven5tnshndjcsxc -42 -ninesevensrzxkzpmgz8kcjxsbdftwoner -4gbdzqtddmt4eightsixfive -dljxl7five6nrzfh5one diff --git a/examples/aoc2023/day01/part1.jou b/examples/aoc2023/day01/part1.jou index b0a28bb0..2e0a9f2c 100644 --- a/examples/aoc2023/day01/part1.jou +++ b/examples/aoc2023/day01/part1.jou @@ -4,7 +4,7 @@ import "stdlib/ascii.jou" def main() -> int: - f = fopen("input.txt", "r") + f = fopen("sampleinput.txt", "r") assert f != NULL result = 0 @@ -23,5 +23,5 @@ def main() -> int: fclose(f) - printf("%d\n", result) # Output: 54630 + printf("%d\n", result) # Output: 142 return 0 diff --git a/examples/aoc2023/day01/part2.jou b/examples/aoc2023/day01/part2.jou index 1ff43ea4..0644e623 100644 --- a/examples/aoc2023/day01/part2.jou +++ b/examples/aoc2023/day01/part2.jou @@ -16,7 +16,7 @@ def parse_prefix_digit(s: byte*) -> int: def main() -> int: - f = fopen("input.txt", "r") + f = fopen("sampleinput2.txt", "r") assert f != NULL result = 0 @@ -35,5 +35,5 @@ def main() -> int: fclose(f) - printf("%d\n", result) # Output: 54770 + printf("%d\n", result) # Output: 281 return 0 diff --git a/examples/aoc2023/day02/input.txt b/examples/aoc2023/day02/input.txt deleted file mode 100644 index d3ee472b..00000000 --- a/examples/aoc2023/day02/input.txt +++ /dev/null @@ -1,100 +0,0 @@ -Game 1: 3 green, 1 blue, 3 red; 3 blue, 1 green, 3 red; 2 red, 12 green, 7 blue; 1 red, 4 blue, 5 green; 7 green, 2 blue, 2 red -Game 2: 1 green, 19 blue, 1 red; 8 blue, 4 red; 3 red, 6 blue; 1 green, 1 red, 12 blue -Game 3: 3 green, 1 blue, 9 red; 1 blue, 2 green, 8 red; 1 blue, 2 red -Game 4: 6 green, 2 red; 2 red, 16 green; 3 red, 1 blue -Game 5: 5 blue, 1 green; 3 blue, 3 green, 3 red; 8 red, 1 blue, 2 green; 7 blue, 6 red; 4 red, 4 blue -Game 6: 5 red, 20 blue, 3 green; 4 red, 20 blue, 3 green; 12 blue, 3 green, 1 red; 3 red, 3 green, 19 blue -Game 7: 5 red, 3 blue, 9 green; 12 red, 3 blue; 5 green, 3 blue, 19 red; 6 red, 1 green, 3 blue -Game 8: 9 red; 2 green, 1 blue, 7 red; 5 red, 2 blue; 3 blue, 1 green; 1 green, 14 red, 1 blue; 3 blue, 4 red, 1 green -Game 9: 11 red, 2 green; 13 red, 8 green; 15 green, 3 red; 1 blue, 9 red, 18 green; 2 green, 12 red; 15 green, 9 red -Game 10: 1 green; 16 green, 3 red, 2 blue; 1 blue, 16 green, 4 red; 16 green, 5 red, 2 blue -Game 11: 2 red, 18 blue, 5 green; 4 green, 12 blue, 9 red; 6 red, 4 green, 5 blue; 8 red, 16 blue, 2 green; 1 green, 18 blue, 13 red; 13 blue, 9 red -Game 12: 5 red, 10 green, 4 blue; 8 green, 8 red, 14 blue; 10 green, 17 blue, 13 red; 7 blue, 9 red, 13 green; 6 red, 16 blue, 4 green; 16 blue, 14 red, 16 green -Game 13: 6 green, 1 red, 1 blue; 10 blue, 15 green; 1 blue, 2 red, 5 green; 2 blue, 1 red, 20 green; 3 blue, 3 red, 10 green -Game 14: 2 green, 2 blue; 2 green, 3 red, 4 blue; 8 red, 1 blue, 1 green -Game 15: 3 blue, 10 green, 1 red; 16 red, 1 blue, 20 green; 7 green, 6 blue, 13 red; 8 green, 20 red, 5 blue; 8 blue, 8 red, 18 green; 17 green, 8 red, 10 blue -Game 16: 6 blue, 5 red; 6 red, 16 blue, 11 green; 1 red, 3 green, 13 blue; 1 red, 5 green, 1 blue; 3 red, 14 green, 16 blue; 1 red, 1 green, 3 blue -Game 17: 8 green, 5 red, 7 blue; 2 blue, 2 green, 6 red; 3 green, 4 blue, 15 red -Game 18: 5 blue; 2 red, 9 blue, 3 green; 4 green, 20 blue, 2 red; 4 green, 2 red, 5 blue; 16 blue -Game 19: 15 red, 1 blue; 3 green, 16 red, 4 blue; 1 blue, 3 green, 4 red; 9 red, 2 green, 6 blue; 2 green, 5 blue, 4 red -Game 20: 12 red, 7 blue; 11 blue, 7 red, 1 green; 1 green, 10 red, 4 blue -Game 21: 9 blue, 1 green, 1 red; 4 blue, 2 green; 1 blue, 2 red -Game 22: 1 red, 10 green; 6 blue, 4 green, 1 red; 6 blue, 12 green, 1 red; 3 red, 4 blue, 10 green; 1 blue, 13 green, 1 red -Game 23: 14 red, 2 blue, 3 green; 8 green, 2 blue, 4 red; 2 blue, 7 green, 4 red; 4 blue, 7 red; 1 blue, 8 green, 13 red -Game 24: 1 blue, 6 green, 7 red; 6 green, 2 blue, 5 red; 1 blue, 3 green; 2 blue, 9 green; 1 green, 4 red; 5 green, 4 red -Game 25: 8 red, 2 green, 6 blue; 3 blue, 15 red, 1 green; 8 blue, 2 red; 2 blue, 1 green; 2 green, 18 red, 1 blue -Game 26: 9 red, 11 green, 6 blue; 1 blue, 2 red, 16 green; 15 green, 11 red, 6 blue; 3 red, 13 green, 6 blue; 20 red, 2 blue, 4 green -Game 27: 9 red, 10 blue, 17 green; 8 green, 15 blue; 4 green, 3 red; 11 blue; 14 green, 1 blue, 8 red; 10 blue, 5 green, 3 red -Game 28: 2 green, 17 red; 7 red, 6 green, 6 blue; 12 green, 16 red; 7 red, 7 green, 7 blue; 7 green, 8 red, 5 blue; 7 red, 5 blue -Game 29: 2 red, 2 blue, 3 green; 3 blue, 1 red; 3 green, 2 blue, 1 red; 6 red, 1 green, 4 blue -Game 30: 8 red, 15 blue, 4 green; 5 green, 9 red, 15 blue; 1 green, 1 blue, 11 red -Game 31: 6 blue, 2 red, 1 green; 2 blue, 2 red, 8 green; 2 blue, 1 red, 7 green -Game 32: 6 red, 7 green, 6 blue; 9 red, 6 blue, 6 green; 1 green, 13 red, 4 blue -Game 33: 3 green, 1 blue, 9 red; 2 blue, 12 red, 4 green; 1 blue, 5 red, 1 green; 4 green, 5 red, 2 blue; 1 red, 2 blue, 3 green; 3 green, 3 red, 1 blue -Game 34: 1 blue, 9 red; 3 blue, 4 red; 3 blue, 5 green, 10 red; 2 blue, 9 red, 5 green -Game 35: 3 red, 2 blue; 1 green, 10 blue, 4 red; 1 blue, 5 red, 2 green; 5 blue, 2 green, 1 red -Game 36: 9 green, 6 blue, 1 red; 16 blue, 8 green, 3 red; 9 green, 8 blue, 2 red; 3 green, 3 blue, 1 red; 16 blue, 3 red, 3 green -Game 37: 1 green, 1 red; 2 blue, 3 green; 1 red, 1 blue, 5 green; 1 red, 9 green, 2 blue; 12 green, 2 blue -Game 38: 16 blue, 12 red, 4 green; 15 blue, 5 green, 6 red; 7 red, 12 blue; 19 blue, 15 red, 1 green -Game 39: 1 red, 2 blue; 1 green, 10 red, 3 blue; 1 green, 2 red; 1 blue, 3 red -Game 40: 11 blue, 6 red, 3 green; 2 blue, 12 green, 1 red; 16 green, 5 red; 5 red, 10 green, 6 blue; 3 red, 13 green, 1 blue; 13 green, 3 blue, 7 red -Game 41: 19 red, 1 blue; 9 blue, 6 red; 10 red, 1 green, 17 blue -Game 42: 1 red, 8 green, 12 blue; 8 blue, 10 red, 12 green; 9 blue, 8 green, 9 red; 8 red, 11 green; 12 blue, 5 red, 2 green -Game 43: 6 blue, 7 red, 9 green; 4 blue, 6 red; 3 red, 4 blue, 5 green; 7 green, 15 blue; 15 blue, 9 green, 6 red; 6 green, 8 red, 7 blue -Game 44: 12 blue, 5 red; 7 red, 16 blue; 2 red, 4 blue, 8 green; 3 red, 10 blue, 3 green; 5 blue -Game 45: 3 green, 4 red, 6 blue; 1 green, 2 red, 11 blue; 6 red, 9 blue, 1 green; 8 blue, 3 green -Game 46: 1 blue, 9 green, 1 red; 1 blue, 2 red, 6 green; 10 green, 3 blue -Game 47: 2 green, 4 red; 2 green, 4 blue, 2 red; 2 blue, 3 green, 12 red; 12 red, 3 blue -Game 48: 4 blue, 3 green, 16 red; 1 green, 2 blue, 2 red; 9 green, 7 blue, 13 red -Game 49: 4 blue, 5 green, 17 red; 1 blue, 13 red, 2 green; 15 red, 1 blue, 5 green; 4 blue, 7 green, 19 red; 4 blue, 3 green; 2 green, 2 red -Game 50: 2 red, 3 green, 7 blue; 1 green, 9 blue, 1 red; 19 blue, 4 red; 1 green, 13 blue -Game 51: 2 blue, 4 green, 14 red; 8 blue, 17 green, 7 red; 1 blue, 6 green, 19 red; 20 red, 17 green, 6 blue; 2 green, 1 red, 9 blue -Game 52: 13 green, 17 blue, 2 red; 18 red, 12 blue, 10 green; 11 green, 17 red, 9 blue; 7 green, 11 red, 9 blue; 12 red, 15 blue; 7 green, 4 blue, 5 red -Game 53: 2 green, 1 red, 3 blue; 1 red, 1 blue; 1 blue; 1 blue, 1 green, 1 red -Game 54: 2 red, 5 green; 3 blue, 3 red, 2 green; 1 blue, 3 red, 5 green -Game 55: 7 green, 5 blue, 4 red; 8 blue, 7 red, 8 green; 12 blue, 2 red, 16 green; 3 green, 8 blue -Game 56: 9 green, 2 red, 1 blue; 1 blue, 11 red, 3 green; 9 red, 1 blue, 8 green; 10 red, 16 green -Game 57: 1 red, 5 blue, 9 green; 19 blue, 2 green, 5 red; 15 green, 3 red, 7 blue; 2 blue, 15 green, 9 red; 5 red, 9 green, 15 blue -Game 58: 5 green, 1 blue; 3 red, 2 blue; 2 blue, 1 red, 12 green; 8 green; 12 green, 2 blue; 4 green, 4 red -Game 59: 11 blue, 5 red, 4 green; 6 red, 1 green, 3 blue; 7 red, 10 blue, 4 green; 12 blue, 1 red, 1 green -Game 60: 3 green, 10 red, 10 blue; 10 green, 6 blue, 10 red; 1 blue, 6 green, 7 red; 3 red; 8 blue, 7 green, 8 red; 3 red, 19 green -Game 61: 11 green, 3 blue, 20 red; 3 green, 3 blue, 20 red; 10 green, 12 red, 8 blue; 4 green, 8 blue, 6 red; 7 blue, 10 red, 5 green; 6 green, 6 red -Game 62: 10 green, 9 red; 2 green, 2 blue, 5 red; 4 blue, 11 green, 12 red -Game 63: 5 blue, 4 green, 2 red; 5 blue, 3 red, 2 green; 6 blue, 2 green, 2 red; 1 red, 5 blue; 1 green, 3 blue -Game 64: 5 blue, 4 green, 8 red; 8 blue, 12 red, 10 green; 8 red, 7 blue; 7 green, 7 red; 5 blue, 1 red, 2 green -Game 65: 3 blue, 3 red, 15 green; 12 green, 3 blue, 12 red; 13 green, 6 red, 2 blue; 1 red, 7 blue, 3 green; 9 red, 5 green, 7 blue; 1 green, 5 blue, 9 red -Game 66: 1 green, 6 blue; 7 blue, 8 green; 2 blue, 9 red, 14 green -Game 67: 1 blue, 8 red, 1 green; 7 red, 10 green, 4 blue; 3 blue, 1 red, 4 green -Game 68: 8 blue, 8 green, 10 red; 4 red, 5 green; 4 blue, 12 red, 15 green -Game 69: 2 red, 3 blue, 2 green; 1 blue, 15 green, 4 red; 15 red, 20 green; 8 red, 4 green -Game 70: 6 red, 4 blue, 10 green; 5 blue, 6 red, 16 green; 9 green, 1 red, 1 blue; 2 blue, 6 green; 1 green, 3 blue, 5 red -Game 71: 9 red, 9 green, 4 blue; 1 blue, 5 green; 4 red, 2 blue, 5 green; 1 blue, 3 red, 2 green -Game 72: 14 blue, 1 red, 4 green; 18 blue, 1 red, 3 green; 1 red, 1 green, 10 blue -Game 73: 7 red, 6 green, 1 blue; 14 green, 1 blue, 4 red; 7 red, 18 green; 1 red, 5 green -Game 74: 9 green; 1 red, 7 blue, 4 green; 10 blue -Game 75: 4 red, 1 green; 1 green, 4 red, 2 blue; 3 green, 2 red, 7 blue -Game 76: 16 green, 7 blue, 1 red; 2 blue, 6 red, 2 green; 7 blue, 17 green; 5 red, 15 blue, 15 green -Game 77: 1 red, 7 blue, 8 green; 1 red, 6 blue, 5 green; 1 red, 5 blue, 4 green; 8 green, 1 blue; 2 blue -Game 78: 9 green, 3 blue; 6 red, 12 green; 5 red, 3 blue, 10 green; 3 blue, 14 green, 13 red -Game 79: 20 green, 1 blue, 3 red; 11 green, 4 red, 2 blue; 11 red, 1 blue, 5 green -Game 80: 14 red; 3 green, 2 blue, 7 red; 1 blue, 6 red -Game 81: 1 red; 11 blue; 11 blue; 9 blue, 5 green, 1 red -Game 82: 13 red, 17 blue, 9 green; 1 blue, 2 green; 9 red, 5 green, 6 blue; 10 green, 14 blue, 14 red; 5 green, 2 blue, 10 red; 4 blue, 4 green, 2 red -Game 83: 6 blue, 3 red, 5 green; 3 blue, 6 green; 13 red, 11 green, 1 blue; 7 blue, 1 green, 14 red; 9 green, 2 blue, 3 red; 8 green, 3 red, 2 blue -Game 84: 5 green, 8 blue; 7 red, 7 blue, 10 green; 7 blue, 7 green, 7 red; 7 blue, 1 green, 11 red -Game 85: 12 blue, 1 red, 2 green; 3 green, 13 red; 17 red, 1 blue, 2 green; 4 blue, 15 red; 9 blue, 7 red; 2 green, 11 red, 4 blue -Game 86: 15 green, 1 blue, 8 red; 1 blue, 18 green, 3 red; 3 red, 1 blue, 16 green -Game 87: 9 red, 17 blue, 9 green; 4 green, 6 red, 2 blue; 6 red, 5 blue -Game 88: 8 red, 6 blue, 17 green; 17 green, 5 blue, 12 red; 2 red, 14 green, 1 blue -Game 89: 14 red, 5 blue, 6 green; 1 blue, 6 green; 4 red, 9 green, 8 blue; 2 blue, 4 red, 11 green; 12 red, 1 green, 8 blue; 3 blue, 2 green, 5 red -Game 90: 3 red, 3 blue; 14 green, 8 blue; 4 red, 12 green, 8 blue -Game 91: 2 blue; 2 blue, 8 red; 4 red; 8 red, 1 blue; 1 green, 2 blue -Game 92: 16 green, 16 red; 5 green, 2 blue; 14 red, 16 green; 17 red, 1 blue, 12 green -Game 93: 9 blue, 14 red, 6 green; 2 blue, 6 red, 3 green; 1 green, 2 blue, 12 red; 6 green, 8 red, 5 blue; 5 blue, 9 green, 10 red; 7 blue, 10 green, 3 red -Game 94: 2 blue, 13 green, 7 red; 5 red, 2 blue, 14 green; 8 red, 9 green; 2 blue, 8 green, 1 red; 7 red, 12 green; 2 blue, 3 green -Game 95: 1 red, 8 blue, 4 green; 1 green, 3 blue, 2 red; 6 blue, 2 red, 1 green; 3 blue, 4 green; 3 green, 1 red -Game 96: 15 blue, 8 red, 5 green; 15 green, 16 blue, 4 red; 11 blue, 8 red; 16 blue, 6 green, 1 red; 10 blue, 9 red; 1 red, 3 green, 3 blue -Game 97: 11 green, 8 blue, 4 red; 12 green, 11 blue, 1 red; 4 red, 1 blue, 11 green; 6 green, 1 red, 7 blue; 5 blue, 12 green, 4 red; 5 blue, 8 green -Game 98: 4 green, 15 blue; 13 blue, 8 green; 10 blue, 6 green; 1 red, 7 green -Game 99: 1 green, 3 blue, 18 red; 8 blue, 19 red, 5 green; 7 red, 2 blue, 2 green; 10 red, 1 blue, 2 green -Game 100: 4 red, 3 green, 4 blue; 8 green, 5 red, 2 blue; 1 red, 2 blue, 7 green; 3 blue, 8 green, 5 red diff --git a/examples/aoc2023/day02/part1.jou b/examples/aoc2023/day02/part1.jou index e9b2593c..5e44a301 100644 --- a/examples/aoc2023/day02/part1.jou +++ b/examples/aoc2023/day02/part1.jou @@ -32,7 +32,7 @@ def game_is_possible(game_data: byte*) -> bool: def main() -> int: - f = fopen("input.txt", "r") + f = fopen("sampleinput.txt", "r") assert f != NULL result = 0 @@ -49,5 +49,5 @@ def main() -> int: fclose(f) - printf("%d\n", result) # Output: 1853 + printf("%d\n", result) # Output: 8 return 0 diff --git a/examples/aoc2023/day02/part2.jou b/examples/aoc2023/day02/part2.jou index 0cef5566..4517320e 100644 --- a/examples/aoc2023/day02/part2.jou +++ b/examples/aoc2023/day02/part2.jou @@ -45,7 +45,7 @@ def parse_game(game_data: byte*) -> Game: def main() -> int: - f = fopen("input.txt", "r") + f = fopen("sampleinput.txt", "r") assert f != NULL result = 0 @@ -58,5 +58,5 @@ def main() -> int: fclose(f) - printf("%d\n", result) # Output: 72706 + printf("%d\n", result) # Output: 2286 return 0 diff --git a/examples/aoc2023/day03/input.txt b/examples/aoc2023/day03/input.txt deleted file mode 100644 index 3030b760..00000000 --- a/examples/aoc2023/day03/input.txt +++ /dev/null @@ -1,140 +0,0 @@ -........897.......839...........651.399.............236...............................343...986...........308............................... -........*................*404......*............134.....953..508=.....................*....*..........325*..........744......392............ -...350..847..403...-..541.....622.................*....................356.......%..95...793....................830...........*.....163..... -.....&.......@...105.............$..745............42...785.............*..443.412............922..............*...........663........*..... -.253....../..........696.............*..................*..............817.$.....................*...........62........................373.. -...........244...419....*189....=........*...871.74...797...353.737................227..626.....429.726%...9......*956...803/.......*....... -.793...........=.....-...........119..683.18.*...............@......+.....182..372....$.&...................*..756...............945.610.... -....*.........496.....395.....................929.746................76..*.....*..............673-...*.....47........591..271............... -.....964..................241...........*............+.....+....590.......129.6....$.....@...........680....................*............... -..........523*448...........&....136.759.356............789.......*.................367.330..397.............483....354......354...869...... -...488................920........*...........................652...802....$.......*............*..............-.....................*....... -..../.........986....*......*....550.995......376...............+......641.....567.315.........887..66...863....552.936..........277........ -.................*.800...354.464.......*.533......................20.......704..........918........*.....*...........*....214........&434... -........%.....589...................596..*.......373...-..........*....785.@......941......*....521.......908...897..610.................... -........384..........827*101....698......978....*......947.614.571....*..........@.....+...1.......................=......#73...734......... -122%..........*...................*..........993............./.....260.........+.....466...............%........................*........... -...........938.992........246......305...449......335...739................588..681.........920.....164.........................431......... -..558....$........................................@.....*.....................=............-............847.....879..51................624.. -.....*.104....*818.......505.785.10...................161....210....................723..........55......*..424..&.....*.........723..*..... -...44......542.....975..................437...............51....*686.....*....../..*.........990*......708.....@....715...&....#.......997.. -...............801..@.............-....*.....702....&....*............238.236.706.183..+................................842.545............. -...........202*...................906..204...*...990......212....380%..................208...................66............................. -......./........../....878............................266.......................278...............920...................144.........423..... -....494..*.....976........@.....&.......*287...553-..*.............731...................649..247*........703......@....%....817....*....... -.........856.......592...........708.404............707.......274...*........-............#.....................%.567.........*......431.761 -.............663.........974...............%...446.............*............751....793..........811....225.&...48.....860..887.............. -................&...........*.......673..536......-.........447.....@...............@...$..................816..........*................... -....822................@....251....$............................413..306.164.............540.....313..476..........@...586./65....840....... -.....*......@.950.....266............$.........1...+...............*..........373..................*.............885.................*...... -......157.529....*.........341.....480.............60......765....122...633....+............$182....963.....................587..976.824.... -................172............685.....480....#........831*................*......747......................262..................-........... -....*......+438.....@......332./.......=...739..815...............356.....119.273.&.....317*674.......=...*....561..........192..........89. -....867..-........179..............319........../....74@..952*374...*.........*....................125....578...*...........*......652...... -..........549.............873.........*...=........*...............695.*.....126.........821.....................697.$......806.52....*54... -....792...........-...646*....770.....163.637....941........884.........744..............................#............800................... -.......*.......181............@.............../........92..#...................518...654.......421*995.310....450...............771......... -...+................./48...........968.........269................904.......=...../.....................................266.....*........... -.211....636.................630.17*.....%581........./843.....%..*.......878...............829.....119.33........211.........247............ -.......*......................-...................%..........559..873.............*138.439*....687*..........130....*681.................... -....522.................792........896.........471...480*321...................125..............................*...................291..... -........616.......818.....$..858.............................659*826.....109.....................................10.564=.331...156...+...... -........*.......@...*..29....*...@......546.............907.............*.....965.......217.808.....802..212...............*................ -....607.976..641..852.@...330...158....../.......630........247.......503........$.335+....*.........*..*....618...423&.335...803........... -......=..............................502........#........-..*.....923......664....................421...395.-..................#............ -........*.................625....646..@...99............901.59......*.....*..........517.$747.*....................315..............79...922 -.....289.789..............%......*.........*......................762....388..189.....*........277.........*222...*.................$....... -.................................738....406.....462...........................*.....915..............505/.......61.....+.......202*......646 -..749..............163............................*.....963..........907.......979....................................223..716.....265...... -.......&....741............362.......117.......837..96../.................#..............786.256.....942..=970...983........*............... -......133......*486.725.......*....../...............%................930.310...................*733.-.............$.....198.........189.... -....................*........256........68.......267...873........418*.....................573.................................219..*....... -......+.....439..525..187........495..............*...=.......923..........327..988..300........447*59..702../..840......40.....*........... -......731....*........*..........*..............547.......453.....6.$.........*.......*................-....447....@.......*.737............ -.907#.......375........195.....707..17.................9..........%..119...147..594.22.......81.........................485......446........ -.....................................*....#............*.....62...................*...........*....569...935.868....-...............*528.... -...#..........209........229.......787.470..............403........892.........816.....923..811...$.........*......104.907.849....*......... -..154.346.....*...361.........................10/...237................-................*.............600..............*.......998.606...... -.........%...216..*.......*.........*368.869.........#................6..98...........53.............*.....850@...102...751................. -....550............727...383.....818.....*...913.............879...........*.....420.....150.........708.................................... -705*.......@688.......................289.....*.........................431........*...+....*50.....................698...668*144........... -..................501..70.520....$32......562..458....170......279$............504......883............/...44........*...................... -..450..107@........*..................586*...........*.........................*....510............788.274............589...-26......&...... -...................342.........&.551+.................302...............286.....931....&....-649..$.............575................185...199 -............602..............470.........243*......@............818.690*.......................................*....863..793*............... -......934.....*......200.936.....46..........137.72.........377*......................443*372........498....320..#...........553......598... -........-...451./952..*...*....*.......................804..............305......700............675...&.........611......................... -......................393.......708....957........*697......808.....138*.........%......186....*....%...162*...........624........244.%..... -.....220*.........872......*...........*.........7.........................................=..6....391......562...880.....*......#....120... -...+.....608.........*...74.568........193.........379.........$682......933.927&.....&............................./..984.................. -93..553........*768.739...........421.........880.....*....737.............*.........69..................................................... -.........334...............................40*........910.................................+465..682.............141*.......248..80.......... -.........=..................323...172.............506..............503........568....785+.......%.......940*734.......#573....*...*.....130. -...163@........%17..42..108*.......*...$......700..*..81...../...............+....%.............................#285.........499.523....*... -.............-........*..........305.706.....*....942.....843........*.............378.861.......573.859.173............522............544.. -..........974.......517.756..762.............480.....................289................*...........*......*.228%..........*......628....... -....567........&274......+..../..........................................926.............391............214.............270...230..-........ -...........=...............52...../......155*150.......180&..*......482..&...884................-125...........................@............ -..........332..................318............................123......%......*...............=........................310.................. -....................856.154........@............161....192..................=..387.............384..*827................*..&400......588.... -.......283.............*....@.......12.....309...*...$...........643.......885..........862................210.......449.................... -.......*......937.........98.....&........*....560....884.......$.................866#.../.............622..*..901.............462.......... -.....279............273......896..17.661..880...............138...632......66...%.............93......*....349...*........./......=......... -..............430....*....+.....*.....*............350...............*..........226.......621*......312........=..266....574..111........... -..339........../.....770.451....122........990.....................811...780........*448.................325.249...............+...$...441.. -......................................$......%...........793..............@..787.766....................................64..+......252.*.... -.........556........../.....256/...267...336.....897..........524*417.........................950...930$.452........164......713.......592.. -....759....*...........672.................-.868....*....613......................401.....742..*..............560........=.........939...... -.....$...780.......195......578...............*...%...+....*.....=.....&.............*......#...645...636.797..........652...........*...... -......................*......................77...97.988.821...882...977.......127.609.914...............*.................................. -..........+...195&.....930.....872.......................................79..............&.....14...................-.......150..274........ -..........473................9*.............951&................./...827*.............46......-...13....751.........640.......*.....*504.... -898................-.............56*....378..............291..310..........58............937.....$.......*.../.............840..714......... -............-321.128.157............549..-....130....478*.........*.....................................123...164..............*....631..... -..516..989@..........*.........*670............................204..577.......&817....@514........790...............816.........148.*....... -.....*................233...........*838.....*951.....-954..........$.......&.................110.........99...........*..@187.......671.467 -224...205.....552................823......343................490*...........377..................*.......$...........779.......408.......... -............./..../.....................................166*..........120...........452.........148...=.......................*............. -.562..............768.........#.267.29...806*......476......214.........*....*......*...............867.211....248.$870....@...829...*...... -...*..826@...................1.....*.........251....+.....#...........211.893.403....702.......44.......*........+..........75......977..... -..368.........861$......867....=.......................834.....................................=.........507................................ -.......721*............*.......912.#497....................87-.....231...894.......968..........................659$.......@..........564... -...........690.......432....@..................332................*.........*756..*................302..214*.........803..855............... -..................26.......943...........633...*.....299.150....639.................796.....440.............428......+...........538.647.... -........31........*............................260.....-................=..261.............*............................644.303..%.....-.... -227..........#.161....*....&.....305...............345........328....639...*........$.......802....612.185................%../.............. -.......683.953.....224....58.....*.................*....799...............944.964....245.............*.%................@......28.19.242.97. -....93*........../.............908.........$249..480.......*......978..............................58........=209......373.802*.........*... -467...........201..........932.....997......................548................/.....-904.....796.....3+............................915..... -...................#......@.......*......748*965.................922......451..169..............$.945....372#..979........%..436...*........ -........&.....880&..789........14.805..............571....222/.....*.70......*........./958..........%.........&.../....61.....*...73....... -.......280.................................=.861......-.........144...........950................%.......907......910.......396............. -.....+.........592*149.820*511...........298....&.......*264..........-..527..............-.....679.......*...............@......50*270..... -...901......=....................@483.............$..936......625%...619....%..........748...............785...860......26..181.........747. -.........85..640...#........=.=.......49.......216.............................268*.............................#...........#.....53....*... -...........+.......744...933...766....*.................%...............*714.......909................................999...........*...311. -.............783....................947.................352...765..............897.....+430..869.................121.%............236....... -...45....*......*..752......617..................332...........*...236...........*..........*....@.528..........&......530.................. -..../.134.713.871..*.............*...........#.....%.930...........*....323....377........678.544..*........542.........$.......470.629*786. -..................259...&.....959.225......177.......*.....912*..........$.........................306..996.*....*.........*681...*......... -..........250*768......598.........................850.........598..............3*.........904*648........=.372...197...410......152...=.... -............................................507@.......960..............362.164...131...................................................115. -.....746.......117..678=........952...303*.......+......................./..*...........$636../...597......37................351...=........ -.......*.281...@...................*......337.258..814...687.....#922.=....772..611.153.......573....*.......*..............*.......518..... -....144.....*.......396...........240................+......*.........45.......+.......*...........479.&293..126.....784-...783............. -...........843...@....*..918*.............................986.....542...................117.....................................578.707..... -..984.............251........258....597$.650.........................*..................................928.409.684...547.......*....%...... -....&..489....931...........................$....356........................489..............302...............*............./...259.../996. -......./........*.................................*......385........63*911...*.........%........*578...633.175.........@804..421............ -..98...........188..........226....+...............909....*...................535.....798................$....*.796......................... -....*.....%...................+....531...563...........426......617*202.........................929-.......439....%..332.....+.23&.347...... -...364..149..............425............*.....662.481.......................788..$844..................506..........@.....693......&........ -..........................*....408...772....+.......-.......232*......*......*.............#.+294.....*.....706................435.......... -......566*972........631=.425.*...........14............984.....667..7.236....195..9.....222........757......*.....865..604&..*....344.&.... -.................439..........710..............477*714..............................*544........368............395*...........435...*..204.. -..........229......+..596.179........../................165.542*47........147..............653..*...................466...........119....... -.....690...@............@.......467..626........&......*.................*....=42.....724....+.816....262*.....237.@....549.383............. -......*.........750..............*..............202....967.914......279..................*........./......147.@...............*........480.. -...444.......84...#....+..........527......*351..............*......*................225..888.......806.............7......#...518.....*.... -.............*........628...............749......*976.200.....852..354...23....=........*...............................138............833.. -..........964.................................211...............................578.....986.............879......59......................... diff --git a/examples/aoc2023/day03/part1.jou b/examples/aoc2023/day03/part1.jou index 66833f3a..84494615 100644 --- a/examples/aoc2023/day03/part1.jou +++ b/examples/aoc2023/day03/part1.jou @@ -4,14 +4,14 @@ import "stdlib/mem.jou" import "stdlib/str.jou" -def read_input() -> byte*: +def read_file(filename: byte*) -> byte*: huge = 1000*1000 result: byte* = malloc(huge) assert result != NULL memset(result, 0, huge) - f = fopen("input.txt", "r") + f = fopen(filename, "r") assert f != NULL fread(result, 1, huge, f) fclose(f) @@ -52,7 +52,7 @@ def is_part_number(input: byte*, start: byte*, end: byte*) -> bool: def main() -> int: - input = read_input() + input = read_file("sampleinput.txt") sum = 0 for start = input; *start != '\0'; start++: @@ -65,5 +65,5 @@ def main() -> int: start = end # skip rest of number free(input) - printf("%d\n", sum) # Output: 556057 + printf("%d\n", sum) # Output: 4361 return 0 diff --git a/examples/aoc2023/day03/part2.jou b/examples/aoc2023/day03/part2.jou index 4aa14df7..aeb8649f 100644 --- a/examples/aoc2023/day03/part2.jou +++ b/examples/aoc2023/day03/part2.jou @@ -4,14 +4,14 @@ import "stdlib/mem.jou" import "stdlib/str.jou" -def read_input() -> byte*: +def read_file(filename: byte*) -> byte*: huge = 1000*1000 result: byte* = malloc(huge) assert result != NULL memset(result, 0, huge) - f = fopen("input.txt", "r") + f = fopen(filename, "r") assert f != NULL fread(result, 1, huge, f) fclose(f) @@ -67,7 +67,7 @@ def find_adjacent_numbers(input: byte*, p: byte*) -> int[10]: def main() -> int: - input = read_input() + input = read_file("sampleinput.txt") sum = 0 for p = input; *p != '\0'; p++: @@ -80,5 +80,5 @@ def main() -> int: sum += adjacent[0] * adjacent[1] free(input) - printf("%d\n", sum) # Output: 82824352 + printf("%d\n", sum) # Output: 467835 return 0 From f13be7ed9a1346133e3d486c8f9ebc3bfb343004 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 12:54:55 +0200 Subject: [PATCH 6/9] simplify runtests.sh --- runtests.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/runtests.sh b/runtests.sh index f5a30cd3..9f6e010f 100755 --- a/runtests.sh +++ b/runtests.sh @@ -140,21 +140,17 @@ function run_test() local correct_exit_code="$2" local counter="$3" - local dir=. + local command if [[ "$joufile" =~ ^examples/aoc ]]; then - dir=$(dirname $joufile) - joufile=$(basename $joufile) + # AoC files use fopen("sampleinput.txt", "r") + command="cd $(dirname $joufile) && $(printf "$command_template" $(basename $joufile))" + else + command="$(printf "$command_template" $joufile)" fi - local command diffpath - command="$(printf "$command_template" $joufile)" - diffpath=tmp/tests/diff$(printf "%04d" $counter).txt # consistent alphabetical order + local diffpath=tmp/tests/diff$(printf "%04d" $counter).txt # consistent alphabetical order - local command_msg="Command: $command" - if [ $dir != . ]; then - command_msg="$command_msg [in $dir]" - fi - printf "\n\n\x1b[33m*** %s ***\x1b[0m\n\n" "$command_msg" > $diffpath + printf "\n\n\x1b[33m*** %s ***\x1b[0m\n\n" "$command" > $diffpath # Skip tests when: # * the test is supposed to crash, but optimizations are enabled (unpredictable by design) @@ -171,11 +167,9 @@ function run_test() show_run $joufile if diff --text -u --color=always <( - cd $dir generate_expected_output $joufile $correct_exit_code | tr -d '\r' ) <( export PATH="$PWD:$PATH" - cd $dir ulimit -v 500000 2>/dev/null bash -c "$command; echo Exit code: \$?" 2>&1 | post_process_output $joufile | tr -d '\r' ) &>> $diffpath; then From 5e9daa411ed09c704d862d8a5512a2cab64f007b Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 12:57:34 +0200 Subject: [PATCH 7/9] add back forgotten thing --- runtests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtests.sh b/runtests.sh index 9f6e010f..6efa17dc 100755 --- a/runtests.sh +++ b/runtests.sh @@ -150,7 +150,7 @@ function run_test() local diffpath=tmp/tests/diff$(printf "%04d" $counter).txt # consistent alphabetical order - printf "\n\n\x1b[33m*** %s ***\x1b[0m\n\n" "$command" > $diffpath + printf "\n\n\x1b[33m*** Command: %s ***\x1b[0m\n\n" "$command" > $diffpath # Skip tests when: # * the test is supposed to crash, but optimizations are enabled (unpredictable by design) From ad417590a60731904deaf0a2e4adf7ede5af727f Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 13:01:59 +0200 Subject: [PATCH 8/9] ok shellcheck --- runtests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtests.sh b/runtests.sh index 6efa17dc..d434780b 100755 --- a/runtests.sh +++ b/runtests.sh @@ -148,7 +148,8 @@ function run_test() command="$(printf "$command_template" $joufile)" fi - local diffpath=tmp/tests/diff$(printf "%04d" $counter).txt # consistent alphabetical order + local diffpath + diffpath=tmp/tests/diff$(printf "%04d" $counter).txt # consistent alphabetical order printf "\n\n\x1b[33m*** Command: %s ***\x1b[0m\n\n" "$command" > $diffpath From ea7b260c16dfd77c44b9b2d422f1bfd6026622b5 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 3 Dec 2023 13:02:14 +0200 Subject: [PATCH 9/9] Update runtests.sh --- runtests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtests.sh b/runtests.sh index d434780b..5dc94585 100755 --- a/runtests.sh +++ b/runtests.sh @@ -142,7 +142,8 @@ function run_test() local command if [[ "$joufile" =~ ^examples/aoc ]]; then - # AoC files use fopen("sampleinput.txt", "r") + # AoC files use fopen("sampleinput.txt", "r"). + # We don't do this for all files, because I like relative paths in error messages. command="cd $(dirname $joufile) && $(printf "$command_template" $(basename $joufile))" else command="$(printf "$command_template" $joufile)"