Browse Source

gross. lmao

master
Hazel Levine 1 year ago
parent
commit
9b1f45e64d
Signed by: hazel
GPG Key ID: 1884029A28789A62
  1. 200
      data/day8.txt
  2. 80
      day8.rkt

200
data/day8.txt

@ -0,0 +1,200 @@
dcbgefa cebd bfega eadbf db cdfaeb dba bfcgda egadcf aedcf | egadcfb eafcd db debc
dfea ea abe dfgaeb fdcgba badeg dcfbeag dbgaf bcged fcebag | gfadb dfagb fdgabe eagdbf
cd gfcde cdbfage cbdfae edc fedgac gadc feagd febdga gbfec | adbfeg dbfcae facbde gcfde
ecafb abgfc deacbgf fe fbe fgec edgafb cgbafd ebfgca ebcad | cfbae fbcga dfabceg ceabf
eagfcd abfdecg fe fdae egf cfgda gcedb dcgabf bcegaf cegdf | gcfda feg efg cadgbf
gfcdab efadc cadbgfe beca badfce ecfbd edcagf gbdef cfb bc | gdecbfa cbea gedbf aceb
cgafb abgcde debfca ecafgd ecdag bcd dacbgfe gebd db cabgd | cfdaeg dcfeag cbgda agfcb
cegba dg gbd feabgd fdecgb gbced fdbcae dfcg fbced gdceafb | gfecdab dbg dg fdceabg
cebgdaf gbfaec cebg fbcag bac efagb cgdaf fcbade fgadeb cb | abcgf fdeabg dbafge cadgf
aefdg ga becfagd dag gfdbe bgeacd dgaefb caefd cfebdg bafg | gda afegdb afdce efacd
dfacgb afegc cbfgae dceg gcafbde dfabe gadef gd cfegda adg | bcafeg efadb efbda cgefa
gbfae cbgf ceg dgefba cafde bcagde dbfaegc gefca egcfba cg | abefg agfbe cafgeb fgeadbc
cabef ecdfbg gceabf facg dbage ecfabd eagbfcd gc gbc eabcg | bfedcg cfbgde acebg bcfadeg
bcedagf abecf cdaebf gacb dgfec gaf gebafc bgfdea ag cefga | egfac dfcbea agf deacbf
febagcd bfgcae fecab abcfde dgbec da fadebg ade adbce dfca | gbefdca aedfgb adebgf cbdge
acb fgadc ebaf efdbgc ab dbgaec caegbfd fdcbe abcedf cfdba | ecdfb bfdcea ebcdga cedfb
cbaeg befda bdagfe gd dga dgbae deacgf fbgdeac dfbg decbfa | gecafd gad ceagb debaf
egd de bfadeg gcfbe gdbcafe bgfeca cedgfb cdagf edgcf bedc | cefgd ecgafb edg ged
aebfgc bgf bcag fceabd gcdef becdafg befac gb fcegb badegf | ebfdga cgba gabecf cfedba
abgdfe gafdc fdb egbdfca cgbaef edba egfba cgefdb bd agdfb | dfb fgdca cgafd fgdba
agfeb dgafb agfecb gfcaed abegc febc ef fea ebfcdga bedagc | ebcadg eaf bafge gcaeb
ba febcag gfbec fcab bgfecd dgeaf eacbdg fagedcb efgab abg | egfdbc geabcd cegbf ecfbgd
fage egacd cdagb dcefag gcedfb efgcd cedgfba fdcbea dae ea | ae aed gfedbc faeg
gefac cbe cb fgacdeb bceadg agfebc fedgca abfc egcfb ebdfg | egbfc fbdeg aefdcg gcbfe
agbfce edbga agfde cfage afcged bgfcde bcagedf cdaf fdg df | bdcegaf dgefa eadgb fcgdae
acebg ce bcadg gcedfb ebc bfeag degfba acfe bacdgef baefgc | aebdfg abgfe abecgf cgabd
bgafd dgbae dbcfae acfegd bcfg cgafd fdbgca fb dcbgafe bfa | afdbg baf bfgc bf
daebcf fcdgbe egfab gaedb da agcdbe dagc adebfcg bda cgbde | gfabe gdecab eabdg cdgbfae
decbga bdac da cgdfe ebacg agbfce cagde fecbagd gda dfegba | da fcedg fcdge dga
dfecba fbc gceab ebfg acdegb bf afdebgc befagc cgdfa bgfac | baecgd gacfbe bf cfagb
bgefca agcbf dfgceab bcedfa ebafg fdgae feb dcgabf gebc be | agbfe be becfga gcbafe
cbgaed gb dgb defcg gdfeb ecafgd dbgfce bcfg facegbd deabf | gdcef adgbec egdfb acgefd
bcead bdecag adbfec gda gabe febgcda ag caedg gabdfc efcdg | ebag ageb cedafb edbca
bg cdbga ebcg adgfeb dagbefc dbg caedg cgfdae acfdb geadbc | cabdf gbce bacdeg dabegf
fecdgab bd gfcade agedf cafbg cagdbe adbgf gbd efbgad efbd | egafdc gfdea bfaedcg gabedc
cfdgbe cgaeb edab gacde ebg be edcagbf edcgaf abfcg adcgbe | gafbc gcbaf adgbec be
geb bdfg abced fdbaeg gdafe gfdecba bg gcedaf bdage ebfgca | cgefda egdbaf gdcfae eagdb
cafbge cfdgb abfce aedfbg cade de beafcgd cdbef dbcfae def | dfbaec cfdbe gcaefb dgbfc
bafce bcage ebcagfd fc decbfa bdcf fdaeb acdegf efc egbadf | aefbd abegc eabdf bfdea
gc dfeacg ebfacdg ebcdfa bdfac gbcda fbcg dafbcg cag bdega | dcabfe cbfg fabdc gcfb
fdaeb agbfe ecadbg efdacgb dbf debac cdaf dgcfbe dacbfe fd | abdfe gfeab fdac dfb
cbfdg adgcb gfebc gedabc bdf df agcfbd dgaf gfdebac ecadbf | fcgbd bgdca adbfgc gfad
bgf aefbg fgdcab ecbfadg eagbc bgedac fbec fgabec fb egadf | bfec afged ebfc gefad
cgafdbe fedgab gafde adbg gebcfd efcag bcdfae fdg fdeba gd | fgabedc dg cegaf cfbaed
bfecagd gcfdb ce fgabed gbeafc ecdbf bce deca acfdeb beadf | bce agfecb gedbaf dfbec
dfb abcfge fdbage acefd cgbd db gefbc bcdfe acdgfbe gbdcfe | fcdbe fdecgb fgcbe fceda
efdac gacbed cafeb fcgd fdaeg cd gebdfa fdbagec ecd dacfeg | edafcg deacgf eadcgb dgfc
degabc egc cegfa gdefa gafbc ce cfed cagedfb aefgdc eafdgb | gdfeab agfcb gebfda fadge
aegbdc dbgfec begac ef fdgca efc gacebf eafgc bafe edcfbga | acfeg bfgeca cef befa
cfegdba bdage bgc faceb cbafge bdefca gdfabc caebg gc gefc | cfbead cg cg eafbc
db bdaegf abd debgfac feacb edafg dfbcga dafeb agdefc debg | eafcb bafed dafgbe edfba
dbegac efdcg ecdgfa geafc fabgdec efcab gfad ag ega dcebfg | defgacb efgcbd dagf fgad
dafbe bdfgae cd cadfe ecfdab bcdefag gface dcfb acd cbegad | efabd dcbf decfbga dbgeaf
ca gfbdc eadcfgb cfgade efac afdeg dcgaeb dgfabe gca gdfac | dacbeg gcefda cfdbg geabfd
fbecag fdaegc gfade edcafgb ecf cfabd ecdfa gcde deafbg ce | ebfcga aecfbg cef abgcfe
eadcbg ecd gdebf fgeac cd dcfb fecdg fdgaecb cdfebg afebgd | gdfec adefbgc febgcd bgfadec
egfdca bfceg cfg cgabfe bfged bcadeg agebdcf cf bacf agbec | defgb cgbfade beagcf fgaceb
ebdga efabgc abcfdeg fe gfabcd dcfag fgaed ceafgd fge cfde | acbefgd agecfd edafg gadfcb
eadgc edagbf fbgd fadbce bg ebg ebdfa cfedabg cbfgea ebgad | aedbg egfdab cedbfa aecbfg
gd cefga cdabfge dgfce afbdgc dacfbe fgdebc cdg cbedf gebd | dg febdcga bedg gd
gedfb bcfgde cbfde cebg egf adbcef edgcaf cgdeabf eg gafbd | gdbef abecfd ge feg
bdacfg cba ab gcdefa cdbeg acgef egcfbda gafebc abfe caegb | cafeg bgcea gface agbec
fcabdge gdceab bdgcf ecfdb cgd cgef gc cfebdg dgfab adbfec | dgc gdcfbe gc fegc
cgbd gefbdc cdfeg gaecdf gfbedac cebdf faecb dbf db gedfab | cbdef bdf ebacgdf ecbfd
fdecbg bagcef beagc dbgfaec edagbc dgafb eafgb efg ef acfe | cgfaeb ceaf dbcgea gfbae
cfdae cefg acf bcaedg aecdg eadbgfc fc dbafe bfadgc defcag | efgc cfa ceadbg cfa
egc bgadef fcbdg cgdfe cdafge ce gadebc begcdfa faedg efca | efadg cdeafg cgfdb faegdb
ed agdbc bedcg cfageb edfb fgbdec ged dfaceg aedcgfb gfceb | de debf agdcb fdgaec
beadgfc bc fabc cbeda dbefa cfbead ecfgbd cbe dgeca ebagfd | dceba edcafb cadgbfe daceb
dgbcef afdbc fgdaeb ef edf edcgb eabcdg gbacfde cefg cfedb | ebfcd gbfedc bafcd ef
fecgb gbcfad aebdgc cgbaf cfedag gbcad afg fa afdb cafedgb | afdcge gdbacf acgdb gcdaeb
abd cfeadbg agedbf ba fdaeb fbga fcdae dabgce fcebdg edfbg | dfegcb dcebgf befdcg bfade
gbacfed gdbce gdaec fcedag eb cgfdb adbe ecb eadgcb fegcba | acebdg egbfac dcafge fbdgc
fbea fa acgbdf bdcgfe deacg daf fbged ceagbfd fgade gedfab | bcgfaed af af dfa
fedbgc dfgea gbdefa bagd egacbdf bceaf aegbf gb ecdgaf bgf | bg caedfg aefgdbc bfg
dabcgfe dbfce cgeda adcbe bgaced eab gadb fdgcea ba bcefga | cdbae ba cfaedg cdaeg
bed bagedc agebd feagcd edcga bdac bgfaedc fbega gebdfc db | debcfg cagbde egadc dceag
afgcb agef badcf ebfagc befcgd gfb fg fdagbec gbcea gecbda | gdcfeb bdfceg cdfba cegfdb
cdbegf abgfedc geabcf dgefa fc cagdbe cfe fagce cfab gabce | cfba acfb cf bagfedc
ecbga abedgc fce gbacfe aecdgbf afcb eagcf cgefdb fc adefg | afdeg dcfabeg bfca gdacbef
cedfg gaedb befcadg gaced cadfeg cabdfg ac adc befdcg ecfa | egbad cafgbd egfdcb dgecf
agbc cegda bdecfa edgfb gdbace adb ab bgfdace gcdefa ebdag | abedg ba gbdae geacd
cefbg gaed gadfb gfabdce egfdb edagbf ed dgbacf deb dfebca | ebd cefadgb ecfbgad bdacfg
ea adbfc defcgba eafb dgfbac edacbf fdcge ace fadec aedgbc | ea cfdea bagdce fdegc
cedfg cea dfabecg efgcab fcgea agbfcd feab facbg ae gadebc | bafgcd ea cdbeag gcafb
bgcd cb dfbac dcagefb gdcfab acefgb cbf acgfd adfegc bfaed | cbfgad fgacd cfdba gcbd
gebcfda dabcg bgdaef dgc cg gfbad eacdb fgbc cgfdba gfadce | agdfb befdag gcd dbagf
cbedgf fcg degacf agcdbe dbcaf gbdec dgbcf bgef fg fbadegc | gadefc adcbf acdbf fbcda
egadf agf dcga cbfedg ceafgb ga cdfaeg dafbe bacfedg ecgfd | feadbcg gcad agf fbead
agcbfd cdbge afecdg adfe gafce agd facgedb da cdega feagbc | faegbc gdcbfea cegfa cbfeag
egc bfcdea gbfe afcgeb ge aebcf adgcf adgcfeb dabgce agecf | cgabde cegaf fcaeg gfceba
bceda bea fdgcae eb eafcgbd egadc fcageb dbacge bdeg bcafd | bcfad edacb cgefda bgfaec
fgabd bdgefa cagdf gfb fbaceg efdb cbagde fb afgedcb edagb | gdfca gadeb agfdc ecdbga
ab gafdbc ceafg dgaecfb feagcb efcdag dbefg caeb baf efgba | abf abf agecbf fedgb
gbdface gbadce gaedc cfagbd cbdga eda ed gcfae bgfead decb | cbed fbdcage dbgac acbegd
fcda ecgbdf df abefd ceafbd cfageb dageb cabef dfe edacgfb | gedba eabgfc fd acgbef
dg egbafc fdbaecg decg fedab agcfdb cbgea cegadb egdba bdg | dg gaebc cdeg gedab
fcbd db adfgc fdbgca gaefb bcfadge dfgab bda dcebag gacfed | geadfc bd adb bfagdce
ecdgb beagc gbcedaf dcbgfe bgfadc faebc ag acgdbe egda cga | gceab eadg gaed dacgbf
degcbfa febdgc egca cgd dbcga gaefdb bdgae cabdf cg dbeacg | dcbgef deagbc baegcd acgdb
fbc gfdeba gbefca deafb decbaf agdcf cb cfdab edbc dcegafb | abgfed dfbca bcdfea dabfe
de gdefacb becdag begac eabfgc ebdc edg aedfbg cfagd caged | bcgfea deagcb bced cbed
bafc gbafed gfb fgaebc fb aegcf fcbaged afecgd befcg cbegd | gfaec fbagce agfedb cgebaf
edcgab dgfb dagef bcfgae fg eabdfg defca degba efg cgdbafe | bdage gdbea bfgcdea aegfdb
ceafg fca fcabge cgedf dbfacg af fgbcade cedgab abceg feab | eacgf fbcgda fca fdcgabe
gfacd gcbd afdbgc bafecg bc eabdf abc acdefg aegfcdb bfdca | bafcegd facbd bca cdgb
bdafge edfgcb cdf becf fgbdca efdgb egacd fc ecgdabf degfc | egabdf dbefga cafbedg fgcdeb
bd bcfagde fadb efbdc cedfab aecdgb eadfc bdc cgfbe gfdcae | dfab cbfeg bd efdca
cf gcfdab bgfadce cadegb adecgf fcd eacf eagdc fgedc fbged | gedbacf ecgad dfabgce degac
afbceg fge fe becga cfae febgdca fdgab fcbgde bcaegd baegf | baegf ef degcfb eacbg
gae cfgadbe feagc adgf adfbce fdcgea ga beagdc feadc gcebf | adfg eag edfca ga
ecdb cd cfadbe febadg agecbdf dfbae cfabg dcf afdbc aefdgc | dabfce adfbce cebd cdf
dcebaf ebdac ged bdag bfceg bdeagc bcdge ebdcagf dg gcfade | bdga fcegb gfcaedb gbedc
fcdeagb cgbd cgf abdfge cdfagb afbdg bafce bgcfa defcag cg | cgf cfdgea fdagce gfabc
becdgf gd bgfdca gfd dabcef gefca adbg facebdg afdgc bcdaf | acbdef dfacg dgf edgabcf
fbaegcd egcfa faebc cdabf efdb fabcgd cbe daecgb bcadfe eb | eb fgadcb dabfc dgceba
decafb cabfd fg ebcdfg facgd dagec fgba fbcedag gcf gacbdf | cadbf gedfcba fbacd cabfd
dgface dfabe dfaeg fg gdbeca fge gcdea gfceabd fcga efbgcd | becdga bcagde fagdec afcg
ceadb gdefbc cegdbaf adc bfdea cebdag acgb ca gcafed cbdeg | dac bcedag cbeda cabg
fdb dcgfaeb bgadef fbcdg bdce afcbg bd gfeadc dfgec fdgecb | bcagf bdaecfg ecfgadb bfd
gdefa bg egcafdb egbafd dbfegc afgb ecfgda abedc dbg dabeg | fdegbc eadgf afdeg gb
bfcad bag gbec agedc agfdceb gb fdagbe begdac gefacd gbcda | acfbd gba dcbag abcdf
aeg bdcega ge fgcda bdcae afegbd ecdga ecabdf egbc dbeagfc | ecabd edcbga agbfdec afdbeg
fgdce deca agfedc bdfeagc bdcfag eagfb dga cgdfeb adfge ad | gacedf agbfe aegdf fcegda
bafg ecfbag cabfe cadfeg fedcb eabcgd cagfebd agebc af fae | aegdbc afgedc feacb fa
bcgdfe cabg cfaedb gc cfg efbdagc fagdc eagdf fcadb dbagfc | cfgdeba efcgbd bcadf dgeaf
feadcbg egfba fg begfdc gafd debfa geabc bfaegd gfb ecbfad | cbagedf ecdbfag dfebcg gf
ea gbdeca egbdc bdcea aebg cbadf fdeacg cedgfb cedfgba aec | ceabd gbdaec ebag fadecg
bedca dcbaef dfcb feb baecdg gbacfde afegc bf ebfac ebfadg | ebdca gcdbea fbe geacf
bafgcd dcb cgead dcgbef afcbg db adcgebf bdfa gbecfa bcadg | gcbadfe agbdc gbafc bcd
cg cga edcfab ceadbg acdgfe gfcd gafce eafcd egfab dfbgeac | efagc bfeagdc fdebac aedbfc
ebg dafeb cdabg agdcbe geafdcb agec gfdbce bgdfac eg gebda | ebgad ge bceadg dbfea
cfdeg acebdg abcfdg befdg bgf beadg fcbgade fabged abef fb | decgf bfae fcdge fgdeba
gdfeab feadc abgc ebgdcf dcgbaf acfdb ba bafcdeg gdbcf bfa | cbdfa fbegda gadebf afdec
bfecdg dbf fgbce gdefba dbec gbfeac db cgdaf gbdcf agfdbec | febcg gcbdf eafdgb bfgec
caebg gdcfa fedcabg dce dafe cfbdag de egdac fgbced gecadf | fcgebda cgfad edc gbdcefa
edcgab dcfeabg dfbga afbdcg bdfe egfab deafbg egb eb feagc | badfeg bcgead eb abfdg
bc geacbf gebca bdgafe fbceda bce dfacegb degca cbgf abgef | bgacedf bcega gafdeb cgabe
gfdcaeb ceagf cgf dcag efcbdg ecadf cg efbag gdfaec bdfaec | eafgc cafeg gc dgcbfe
fdgcab bdgfc dcfgeab daefgc fgbdea bfgec gdb db cbad fadcg | gdb bgd dfcag bgaecdf
ebca fagedc cb bcefgd cefda acbfd deacfb bcf bafdg ecgfabd | cagedf fadec fdcae fdeca
dgacef deacb dac afgdecb fdcaeb dabeg acbf bedcgf ca debfc | bedag fgdcea acdbe bgead
bdcaef cdegfa egfdba cfd bfec egfbacd cfdba fc cgabd bafed | daebf bdacg cbfdgea bcdfa
ac cab ebgfa fcedb cbedgf dbcfea gbdfeca ecafb fcda gedbac | baefg ca ca bdcfe
afcbge fedbca fagebdc abdce dacegb aefd fcdbg fa cfa cabdf | af af beagfc abecd
edacg afdgce fcagedb degcb deb db faegbd abdgce bacd gfbec | egcdb dabc dabcge edb
cgdab efabdgc bae bacefg efgbc fcea fbcdeg bgeac ea aebfgd | ae cbgae dbfeag fcegb
acfed eg dgae fbceda gce dgface ebafgc fgdcb cedgf fdgcbea | fbcdg fdcaeb caegdfb cgabfe
dcgab cae ae eabgc gedfca defcgb fedacbg efbgc bfea eacgbf | cgdab ebaf bdcgfe eac
gafbced ceadfg gabfc ae cgbfae febcd cefba cfgadb bgea ace | fbdce eca bgafc afgdcb
bgd edfab acgfbd dg gdac dbfga bcgfa gdbcafe bdcefg ebfgca | abedf dafgb abgfce fagbec
adbegf bgace gdfae afc fbcaed gcdf cf faecgdb gaefc cdaefg | cfa ceafg abdcfe agefdb
fdgcb adg cbefdg cbfadg adgcb dcfage ga cgbfdea bfag aedbc | gdfcea fecdgb acbgd bgdfc
febgdc gb fbecd fbg cgeabf agfed bdfeg bedcaf fcgdaeb gdcb | febgd cfabed cedbf bdfge
dbgcf dfg dgcafb bdcag df efdacg dcabeg facegdb adfb gbfce | fgcdb dcfgb agbdcef gbcef
abfdcg gbfea ceabgdf gedcbf ec bec cgfdb bgfce ecdf acgebd | cagdfb ebc dfgceb ce
bdafc fbaeg dcagfb cgdb adg dg daefbc bdgaf dacfebg efadcg | dbgc bcfad aegfb adbcf
cdagfe cdegb dbe defcg gabec gfdcbae bd efbdgc bcadfe dbfg | eacfgd db db dbe
fbcegd bdfgc cf gbecafd gdcba fbc fgdeb cdef gadbfe acbefg | gdbfe gadfeb dbgfc bdfgec
abcegf cbfad eb fabcedg efabc ceb gfbe degafc gfeac abgced | agbcde ceb gfbe beacf
fgdc gbf fgcbda cefbga facdb gadbe gf bafdec gbdfa aebgfcd | fbg gdcbaf efcbad fgaecbd
ecadbf dcfbga bcdgeaf afgc adgcb bcf fbgde cf dgbaec cbfdg | eafbcd cf abcdgf dfebg
beafg edfgba fbacgd fcbeg ebcagd bdagf ea bae efad cgbfdea | afebcgd cfgbad efcbg bgdeaf
faegcb gefdb gdefcb dfcga dbfga fgadcbe ba bfeadg adeb abf | bfagd fgbedc ebfdg gfcdbae
adebc gacdeb gba aegbd cgefba ebfgdac acfdeb agdc ga bfdeg | ecadb dbefg fbgcae gcdafeb
gf dfbgec cdbef dgfb gcebdaf efbgc aefdcg bdaecf gef caebg | cdafgbe gfe cgbfade fbcge
cba ebfga ac agbdfec becgd cabdeg fdebgc daec gfbdac bagec | ca ebgcd ecbdgf fgdbce
gcafeb dbceg edga bcgdaef de bcfaed ced abecgd becga dcbgf | agbcfe aedg ed aegbcf
cbeg bcafg bgdaf ecgfba agc beafc ceagdbf cdegfa cg dfecab | gebc debcagf cg gc
dbaecgf gacbf gce bcedag bcgef dfceb ge efbdac degf dcfgbe | ecg defg ecfgb bfecd
ga gfceab bgdeafc acdbf bgcfe cbedga fgae bafcg fecbgd gba | acgfb ebadcg fcbad bcagf
cadb edbagf gdcbfa dgc cdfga adfbceg fagbd fgeca dcbegf cd | gbfedc cdebfag debfcg fagbd
fbcgea bacgedf gbce cdfagb eba be gbcfa egdabf cbafe acefd | eacbfg abe cegfba ecgb
bfcag gdba ba adfegbc eafbdc bfcdg ecagf bac fbgcad gcdfbe | bgadcf ebgcfd acb gbfced
ced geabcd dcaebgf fgaecb begac cadb cd cgdefa bdgec dfbeg | beacdg bdaceg fgcaedb cbeagd
gdacfb bfdgc gfaec ebfdcag fegbc cfgedb acdfeb gedb be cbe | bgfec be gbed egcaf
efcda abf gfdaeb gedcbfa abcdg bf bcdfa cfeb eagfdc caefbd | gabdc fecdag bgdfeca bdegaf
efcab gefcadb dcbge cagebd gfdb feacgd efd bdcefg df befdc | fbdce acfeb cdebg fd
gafbecd dacg efgbd dcfge ecdaf gcf cedfag febcga cg dbcefa | fdaebc gc afgceb gecfba
ebgcd fgba dbcgaf cgbad gac gdbceaf cfdba cgaedf afdceb ag | abgdfec cegdb cag fbag
ecbgf efac bgade bacedgf begca agbcef gbfedc agc fcabdg ac | aefc fbcadg afbcgd dgcaefb
fab cafgbe face acgbedf eagbc bdgafe egcabd fbgca gdbcf fa | cfbgdea acbge cagbe fcea
fedac ec gced bacgfe acdbf begadf gedbfac cae fdaeg cgdaef | dfcgea dafge aefgdb fadge
gbcade fe afbgc cedfga bdfe gbfae fae fdbega dgbae cdbagef | egabf aef abgef efbd
fagebc fad dcfab acdbfge ceabf egadbf edfc dbafec fd gdbca | bafec dbgafe fd eafcb
afg ecdbag fcage dbgefa abefc gfdc fgcbdae fg fdecga gdeca | deacg fagdce cefag edfgca
badfc gcfdea db fedcgb abde bcd fdecgab deafc facedb fgabc | fbcgde abgcf gabfc aedgcf
bdaefc daecb gfcad aebg edgbac gbfcde bg cbadfeg gcb dbcga | bega cfabed cedba bgae
afdbec ge aeg cdagb egfb cebadfg egbda agfdeb facdge efbad | fdbeac agbdc ega cagdb
cfe eagfd bacfg egdfba edac gefca gecdafb eacdgf egcdfb ce | cfgbde fbgca efdbga daec
abfcg bdcegaf ecbfg bafecd gcda dfcab cagfbd edgabf ga gab | dacg gacd gacd bfgca
egbac ec cbdgfa ceb agdcb bagedc cdbaefg gbaef fcbade decg | dfacbg bafge ce efbag
bd bdafce gcdfe fdcbg bfgca dfbceg dbf gecfda dgbcfea gdbe | edfcg fcdge fbcgde gcedf
eafcbdg eagbc gcaebd cfegab dfeca bgfedc cfb befac bfga bf | bgdace bacfe fb feagbc
bgedfc bgafedc adc bafec gcdeba egbcd dbeca gcafbd gead da | gdefcb gecdab cbfged gcbde
bgec eb fbgea aeb ecagf dabgf cdfage bfdcae cebgdfa fabceg | cgadef begacf afgbe egcfdab
fe fdecabg ebcfa bgcaf ebcgfa aebdc begf fcedga fdcbag aef | bacde fae fegb efa
gdefbac dgfecb afdg gcfbad gcd ecabg gd afcdb bfdcea gdcab | acdgb dg dcg dafg
bcaefd aceb dagecf ea cgebafd eda ebgdf faedb dbafc bgdcaf | facbdg aecb aebc gdefb
cafdeg egcfb ge afedcb egba acgfbe cebadfg gbfdc baefc egc | ebga ge ecg aecfb

80
day8.rkt

@ -0,0 +1,80 @@
#lang racket
(require "lib/common.rkt"
fancy-app)
(struct segment (signal-pattern output) #:transparent)
(define (parse lines)
(for/list ([line (in-list lines)])
(match-define `(,pat ,out) (string-split line "|"))
(segment (map (compose (apply set _) string->list)
(string-split pat))
(map (compose (apply set _) string->list)
(string-split out)))))
(define ((determine-digit patterns) seg)
(define (with-length len)
(for/list ([pattern (in-list patterns)]
#:when (= (set-count pattern) len))
pattern))
(define one (first (with-length 2)))
(define four (first (with-length 4)))
(define seven (first (with-length 3)))
(define eight (first (with-length 7)))
; fives are 2, 3, 5
; 2 intersect 3 intersect 5 = adg
(define adg (apply set-intersect (with-length 5)))
; adg union 1 = 3
(define three (set-union adg one))
; adg union 4 = 9
(define nine (set-union adg four))
; sixes are 0, 6, 9
; 6 intersect 9 intersect 0 = agf
(define agf (apply set-intersect (with-length 6)))
; f = agf minus adg
(define f (set-subtract agf adg))
; agf union adg = adgf, adgf union 4 = abcdgf, e = 8 minus abcdgf
(define e (set-subtract eight (set-union agf adg four)))
; two = three minus f union e
(define two (set-union (set-subtract three f) e))
; cf = 4 intersect 7, c = cf minus f
(define c (set-subtract (set-intersect four seven) f))
; six = 8 minus c
(define six (set-subtract eight c))
; five = 8 minus c minus e
(define five (set-subtract eight c e))
; zero = 8 minus adg union agf
(define zero (set-union (set-subtract eight adg) agf))
(cond [(set=? seg zero) #\0]
[(set=? seg one) #\1]
[(set=? seg two) #\2]
[(set=? seg three) #\3]
[(set=? seg four) #\4]
[(set=? seg five) #\5]
[(set=? seg six) #\6]
[(set=? seg seven) #\7]
[(set=? seg eight) #\8]
[(set=? seg nine) #\9]))
(define (day8a segs)
(for*/sum ([seg (in-list segs)]
[out (in-list (segment-output seg))]
#:when (or (= (set-count out) 2)
(= (set-count out) 3)
(= (set-count out) 4)
(= (set-count out) 7)))
1))
(define (day8b segs)
(for/sum ([seg (in-list segs)])
(match-define (segment pats outs) seg)
(string->number (apply string (map (determine-digit pats) outs)))))
(module+ main
(call-with-input-file "data/day8.txt"
(λ (prt)
(define segs (parse (port->lines prt)))
(answer 8 1 (day8a segs))
(answer 8 2 (day8b segs)))))
Loading…
Cancel
Save