From 433d8b4e15ac5afb2687e19e6d8ce2a48474badf Mon Sep 17 00:00:00 2001 From: Max Nuding Date: Wed, 8 Dec 2021 21:22:44 +0100 Subject: [PATCH] 08 --- Package.resolved | 16 ++ Package.swift | 15 +- Sources/02/02.swift | 2 +- Sources/08/08.swift | 89 +++++++++ Sources/08/main.swift | 12 ++ Sources/Runner/Resources/input/08.txt | 200 +++++++++++++++++++++ Sources/Runner/Resources/input/08_test.txt | 10 ++ 7 files changed, 339 insertions(+), 5 deletions(-) create mode 100644 Package.resolved create mode 100644 Sources/08/08.swift create mode 100644 Sources/08/main.swift create mode 100644 Sources/Runner/Resources/input/08.txt create mode 100644 Sources/Runner/Resources/input/08_test.txt diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..e56059c --- /dev/null +++ b/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "swift-collections", + "repositoryURL": "https://github.com/apple/swift-collections.git", + "state": { + "branch": null, + "revision": "48254824bb4248676bf7ce56014ff57b142b77eb", + "version": "1.0.2" + } + } + ] + }, + "version": 1 +} diff --git a/Package.swift b/Package.swift index 11e7524..d95acbc 100644 --- a/Package.swift +++ b/Package.swift @@ -16,15 +16,16 @@ let package = Package( .executable(name: "04", targets: ["04"]), .executable(name: "05", targets: ["05"]), .executable(name: "06", targets: ["06"]), - .executable(name: "07", targets: ["07"]) + .executable(name: "07", targets: ["07"]), + .executable(name: "08", targets: ["08"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - /*.package( + .package( url: "https://github.com/apple/swift-collections.git", .upToNextMajor(from: "1.0.0") - )*/ + ) ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -56,7 +57,6 @@ let package = Package( .executableTarget( name: "05", dependencies: [ - //.product(name: "Collections", package: "swift-collections") .targetItem(name: "Runner", condition: nil) ], resources: [] @@ -68,6 +68,13 @@ let package = Package( .executableTarget( name: "07", dependencies: [.targetItem(name: "Runner", condition: nil)] + ), + .executableTarget( + name: "08", + dependencies: [ + .product(name: "Collections", package: "swift-collections"), + .targetItem(name: "Runner", condition: nil) + ] ) ] ) diff --git a/Sources/02/02.swift b/Sources/02/02.swift index 2e81442..e7dfe76 100644 --- a/Sources/02/02.swift +++ b/Sources/02/02.swift @@ -6,7 +6,7 @@ // import Foundation -import Runnerer +import Runner enum Direction: String { case forward diff --git a/Sources/08/08.swift b/Sources/08/08.swift new file mode 100644 index 0000000..0a48114 --- /dev/null +++ b/Sources/08/08.swift @@ -0,0 +1,89 @@ +// +// File.swift +// +// +// Created by Max Nuding on 05.12.21. +// + +import Foundation +import Runner +import Collections + +struct Day08: Runnable { + let inputPath: String + + func run() { + let input = try! String(contentsOfFile: inputPath) + let entries = input + .trimmingCharacters(in: .newlines) + .components(separatedBy: .newlines) + .map { $0.components(separatedBy: " | ") } + let lines = entries.reduce(into: [String:String](), { $0[$1.first!] = $1[1] }) + runA(lines: lines) + print(lines.map { runB(line: $0) }.reduce(0, +)) + } + + func runA(lines: [String : String]) { + let outputSignals = lines.values + .flatMap { $0.components(separatedBy: .whitespaces) } + let uniqueOutputSignals = outputSignals + .filter { $0.count == 2 || $0.count == 3 || $0.count == 4 || $0.count == 7 } + .count + print(uniqueOutputSignals) + } + + func runB(line: Dictionary.Element) -> Int { + let uniqueInputSignalDict = line.key + .components(separatedBy: .whitespaces) + .reduce(into: [Int:String](), { + switch $1.count { + case 2: + $0[1] = $1 + case 3: + $0[7] = $1 + case 4: + $0[4] = $1 + case 7: + $0[8] = $1 + default: + break + } + }) + let outputSignals = line.value.components(separatedBy: .whitespaces) + let len = Double(outputSignals.count - 1) + return outputSignals.enumerated() + .map { Int(pow(10.0, len - Double($0.offset))) * guessDigit(inputSignals: uniqueInputSignalDict, outputSignal: $0.element)! } + .reduce(0, +) + + } + + func guessDigit(inputSignals: [Int:String], outputSignal: String) -> Int? { + switch outputSignal.count { + case 2: + return 1 + case 3: + return 7 + case 4: + return 4 + case 5: + if inputSignals[1]!.allSatisfy({ outputSignal.contains($0) }) { + return 3 + } + let isTwo = inputSignals[8]! + .filter { !inputSignals[4]!.contains($0) } + .allSatisfy { outputSignal.contains($0) } + return isTwo ? 2 : 5 + case 6: + if inputSignals[4]!.allSatisfy({ outputSignal.contains($0) }) { + return 9 + } + let isZero = inputSignals[7]!.allSatisfy { outputSignal.contains($0) } + return isZero ? 0 : 6 + case 7: + return 8 + default: + print("Invalid output signal: \(outputSignal)") + return nil + } + } +} diff --git a/Sources/08/main.swift b/Sources/08/main.swift new file mode 100644 index 0000000..af996fb --- /dev/null +++ b/Sources/08/main.swift @@ -0,0 +1,12 @@ +// +// File.swift +// +// +// Created by Max Nuding on 05.12.21. +// + +import Foundation +import Runner + +//Runner(target: Day08.self, day: "08", isTest: true).run() +Runner(target: Day08.self, day: "08", isTest: false).run() diff --git a/Sources/Runner/Resources/input/08.txt b/Sources/Runner/Resources/input/08.txt new file mode 100644 index 0000000..28dc8f9 --- /dev/null +++ b/Sources/Runner/Resources/input/08.txt @@ -0,0 +1,200 @@ +bgeacd dbfag bcadegf agdce dgfbce bgc bdgca aedcgf bc abec | gcdfbe cbea bc gbc +bdeag gdbaec cd dgc abcfg ebcd dgfabe cdfeag cgadb bdagfce | becd acfgde bgcaed eadgbc +acbfg bcf ebacg fb fcbgea cbdfge cgeabd agcfd aebf bdaefgc | fbcdeg cfb ebgca bf +bfcde dfgb gecbdf fdc fdcega fd ebdca gfcaedb gcfbe cbagef | dbfec gbfd bcdfe dfc +dbgeaf bad acdfbe ab agbdf bgcdf fdgae fcgbdea fgecda egab | ba dab abd gbae +feagcb cdfagb egda bdg dg fdcagbe ebcga bedfc bgecd dbcgea | eafgbc bcdfage dg egad +bacfedg afbgc dbcgaf afgecd acd bfagce bgda ad adfbc ecbdf | dca dca abdg dcbef +eagfb efcdba faceg gfdce cea afbcegd ac afdegb gafcbe gbac | fegcd geafc edbcaf bcag +cfb bgfce ebgdf fc gdfeab acdbfeg cgeab ecfd badfcg ebcfgd | ecgab eagcb efbacdg fc +adfec ebdcgf bfced bec fagcdeb gbcd cb fbgde deagbf afecgb | bce cb fdgeb bc +bgfaec dcfga ed acedgfb fdebgc dec fdeb gedcba gfced cebfg | cde agcbde gfaecb cde +bgefc cfgbea dfgaecb dg dbcg dcefa dfbegc dgfce afgedb fgd | cfged gdf fbgdea gafecb +fcbade dagbe gacb gaedfc bdaecfg bgfde dbaec baegcd ga dga | ag gad gcab ga +cfgdeb cbfade fac badfc ca gafdce gfdebac bfadg fbdce aceb | ebdcf deagfc ac ebfcd +debfcg fgde cfaedgb ecbag cbeadf gf gbf fdceb fcebg dfagbc | gbfec gf agbce bfcagd +fdcebag cbeagd gafed dfbgc cgedfa beg be edgafb edbfg eabf | gbcfd acgefd cfdageb afged +bgad efdbcg aecfdgb fgebca ga cgade acbedg adfce aeg cgdeb | gdecfb fgdceb adceg ga +acefd efdb cgabfe be fegcbda gbacd cagefd eab acebfd acbed | be debf feacgb becad +edbcag dgefcab ce fgdcb eafc afgceb gfbae cbe degafb bfgce | fcgbd ec dbaegc efgdba +bfcdge gfcbda aegfcdb dg cdgbe dbfce dgb fged cdefba caebg | dbg bgd gdfe dg +bfeadc dbfcgea bgdaf decfg efdabg cgba fbdagc ca fca gdcfa | cafdg gacb bdfeag ac +edbcfg cdgfae gedaf egcfd beagfc fga bcfdgae cgda debfa ag | defgc efabgc fcegadb fegda +gafcb fcgadb gdca gbadf ad fbegd befcag fda ebgdcaf fbaecd | agcbf dbafcg dgafb abgfcd +cga gafce gecbfda dbacgf defac febcg cfbdeg afegcb bgae ga | cdbgef ebdagcf caefg geba +gfebcda ab dfabg abcfgd gdbfc abgc becgdf bcedfa adfge fab | abf fab ba agbc +fagce ceabfgd cdea cbfaeg dgafce egcdf bfaegd gbcdf fde ed | de aedgbf fecagd fcebga +fcbad fe afge ebagd fde fbdegac fgbced fdgeba fabed edcgba | debga bdgae bafdc efag +adbfg ba dbcfga abgdecf gfedb agfdc gcdeaf adfebc bda bacg | befdac ebdafc abd gdbafce +begfd dgfbac dgbac ce bedgac dafceg dgbce ecfdgab ceg ecab | gadfcb gefdb gdeafcb fgcdab +dcfagbe dgbefa gdbcea faebgc fade efabg dge cfdbg fbgde ed | de efbacg dfea dfea +dcfeag bgefcad dcgfe afedb cb bfgaec dcgb bec fcdbe gbecdf | bec agfebc ecb edfba +acdbgfe ebcag fgc feagcb bafc gfceb fc gfadce gcbead dbgef | bceagd fcab gfdceba cfebg +bdegf abgefd fgba dgceab dabcef badfegc egb fadeb gb fdgce | gafb efdba gb dbfage +bfdca cfgb agdfec caf bgcfda becad gbdaf fc ebgfcad bagedf | gefdab cebad cf bgfc +dfbcge bedgaf bgefd cgebda efcb gcfad degfbca bgc fcdbg cb | ecbadg gbfdc bgdfe fcbe +dfeagc bfacge abfc fcegb bdecg bef acfeg bf bcgaedf gedfba | bf ebf fb cfadegb +fbgdc fcbgead egaf acebgd gacdf fad gdaec bfecad fa gcedaf | eafdgc fda degacf geadbc +fcdea gcdbaf cgedbf bd bgde cdb acfgeb efcbg fdecb fedbacg | aebgcf febdc dcb bgdefc +bfdeg dbcefa bdaegf cegdf agdb fdaeb bge gb beacfg edbcafg | gefdb edcfg acbgef egb +afgedbc caebg gef fbec egcdba dfgabe gafcd bfacge agcfe ef | fge eafbdg cgbae cgaefb +cbagfed dceba efgcb bcafde gacedb fdca caebf egfabd fa aef | adegbc cbgfade adcf deabc +gcbd bcegad eagdb fedabc acebdgf gcbea gaebdf gacef bc bce | dbaegc cgfea bcdg ebc +cbfdeag agfbce cagef cbdefg gb gefab gcedfa gfb fdeba abcg | bfg afegb gbf cgab +dea fadgbec dcabe abcdeg cfbad gdec agecb gdefab fbgaec de | dbgfae cdfegab dbgcae beadcg +gabcd aebdgc gcaefbd edac gbfad cebag efcbga dc dcegbf cdb | cbdag agebc afcebg faegcb +gacdbe cdabefg fecgab fe gef cbdgef dcfe gdfeb cbegd dagfb | egf fe efg decgb +cbfea bcgf adcfe ecbgad bf gfebad feb bfagce afdcgbe abgce | cadef bcfg bf dbfcage +fabeg cfeab ebgfcad ebfgad eg edag dfbag feg defcbg fbdcga | efbga fdcegb gbafd gdbecf +cdgfba bga geabdc dacge beadf ebgc agcfde bg gbacdef bgead | cebg fbdae gbec dagfce +fbgdace deafcb ead caedg da decgba aefcg bedcg gdbecf badg | ebfdcg gbad ecagbd egdcb +faebg fg gfca eafbd cgbaef baecdfg cedbgf eabcg efg dgceba | edcgfab feg gf efg +adbec dbcaf ecga dea eabfdg cdbge bafdcge bgdcae ae fedcgb | ead cabdgfe agce egcfbd +gdcef agfb bfgade cebdaf debcagf dbafe egbfd cdageb geb bg | egadbc gcdfe afgb egb +gfcbe cgfabe cdagb debgcf de bdef gde dbgcefa dfecag edcgb | fcegb fdcagbe fcbge edgcbf +gaedcf cfedba dgacb cgbeaf fbge ecafg bfdgace gfacb bfa bf | gcadb decafg adgfec baf +eadg gfadbc eagbcd agbcd cea bdafgce cdfaeb ae gcfbe geacb | ea cdeagb debgacf egad +afecgbd eafd adbgf egfdbc cbeag bgfead egafb fe gdacbf efg | egcab gef dbagfe abgecdf +gafbde geab efdcab badef cfdeg gfa egcdafb fdeag ag abfcdg | fcgde ebfad bgae ebdfa +adbef adbcfg fbgace eac ec egcb afcgb cfeab faedgc dgfebca | gbadfc eca ecgb cgbe +fb efadcb fab gbfeca gfcab baecgd fadgc gfedabc gbef cgaeb | beagdc cabfg bacge gbfe +dfabcg bcdg dagbf aegcbfd db fbd gcbaf gefad feabdc gcbeaf | fagdb bacfdg gabdfc dcgb +ecagbdf dgfac cefag geacdb dcefgb df bdcgfa afbd abdcg fcd | dfc defbcg df afbd +bfadc bcgad acegd bg ceagdfb bag cdaefb fcgb cgadfb gdebfa | cfbadge efbdcag fcdab dcbaf +bdcefa gc cgb egdc ecdbf cfdgba agfbe dfgebc cdgaefb gbfce | cbegf begfc ebcdgf fabge +caedgf egf dcebg cfbeg edgafbc bgdf ebdfcg eacdgb gf eafbc | bgfd efgcb fg afbcegd +gbfae cdabfe degc edb cbdfg ed ebdgf dbfgce baecgdf agdfcb | adcefb ed de cfbgde +fdbcge defabcg fgead befda gacedf ag gdca gea cgeafb fdegc | ga fecgd ga dfegc +ed efcgab edacg adcgbe acgefdb deba fcbedg agfdc bgace ecd | afdcg bceag de gcdeab +facdbe dagec bfcea bcd dfcgbe cbdae bd abdf bgcefda cbegaf | dcb aecbd befac ecfdab +fa fea gafc gfebd dcabge dfbaegc gacfeb abgfe baefcd bcgea | befdg gecfab cafebg agceb +cebad ebdgca bd fbedacg gaefdc gadce becaf gebd cfbagd cbd | dcgfea abcgdf cdb bd +cfbgdae cgfdb cabgef df bdfa bgfac gcadef dfc fcgadb egbdc | df faedgc dcegb dcgbf +cbfg gecfa adfbge gfbcdea eabfcd fg bgfeca acedg fga bafce | efbgac dcfabe cebafd decag +gdcbef dcfage acgde fgbea gedbac bc bgace gdaefbc ecb dacb | abdc bfgea ebfgcd adcbge +gafe cfbad aedcfbg adbgce cebgfa agcbe gf gbedcf gcabf gcf | bcega begcfa gafbc feagbcd +cabefg ce ecfb dcebagf gface afged fbcga afcdbg eca cegdab | aec ec gafecdb bdgcaf +bgdcae cedga bdgaecf cd afegd dbac dgc efagcb gefdcb cegba | efbgca bdecgaf caegbd dgc +aebgd cfageb ecdagb beagc bcfdeag dfgab de ebfdcg dge adec | ed gfebca de fdcegab +ebcdagf fcga gfbaed gf dgfaec ecfad adcbef gdcef gbdce feg | dfcae fge feg fbegcda +fba cegadbf fa deaf deabg fedbag dgcbf agebdc gafbd bgfeac | bfa bfa fgcbead fbedgca +cdgef dgbcaf gadcb edacgb agfdc adbfce gaebcfd fa abgf dfa | gbfdac acfgd gfcda fegdc +dcagbf cfda fcdbge cf bafcg bdgace adbcg agebf bcgedaf gcf | dcbegf bgdac gafcbd cgbda +degfac eafcb dfacg gbcaedf gb dfbg afbgc bag bcgeda gfbdac | dgcefa dgbf bga fcgad +deg fgdb feabd dg gefac fedbca eacgfbd ebacgd abedgf dfaeg | egfda gadfe edg dfbae +degf fcagde cgdebaf cgf cafgd gf fadce cgfeba gcbda fcaebd | cdbag bdcag egdf dacgb +fdgb bagfdc dbcaf fb abdceg fba fbeacgd geafcb afdce bgadc | bf fba dbafc gadcb +aegdb fdagceb bafce fad dgabfe df cagbed fdeg aefdb gfacdb | becgad adfbe afd badfe +fdbg gfabc fcabd fd abcegf gadbcfe ebcad dcf dcfbga fagdec | bagcfe gfacbe fd cagebf +cgfd egdca fdaceb abegd egabcf eacfg ecbfgda dca fdcage dc | egcaf ecbdgfa abcfed dcgf +efdgba cgfeda ac gabecdf efagd adcef fac cefbd gcea dagbfc | afebcdg ca bcfed ca +acbfeg bg fecbgd fgdeac acebgfd gbe bagc afecg fbead begfa | agcbdfe bg fegba badegfc +eadbgc edfba bfecdg acfb egfad ba bea dfceb dcaebf beagdcf | ab eafbd abe adcfgbe +fbega afdce gd agcebf becgad bgdeaf fbgd gde ebgfdca efgad | cegdab cefbga fbgd geadf +cag agfce gfacde gbcdaf ag gead fbgec cdefa bdafcge bdefac | cfead gca adge bdagcf +dc cebfa egacfdb dcf edbfc cbdgfa fdebg gefdba cged fdecbg | dcf eafbc bgacdf dc +edbfg fdacge dcgae baegcd bacfgd ecaf geabdfc ecdfg fgc cf | defcag dbfgca ebfdcga cebdga +fdgec gd gfd efcbd fdagbc bedg fabedgc gaefc becadf fdbecg | gacfbd fbdcag dgbe edcbf +fec dgebf fbdc efbdcga afegcd befagd fdcgeb fc egcfb cgeab | bdefgc dfegba degabfc fc +cdb gdfc dc cbdega eadbf egfacb gfcebad cgbfda acbdf bagfc | dgaecb cd bafed dcb +dcbga ag cgdaef fgbdeac daebc fbag cag fgcdb ebfgcd fbcgad | ag faegcdb acgdfe dfgcba +dabef fa ebacfd dfa bdfec fbgdca cbfegd dbcegaf bgaed efca | gdaeb afd eadbf fa +bed dgab gfced afgbedc dfbge geafb efadbc febdga cafgeb db | fgeba gdba aegfcb gfecd +da gbacf becdaf ebcfgad ecad cgfbde fedgab dbfca fecbd abd | ad egbfdc bad fcbag +efc bgfceda dfbcag ecbg efagd acbgf fbagec aecfg ce bfeacd | egfac ec afecgb fbeacgd +aedfbc gaced fabg ab bdgfc gefbcd adb gdbac acdegbf gcfbad | ba bcgdf ebfcda bafegcd +cdgfb abegdc fgeacbd feba ecafgd gebfda ef efd dbfeg bdeag | dfe egfdb agefdb bedga +cagfb ef fcdgae cfe cgafdb bcedg fbdgcae bcegf feba acgfeb | gefdac egfacd cgebd feadbgc +bfgedca cabfgd gbac ebdfa ag abgfd dga egfdac bdcgf gbcefd | cafged bgadf ceafgd ag +gebda bc eagdbfc ebdcg cdbgfa cgb ecdgfa cefb gfdec fbgecd | dfgbac cebf dgbecf fcbgade +dfbcag dafgc bfd fdgcae gebda ecafbd gfadb gfcb fb dacgbef | gbdfa dagcf dagfc fbaced +cd dfebg fcdgb cadb gdeacf eafcbgd gfceab cdg abgcf dgbfca | dc fbadcg cd adbc +becafd dbfa feb fb abgcef adgefc cefda bgced edcfb bedgfac | fcdabe bf feb dfab +gbadfe fdcage acgef fed ed decg abgfce adcef gebfadc fabcd | ecdg afbcd afdgce fde +fcaedb dgbca fdcg efgbdca fbgca befag caf bagfdc dbaegc fc | fca gfacb bgceda fc +cabed fbed fd cfd fagecd bfdca bfcdaeg acfgb bedcaf dcgbea | aebfdc ebfd bdcaf fcdgea +agdbfc fagbc fgdc dgacebf bcgaef fda ceabd bdfca fbgead fd | fda fdcegab bgafc edbafg +cbgfa bfdgea bfdgc ga fga aecbdf gcae egbcaf bcfgdea cefab | ga fcabe fgbdc gfbac +cgafe cbagdfe afbce afegdb efgda gebcda gc gdcf cag eagdcf | befca gafed eadbcg gca +agfce edgcba egbac gcbf fagbde gdacebf agf cdaef gbeacf gf | fecag bgace gdfbaec bgcfdea +be gaeb gdeaf fcdab cbegfd fgeacd efdab fbe cgebfda dagebf | feb dfgacbe faedcg egfbad +dfcba cgfdbae gda afedcb bgca bagcfd ga gbdef eadcfg bgafd | bgfad gfebd ag efabdc +edgafb dgef agbedc gf abfgec fcdgeba adfbg abdeg fga cfbda | dafecbg badfg bcagdef fag +fgc cgfbe ebgaf cbfa cgedbfa cf bgced gecfab defbag fgdcae | gfc cgf gbdfea fcg +cga bcadfge aefdgc edgca dafc gdafbe aefcbg agefd ca cdegb | debcg faecgb cga gac +dbcaf gcadebf eafcgb dbcefa gbdf cbfdga bcg adbcg gb edacg | afecbg cbg bfcad cabfdg +fd dgaeb def fgecb fdebac feadbg eabdgc dfgeb becfdga gafd | fbgce egadb bdgea fagd +cedbgf dbcgf febcad dgeafcb efcagd bfge cfg bdcga dbcfe fg | gcf cbgda gcf cadfegb +gfabc agc degbaf fgaecb gaefb ca cefa bedgac fedgbca gcfbd | begdca gbdcf cag eacf +ebfa be fgbcd afcegd cbe febcd faced egfdcba dbface aecbgd | ceb ceb cbfadeg feab +gbfad cdeabgf bdeag de afcdge ade cdbe ebacg geafbc adcbeg | cbdefga gaceb ed bdce +fcedbag adfeg fadebg cbgda fdeb fba bf egdcfa gfadb cfbgae | bf fegad gabdf dgcba +abde debfgca acfegd ae fgcbe dabgc gbadfc cgeba cgeabd aeg | eag bcfgdae gfebc aegbc +afdeb caegfd dcgb bcafge egabfcd fgd cgfbad dgbaf fcgab gd | aebdfgc bcdg agfebcd fdabg +ecbafg acdbfe bfge cfaeb cedga cfega dafgbc afg gf bcfgaed | cbdfga fg efagc geacf +ecafbg adgfecb fdeac agbd cbgdf cfgbda agf ag bedcgf agcdf | ga ga fag cfdbg +gcdbe cbadefg cdf dfea df gfaebc facbed cfbae bagcdf ebfdc | afde aecfb cbfdea caedfgb +gcfb beafgd fdg deagc cfbed fg gacdfeb gdcbef fcebad gedfc | cdbef dgf dfg bcfdgea +dgebfac eacdbf bdc abgdc adbeg cadgf cbfg cegfad gcbfda cb | cafdeg fdacge facgd bcd +cdeag becf fgdbac fc gbfaced edgfc dgebaf gbfdec edgfb cgf | gafdeb daegc bcdfge egdfab +aegd cgd abfcd cabgde fdegbc dg ecagb dagfbec cbegfa badcg | ecagbfd debcgf agde bacfd +cfdge gb abfed bdg cbge gfedb bgfcdae cbdagf begcdf fcdega | cgbe bgd cfbgda fcedg +egdfca eafdcb ecdag dbgfac gefa ag bcfadge agc gcbed dacfe | ebafcdg acefd fdcae agc +afbgec edgb dafeg fegab agfdc de eda fbdgcea dfaecb fdegab | ead aed cfebad bceafg +dbgc gbeaf acfebd agd afecbgd fabdc ceagfd gbfda cbfagd dg | gcdb efdacb gfdbca gbdc +afcedg gbad dgecb gcefb acdbeg dg abedc dcg dabcef gbdcfea | cgdeaf beacfd cbade cgdbe +ea egfdba dgceaf daec cfgbe eag befgdac fegca cadfg fabgdc | fgceb adfgc abcfgde gaefcd +agdebfc dbgca egb egfd abfde agdfbe fcbade fgeabc dgbea ge | bdgca debaf aedgb fegacb +efcbd ecgd fbecgd adgbf egacbf bfcgdae ebg fdebg ge dcebfa | gfceba cbdfeg eg fgceadb +dc befgac cdb aced gcbfead dcgefb adfbg acgbd cabeg eacdbg | edcabg bdc dgcaeb acbgefd +afgbc dbaf ebcfg ba ecfgdab adcfg bca fcaegd cgabdf gcabed | bfgce egadbc cbgaf acdbefg +cagbd adg cegafd acfgebd bdaec gbfd gd gbafdc bgacf faegcb | gebacf dg gda agdbc +bc cdgba adfcg ebadg cfbdae ebfgad dgbfcea cba bgec gbdace | bc cb dafgeb cab +gae bfegc edfac gdca ga begdaf cgeaf edafcg bafedc cfbedga | adfcge ecdfag fabcde aecfdb +cdfge db eabcf fdb bade cbfed cbfdaeg gfbdca dcbefa cgfabe | dbf cbagdef db abed +efa facg beadcg gacfde cbfed dcefbag adceg fa gedbfa cfdea | agecd gcbaed afcde eacdg +dbgca dfbeg fcg adbcgf bafgce fdca cgbdf gabdcfe dbecga cf | gacefb cabdg dfca fcg +dbfcae gc decg ebadc cga abegf cbfaegd cbage gabfcd agdebc | edbcga gebca cebda baegdc +becagd gefcdba bgaef gfadcb fgd fadc bdacg dfagb fd ecdbgf | dgf fgaeb cdaf fd +egfcab dcfgea caebg ag cbeafd edfabgc gfba bcdeg acg ecafb | cfbaeg gac acgfed eabcg +gbc gfbad fgbac beadgf cg fbeac gdfbce dbgcaf bgcfead cgda | gacd edfgbc cbg gafbed +fgdba begcad fg gfd fdacb debfag egdba adfcbge fgbedc afeg | afdbg bdaeg badfg eagcdb +cefgdb fdecga beafg agd acbd badge cgfdeba cebdg ad dacbeg | cabd cedafg cfedag fgaeb +fgc cdefb beafcg dcfbg adbgfe cgad acefbgd adbfg cg afdgcb | fegcdab bagfecd gfdcb gcad +cbagfe cbedgaf bfgde cfdeab gfeba df fgda dcbeg afebgd bfd | fd adfg ebgcd fcabge +ebgaf ad ebacgd adfgb cadf abfdcg badgecf cdgfb bad ebcgfd | bdegcfa cfda fbaeg gbcfad +adfcg dabecg gaebfcd ecfbag bgacf gdc bgdf cbfagd eadcf gd | dg cfgab fcgab agbfce +ecfgdb dcgbfa fdage ecda ad ebfag dfa bfadecg fadecg cegfd | ad dgefc cdae bgdecf +agcfed eabdfcg aec ce gacbd gadec geafd cefd bagdef cgafbe | ce aefbdgc egcbfa gaecfd +gdace fe bdgafc efa dbafecg fgeb bdafce beadfg egdfa dgfab | ecgda fe fbgad fedabg +fg bdgcefa gabed defga fbeacd bdcafg cfeg gfd edcfga fdeac | agfde fg fcbade dfgea +dcgfbe egdfc gcbd dc geafd becdaf gcabfe cde efbcg gedbfca | dc fgead dgcef gdcb +gdefa efadbc cfdebga adfebg eaf ebag ea adfbg cfdeg acgfdb | fgdbaec cabgfed dgafe efa +fecb fcegbda dgeaf eagdbc eb dbegfc cfgbad beg gbedf fbgdc | bcef dfegb gbdfca dgcbafe +befg bafde afgdc degfa cdeafbg edafbc dge eagcdb gdbafe eg | dge efbad becgda aegdbf +ac adfgc cedfg bedgac cda ecfagd degbcf fecabdg afec badfg | gdfab dcgaf fgced cegafdb +cda badcg edcgb geca ca bdaegc dbfaec decgbf agfbd ecdgfab | ac bdfag ca edgbfc +fgac febgca fg ebacf bgfecd gfb gbcfdea badeg bfage bedfca | gbefcda fg bdfceg gcfa +bcgfade ce fcge dbgcfa cdafe badgec acgfd gceadf befad edc | bagcfed ecfda fcgad dce +ebacfg efbad fcbaedg age dfagc adefg cdge eacgfd ge dgfabc | geabfc cdfagb eafdgc gae +abd cgbde da gdcaeb cagd baecd faceb afdebg ceagbdf egfdbc | agdc gadc gedbcaf bcafe +eg bdfgec dcfbe facebg efg gabcedf dcgfe cedfab afgcd debg | ecgdf cgefbd cdgef feg +eagf efbdgc dga dcefg cdgfea bcdea cdgfab ga gdeafbc ecdga | gcdae aedgc ga ecdab +ga cbedg eacfdg acg eabdcf ebafgc adgf cfeda egadc dacefbg | dfag fbcage bafgce acgde +gfea cgdfeb efabc agfedcb gfc afegbc gf cdfbae abgfc dcbag | caebdf beafcd caebgf baecf +efd gefa gedcab dcfab cfdea ecdgafb fbdceg egdfac ef agcde | gafcde ef aefg cadfb +bafecdg deafbg fadeg bga deagbc gebfc bafd efbag ba dcgeaf | gedaf ba dgbaecf ba +ag dga geabfd becadf gbaecd abecd aceg bagcd cfgdb cebdgaf | egfbad aegbcfd cgae dacbe +bcdgeaf gbfda afcged gfebd fa dgfcbe efab agf bdcga dafgbe | gafedb efbgda ecagfd fgdbe +degafc feba fgbcde bafegcd bge adegb be dfega efadgb cgbda | dbegcfa acbgd faeb acefdg +gdcfeb ea fceab fgbca adfbeg eadc cdebafg cebdf aef fecabd | cefba fae dcea efa +agfde dbega fg dcfg ecadfb cegbaf adfec adecgf adebgcf agf | dgfc gcfade afbecg dcfage +fbade caebg becadf fgdb gfa dafgbec fg afgeb fbeagd gaedfc | eacfbd bgeafcd fg efbad +gbdacf aefd ed geadcf cegfd fcgeadb dbeacg cadgf ecgfb dge | gbacfd beacgd ecgadf cgfbda +adebgf gdf cefgdba fd gcfba efad dbgeca agebd afgbd fdegbc | deaf gfbdea df dbaeg +adgbf cbfg fagde facebgd gbd acdbf badegc baecdf gbfdac gb | bdagfc gcfabed fdcab cdfab +dbgace cbdfg ab dfagb abef abgfde gaedf bad ecdafg gcdbeaf | ba cbaedg ba dfbga +bgcade acbedgf gbef cef cdbfa ef cbefd afgecd bgdce fbcgde | ef ef fce dgecfba +gbfced abegc cde acbde fcgaeb cd gebacd agcd gfabdec abdef | gdca gacd dcbae bdegafc +gb facdb fedcab fgb gadebf aegfc dgcb cabdgf gbcfa eafcgdb | fegbad adfcb dafgbe fdcba +gfbaed fcabde gdbfc bdeafgc dgb agfcdb cgda fcdab gfbec gd | becadf facdeb dg agbdcf diff --git a/Sources/Runner/Resources/input/08_test.txt b/Sources/Runner/Resources/input/08_test.txt new file mode 100644 index 0000000..c9f629b --- /dev/null +++ b/Sources/Runner/Resources/input/08_test.txt @@ -0,0 +1,10 @@ +be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe +edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc +fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg +fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb +aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea +fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb +dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe +bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef +egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb +gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce