diff --git a/2022/day21/input b/2022/day21/input new file mode 100644 index 0000000..e59658c --- /dev/null +++ b/2022/day21/input @@ -0,0 +1,2643 @@ +nfpr: 3 +mhnp: 2 +lhzg: vgvf * hnfq +wwnq: hcvc + clwj +bzvl: 2 +rtbr: fdqt + nwlj +dgzz: lhnr + fwwm +nwnj: 4 +hwqb: wcfm * fcrt +vbdj: 13 +glcj: 3 +mfbw: 2 +wwfg: djwb * lfdc +pfgc: qscf + wvps +hmfb: wmvs * sqmf +smcp: 2 +gbpj: 9 +ncrg: lnfb * vtnc +lhcf: slrl + hzwm +pvtg: mprn + hvtr +vpdc: vcql * pwhq +tqrl: 4 +mpdf: 5 +zjmz: qssp + mmqq +ftqz: 2 +fsdf: gdnh + cwwn +pjrd: 5 +sglv: 11 +bvws: 5 +wcfm: 2 +hbbd: 2 +btgq: fwpm + jgph +fsdd: 3 +tzgp: wjgz - rfdf +dvzl: csdd + cfcz +rqbq: 2 +jhrl: zfvc * rzvq +wpms: zhcw * qwll +vrbz: zbwz * cszq +fcgz: cqht + vhtf +sthr: thqf + zcjv +lqzt: 3 +wwcz: hlln * mgmp +smcs: 2 +trmw: jgzj / qvzq +tmpq: 5 +dmhl: vrhg - nzmj +zsww: 2 +rlfh: 5 +rgtn: 5 +bhws: lntz + bvcz +rfwq: zrmn * fwlf +djzp: 4 +dgtr: 20 +bmds: bdmb * wdvv +mjlq: 14 +bfdr: slwq * gjsz +vrgp: 14 +mmpg: nlff / tlzs +dphq: ngcc + whhr +jvwg: fczm * qspw +nnlc: qgsh * jrrh +zljq: 7 +hqpf: rznw * pdnq +dczq: 2 +tsvw: 4 +pnss: 2 +cwhv: fjnl + qhlv +fwrq: 2 +zmsn: gqnm * mnqm +rfsv: mpdf * sqgt +wncg: 5 +lcbg: 12 +wddt: 6 +bcsr: mtqb + bqgf +hggp: 3 +fmrg: qldl * pqsb +ctfn: 4 +nhth: wppc + ppgd +whfn: vhvn + fvzg +tmvj: szzb * qnjw +fvpr: fssn / qddm +wfjh: 2 +dcbm: 1 +bcrw: 5 +svtd: rtfh + dbrp +jcjm: 8 +fmss: ztst * zjtd +ppgz: 3 +wmqt: 2 +lhmt: vvzs * bzfv +gnnf: 5 +hnjf: jwjv * jpbp +twbv: qpww / jpqp +rszt: 6 +vqrc: 3 +qnjw: 2 +svlw: tnzj - hdql +lbgv: 2 +tfcl: 7 +sfvp: mgcq * mjcq +wqnw: hmhn + njmc +fvnz: wdgg + vvpw +rnls: 14 +bvcm: 1 +jmrs: hfls + rldh +fmsl: cwrq * mnlr +llzd: jrrf + rzsb +mzsg: mjlq + pfsr +wbgz: glhd + hddc +drzc: 20 +lvzr: 15 +zfdt: 2 +mdww: ltvp * fvld +tdff: crwh + cppn +lsdm: 3 +pdsl: 10 +bdtv: 9 +sclb: 2 +llzm: mmmw + wfzm +lqnw: wqwl * ssft +qzrc: vbbp * qpzm +dsmg: 6 +hvts: 6 +rqlq: 15 +tvmj: ppnm + rnjm +mztc: mczb * gphh +gvww: 11 +zthb: 4 +svsp: 7 +dcgb: 2 +dbfj: 8 +bdqv: chqt + vhsg +rczc: 11 +hsgt: 2 +dsfp: 2 +pbrl: rlhg * cgmn +rllv: hmpl + psbb +hjjd: mlnr + mmfz +gphh: 5 +wpsl: lnbh / lsgz +bdcr: 2 +jrwg: 3 +nhss: 10 +dznz: gvdd + jzss +hbbs: 2 +gfcg: 2 +tqvc: 11 +jbnw: 6 +tvpz: 2 +nhsn: qgzw / bljg +hshc: 3 +dhdq: mhpq * qvhp +tnzj: vthb * hbnt +rvzd: 1 +vhpp: hblp * clws +cjfc: stfd - sgcw +ftgw: bbrt * flsh +mdjq: 5 +jgmq: 5 +srdb: vsvb * rjcg +nhvn: 4 +tsnm: cvzt * fjpl +qgsh: nfrp + ctjg +fmwr: cbnr * fpwm +grbv: 5 +nhqc: 14 +nrpq: 11 +crmh: qbqd - jqql +vqpl: hqsf * ntlp +ctbh: 9 +prjm: 3 +rtzd: 2 +jznz: tjls + pgcq +dqnh: 2 +sfrc: twjv * bblj +njfq: qhfj - lvpl +nfzm: vlvg - brmz +dvwv: rfsv - clcl +wjwl: 2 +ggjh: 3 +jlcj: tcbz - crjq +rlhg: 3 +bnzz: 3 +sgvc: 2 +gjtl: zwnl - vjfd +rnjm: dqps * vdlz +fwwm: 4 +hpct: 2 +hbbb: mrjw - fggh +pnjg: rpgs + qpns +mnqm: 4 +hvpt: 1 +znld: mnwq * ctnp +csgj: 5 +cwff: 2 +rzfp: wbqm * mflz +vlvg: jltj + tgmh +gshc: 3 +fjqv: 3 +trnf: cbhv * fjqv +bljg: 2 +srgr: dznz + ntnr +fssn: rjfs + mzbb +sdfd: 2 +tnrt: vpdc + vsqz +jtjj: gtls * tcbp +cmvw: 2 +cqht: jrdb + gwqq +brct: 5 +rqjj: zllt * rvwc +jvzn: qncv * jftn +hszt: ldmb + sncl +wcpw: 2 +mlld: 1 +tfwz: gdmq / qcrp +hrfq: 11 +mlnr: vjjh * wftp +rzvt: 16 +ccht: 2 +wsrh: rzvt * thbq +nfrv: 4 +hwzq: ldps + fvhc +flsg: 2 +flzc: jpsv + tcgs +qjdw: 2 +zhjs: 3 +wtjm: vtgj + jdzv +qtzl: 12 +ltgp: 3 +tmst: 2 +vctd: rqbq * hmtb +btzj: 2 +qbcp: 2 +bbcm: vjhz * mhps +qhfj: pfdj + mdrm +bzjj: dbnq * tvmq +mjvq: bqzm * mhrp +wrdz: vqlc + rqtj +gvnr: 4 +nchp: 13 +fwpm: vmjg - rbnb +dzpb: dsmz * zhnb +bmfv: hzcn + csgj +qbzh: 20 +tzhq: 3 +fcrt: fsdd * sgtb +trdv: smpc - vwrc +hmnj: 20 +cdhn: lccv * qcpp +zwhl: wzmh + fdtg +sgcf: qfsn + wbps +vpdd: hqdt + pnhl +bbdd: rjbv * pmrz +rjpc: 3 +bfdj: zfwf + nfnf +gjbq: 2 +jhst: 5 +qdcn: 3 +jljn: 2 +pglr: hcsm / wncg +tthz: 3 +rvwc: 2 +ctjg: 5 +ppjr: 7 +gmpb: 9 +rspn: 5 +vqhh: pqjw + lpnj +vljn: pzpn + hvts +bdmb: scqr - hqpv +wfsl: qpdp + zzmg +cnpn: slpb * ggqm +sczh: 3 +dqss: czgd + ppsj +pfpc: wdnm * grgl +rnzm: 5 +tbch: gcjw + dczj +zmwd: 14 +ftph: nzzt + fnld +vwss: 4 +hlvz: glwd - rzms +psps: lvcl * gwfw +cdjd: hvjv + djhh +nqsf: 2 +ngmc: 7 +sllg: 2 +lrpq: cjwd * ffms +hlmj: rnmc + bjvz +vfbl: 5 +chwr: qjml * pldf +btwf: svnh * glmg +bmdp: 7 +sqrf: 7 +jznp: 5 +gnbn: 7 +zlcq: smjc * crlr +lvpl: nvqf * bdqh +bsts: pscb + zzhj +hszv: bhph * tvpf +vcsm: rhnq * rfvf +lfdc: zlps * jpmf +rjgb: qwlf + jdhv +fddj: pdtv * shgn +bvzm: rbmv * sbvv +dtzc: nwfq + nrpq +cmqs: bvzm / fvws +mtqb: smzd * bsdw +lgwp: 2 +shgj: jhgf * zcth +swzq: 5 +rdtm: rqqs - wdss +rtqj: 2 +cwqh: 1 +fmhd: hmhh + mrdd +czwr: vdjr + gnjl +wdnm: 4 +cbmr: mvld * sfsz +ndzq: 5 +ssft: twdv + cnqg +qprn: 2 +mqpw: 2 +fpjd: 3 +grhd: 2 +nrrw: 2 +dzwb: 4 +zhfb: wmsh * pglr +cltn: 3 +hcqq: brgz - nwqz +bnwn: 16 +phst: 2 +gvhz: 3 +ghzb: smwj * rlgp +plbm: pljz + wqzz +cszq: rsbn + tlvd +jpbp: cwwh + nvhl +nsmc: 3 +cmtg: bmfv * shjm +qrmt: zrvw + bbcm +nlsh: nwwh + tsrb +qwgt: mdcw + fvmv +bbbr: 3 +vdwd: 3 +hmmt: nzsl - gbpj +tvtl: hnlg - tfjv +qbqd: dhpj / wfrs +fggh: mbpm * rjtp +cjns: wlbh - mjtq +wtmf: rtdl * mmwf +nwwh: gnvm + crlq +cqvm: zqwb * wmjj +lrvz: ttqc + bdmc +bbrp: 4 +dfhb: 2 +nzmg: bsrm * qhwf +lgdg: 3 +rbmw: tfcl * pwlm +pdmt: hgrb * jvzn +gnpg: 5 +dbhn: 9 +wdvv: qvvq * ctvj +gnjl: bdvs / qqgl +szhm: crnh + jmpv +zwmv: hgfz + mghg +cnsf: 10 +dbnw: 3 +cpth: lgrc * hwzd +ftjv: ltlv + qzpj +shnl: 2 +smmv: dvjp * bnzz +lrzq: 2 +wffl: 2 +zwgd: lhzg / jzwp +qhnn: gcgj * scnf +mdqb: 1 +wwzh: 2 +slnn: 11 +qqms: vdrc * hczr +jzcf: 4 +wfrs: 2 +vgcm: 2 +qrwj: 4 +bwsz: 5 +mrqn: 2 +zhww: 8 +crnh: 20 +wcnr: dgqm + jnwd +nmsg: 5 +fffw: wtmf + fvml +jbjw: 2 +zjlc: rrmg / dzdc +lnbh: qlwj - jtvr +dbrp: jhfh + nqsj +vrhg: pvsv * vwfj +tnqd: 13 +ggwv: 2 +mmrb: hrpr + rfcp +wgqw: 2 +qnzm: 3 +njsv: 4 +fjsf: qcsn + mjml +dfpz: 2 +hnrh: 3 +fjsz: tsvw * bvmz +tvzz: nwsv + znpt +dmwl: 19 +rlqz: fgjb * zpvw +hqsq: njsv * cwff +zbdg: 2 +mrdd: vbcp + srfw +dwvm: bbdd + nnpg +grhg: 2 +qtqf: twgn + cbtm +drst: jwwn * rwhd +bnbw: 7 +zbfp: dzpb * dqss +pndj: 1 +jrdb: 16 +ffws: lrnq * qvbs +jmhp: 2 +rqpl: 11 +pjdn: 6 +brjh: prrc + ldlt +ttrt: 4 +ctrv: 2 +jdzv: 6 +pbpg: 2 +jtsc: gpjc / nrcz +glwd: 18 +tstt: zbzs * zzlb +gdqb: nqnv * qnpg +vlnc: msfz + pgvw +znpt: vnwb * jtdr +jhwc: 4 +qhlv: lrhh * ntdb +lctr: 3 +tswc: 3 +gtgp: sjgz * dbsj +zwnl: qvjp + jhpn +lgpt: jtdg - mbvj +tcbp: 2 +bjwf: fvwf - hjjd +cvzn: 3 +pqqd: ljbw + jsdl +gdnh: jvqq - spjj +whnr: 13 +qddm: 3 +qpwq: dvfn / gwhz +szfr: 5 +cbfz: dszf + nfmc +pmdb: bsvj * mqqg +dznt: pfcl * tcts +lgsg: qvhh * dtcn +mdzp: 3 +fcjv: 6 +bdlp: jjjm + hpzz +zhrs: hvnj * bmjr +ngnz: 2 +clpj: wcdg - srml +npjm: 3 +vfnt: cpth + cwbb +ldll: bmnh / zhrf +dvst: lqzt * rfjz +tblh: 20 +vpvs: nhqc + btgv +dtqb: 5 +djdt: fzpz * vhbz +hpcf: 17 +zfvc: 9 +glmv: pbrl + hqwr +crfq: 3 +jzrl: 3 +ndzf: pldm + qvfg +twml: 10 +hbzb: 3 +llwt: mwst + gtgp +brnm: 3 +hzbg: fvbf * sfbf +cflr: 7 +jgzj: ztjq * sznf +gjmn: qdcn * gbpm +zjpq: 2 +vntg: 2 +zhnb: 5 +zvzb: 4 +qggg: 1 +ghdm: 2 +gwlf: 4 +tqhb: mgjb + mwnm +lmwv: sqjm / ppgz +tbnn: 14 +gbcw: hrwd * vcqz +dzzl: wltr * vljn +mqqg: rbvv + dvzl +pbdp: rpcp + nlsh +wcst: 3 +qfcn: 2 +vdtd: qfrh * rqlq +bhnm: 2 +vqlc: fvpr * wfnt +rshw: cnfd * vwfv +gdbn: nlbv - shnt +gzpt: jqgn + swzj +qfqb: 4 +srvg: fvjc + rzdl +qzpd: bnfs * zpvm +mfrv: 2 +bpfp: 2 +msgw: 2 +jqql: rhwf * gmbl +mmcp: 2 +rjbv: fcdn * vplt +pgsc: gdjm / sntl +wzbr: 2 +jrpl: 3 +tscf: 2 +wtqz: zhbf * twgp +nnrt: vfhp / gnbn +cssz: vqhh + bmds +gmdz: hphs + rnvf +pwhg: hbbd * qqll +zznw: 2 +slpb: 2 +clwj: 3 +hdbf: mmzp / sbfm +tdnq: 3 +bwnp: whwz * mfjg +jpwt: wsll * ltwt +mvld: 4 +crjq: 2 +qhwf: lgjp + pjdd +nrcz: 2 +wggr: 3 +lmlc: rfwq + nfrv +hwmz: 13 +snhg: nbzn * mlsq +twzt: 2 +bhvm: rcpd + ncrg +zqbz: 8 +lbvl: 7 +nqfq: sdcq - tnpn +dcrf: 5 +rbmv: phzm / vlgs +svfg: 3 +ttrs: chnw * wghb +qfjr: 15 +wsll: 3 +zmwq: 6 +hcvc: 4 +gpvt: rnls + twwc +pmjn: bdwh - dqdb +hsll: znfl + hwzq +dfbn: 5 +vvcf: 3 +wjbj: 9 +wjsq: 3 +zjtf: 2 +qfbn: ddrp * qhdc +mbcw: 5 +ztds: jmwv * gvmg +pmtz: gtqt + nfzm +ztst: ndzq + ndds +zztr: 7 +znbq: 1 +bsbh: cjns / cvpv +lrmh: shwb * grhg +ljwm: 5 +fmht: rwgb * sdfd +dzdc: 2 +ctzn: jglt * jlnt +dnsd: zzld / flsg +dmlh: drbc * lsdm +qbbw: 18 +vsqz: dflr * tblh +ftss: 5 +gntf: dnmm * wvss +hrlp: 2 +qgpm: 2 +hqwr: hhmn * cwvr +bhhj: 2 +vmss: 6 +sqmf: 3 +pscb: cjfc * sjbq +wvps: zjsb + jbnw +fsfs: bmsr + nltq +gvhf: 7 +fnbg: 5 +pjwn: 4 +nwpp: 2 +mdnv: ghpn + jpnn +rwhd: rnzp * whbg +twjm: fghf + btjt +tvtg: 18 +vplt: 4 +cflt: wtzs * vvzb +hqcr: pczl * nnjh +tdsq: nwrd + dtzc +zsms: 3 +vjpt: 15 +cmgw: 2 +hmhn: 16 +jvqq: qzhj - wwwf +fvzg: strg + jpnr +wmvs: hzvv - fbmp +pgrs: 4 +bbrn: cnpn * htrc +jsnc: phld / gvhz +wftp: 8 +mmfz: 20 +zzmg: 6 +scnf: mfrv * mlbh +bdqh: 3 +jtdr: ttrs / fdzp +pwnn: 10 +qpns: bjwf - mhvw +nqhg: bszp * qmmn +tlzs: 3 +bslr: vzlb - wwmm +fpsb: swdm / brvg +znll: 2 +tjjc: tdff + zjmz +fdlt: 8 +nvhl: 5 +rzsb: ggzt - dwmq +crpm: dcjz + tfgm +svvz: 4 +qznn: tgrj + lsnr +nvpl: nhvw * fvqc +tqls: 7 +czvp: 4 +zqnt: 11 +jshd: 2 +vtzp: 2 +jpjf: 3 +sgcw: qszs + qtzs +cwnc: llzm + strj +wqhv: mdmw + prjv +jbwg: 18 +mmzp: whcg * ttth +vwpn: 2 +qzmj: 3 +ncgf: thcl + prwj +blgr: 3 +mncv: bwwh + bhrg +slwq: 2 +pfzz: fvcg * djzp +mjch: vlms / dlqg +mghg: gmmn * jhfq +fvwf: qqcs * dwmd +jltj: gctw - hfsj +bttc: 11 +wbzc: mbhj * qlmw +hgqf: 4 +qcpp: 2 +tngh: tpjl * dnhb +bhrg: 6 +bwdg: 5 +pwbl: wlzt / snvz +dpgz: 2 +sbsb: 2 +rgrf: wbrl * tjmq +hmhh: mzsg * cmvw +lwmw: nchj + zvrv +vssp: czjl * qrqt +flpm: 2 +dfqr: nrpj * lchz +rnnh: hqsq + tsrt +thvd: qdtq + gcdj +pcpq: znfq + rjqj +zmsr: sgbp + nnrt +dvjp: 3 +dhpj: ndzf + jhjz +hpzl: 3 +csdd: wpcs * tmvw +mbmd: 4 +cbnr: 5 +cfzl: 4 +cjwd: jpvc / bhnm +fvdd: hbdz + fptg +hjnv: vwhz / gsjp +glmg: 4 +ljbw: shsb + lhvd +thcl: gvsp + shrc +zbtt: qfrl + prgw +dbch: 2 +chnw: 3 +gshw: 3 +vhff: wsdc * jwsn +hrpb: 5 +vdrc: bfdj + nzql +rnmc: dztm * wjsq +rpgs: dnrv + djvb +tstm: 5 +jngt: 2 +tltg: pdsl - vprd +fmpw: 3 +qqll: 3 +pgvw: 4 +zspd: tcms + wjqg +bsdf: gwsw + hfcm +jvgg: dhdq * tpqf +ttsv: gwws * sllg +bpfb: tzhq * wtqz +dnhb: 13 +sdqn: ndmp - dzlh +lpnj: hzns + ljcc +qscf: 2 +twwc: qfcn + btpj +vprm: 2 +cstf: 3 +cpnn: 16 +prjv: 6 +fhtq: jhwc + hwdc +jqgd: dfpz * zbzn +qmtw: dsqh - cfdg +mmwf: 3 +ptzv: 3 +gwtf: mhnp * zlvb +dwmq: bbrn * cbtq +twgn: gwbm * csjj +wmhp: 3 +dglq: qvjl * pnss +clvq: 2 +nqhc: 2 +ngcc: svsp * cfzd +pgwh: ltgp * wzdn +mmjj: lswr * lnfd +jrdz: 2 +jgzn: 5 +vgwp: 14 +wdzn: 14 +rjqj: trtn - ddcr +lnfb: 3 +phwt: 6 +fvrt: 2 +pbnl: cltn * plsg +vvzs: 2 +fbdr: szhm * jnth +rsrm: 3 +fnnn: 1 +jrzg: 7 +tfct: 3 +wrrn: 17 +zbcd: wtlj + tjrd +pmhg: 3 +trrw: 3 +flsh: 3 +tchj: dhjs * mzsr +fvqn: lcwf * ghtz +jjfl: tvtg / tlvj +dzrp: 3 +dqpt: 3 +fsvt: 2 +lzlv: 3 +bngh: drst + bvsq +jwpq: lmcb * blnh +lvcl: 11 +qzss: pmtz * pdmt +pfqb: 5 +qqgl: 5 +vnjr: 2 +phld: rtwh * vdwd +qvjl: 3 +dqph: 4 +zzcv: 2 +whph: fztz / wffl +psbb: 15 +vhdj: cddq * dcrf +mflz: 3 +dztm: dgfd + pwnn +jtvr: 4 +lgcb: hllz * dbfj +ndmp: ctbh + jbqh +gjzm: 14 +fvqc: 6 +nlnt: twbv * tngh +cfdg: 5 +mcvg: jllb / zjvc +lhww: 2 +vhtf: 8 +vnqz: bzjd / qfsc +qmmn: 20 +qfpz: chvg / clvq +qqqd: 19 +tqrn: ggnj * jwqd +szzb: flgg - vvzt +fvhf: 2 +qncv: tbnn / lqrj +hwdg: zwtg + ljhw +dtcn: 3 +ddcr: vlnc + szfr +vwfj: swdn * ljlj +fztm: 2 +wcdg: gwvz / lbvl +plsg: 3 +snjv: 6 +qpww: pqhd * vvcf +ltfn: 3 +csjj: fjhq / mfbw +ffbc: 4 +nqhv: 5 +ljcc: 2 +tgnc: 3 +bsvj: grbv * prvz +lmwf: 6 +rfvf: 4 +mbsb: bmpb / fjvz +jnbm: 3 +qdqq: 8 +wqjh: hgqn + qldc +fgdn: 2 +rptv: 5 +ljmb: 8 +pwqv: lrpl / fgdn +htvv: zhrs + frrf +hnlg: 16 +vpcq: 3 +rnrh: lvsv + nhvn +nnff: rdms / hzws +fjmz: fgwm + dphq +sgbp: 9 +mhjd: tllf + bnhb +fqcb: 2 +wsgr: wwnh + vfbl +gpjc: fwpt * lbnb +qwlf: bsvc * tfbb +bjbv: 2 +hfjm: qwzw + fmwr +mchq: qclp * lcjz +qgcj: 4 +cqrz: thll + rfwf +wmnc: 5 +hflc: 7 +tfdn: 2 +mwnm: lrzq * jzmv +jlnt: 2 +hvdn: 4 +rfwf: 2 +tbdw: 3 +gdrc: 1 +brmz: 1 +nqsj: 13 +dqmw: 3 +bphw: fmjh + brlc +cfcz: mshv * blcv +prgw: 4 +wltc: 3 +wntb: 3 +hczr: 11 +vlgs: 2 +vtfr: sczh + cdtj +zcdp: dczb - vjrq +twdv: 5 +tgrj: 5 +lzbw: bdtv * bvsp +jvmf: bsts / qvwl +prlq: tfdn * mpdb +vmsn: 3 +fspn: 17 +tcbz: qjdw * tqrl +dpdh: 5 +dnrv: hphq * rqjj +gtvt: ftss + bvcm +zvdt: jzcf * lhmt +rwll: bsbh + pgdw +dcfn: jgzn * crgm +tlvj: 3 +fjfv: 8 +tnpn: 4 +qfrh: 3 +mscj: hlmj * bvmp +wvrv: 3 +zsvm: 4 +nfmc: 3 +pgzq: 9 +zfwf: 18 +rmgw: zzcw + ghpm +shzl: 4 +lcsz: 2 +flbg: 3 +zbsf: zhbc * qnwb +zfzv: 5 +gwhz: 3 +vhbc: thwd * cstf +hbnt: 4 +plgf: bzfq + fbjd +qmzf: 5 +qqcb: mwtp * vqlf +gvwb: lzdr * mmrb +nchj: 7 +jhhv: 2 +pnhl: 1 +qsrq: 10 +brlc: tptq * dbdm +nlzw: 4 +tqtz: 3 +gwbm: jtjv + qssl +ngtq: rmvg + rcmr +wghb: vhff / flpm +nlbv: gqtt * lfjb +qcvs: jvmf + spfb +wmjj: 3 +vvgs: tmlg + qdmn +fmcq: 3 +mhpq: lwmw + mndz +jqhf: fnzl * hcqq +ghtz: gnpg * pcgq +fgvz: wbjz + bpfb +tbwz: 18 +dbwr: 2 +qssl: 16 +hzps: 20 +gqtt: zbfp + npdq +jwsl: 15 +bfhs: 4 +wsrd: jghv + rjbd +wmth: dfhb * bhws +gzvd: ghdm * jqvf +plnq: qqqd * jpjf +fvws: 3 +vzlh: 5 +wvss: 3 +sntl: 2 +ldlt: 2 +hhth: ghfs + jvgg +zzgp: zqbz * lmwr +zngq: 1 +pzfv: mhhd / tmst +hqsf: lrmh + ghrw +pqls: qrmt * jrdz +mzmw: gnnf * qhwt +dfmr: dzgl + fjqc +tpnr: hjzj + fqmt +swdn: 5 +lchz: 2 +qwsr: 3 +humn: 3116 +grvz: wlwn * fpjd +bbbz: tqlh + gvhf +bqgw: 3 +bdmh: 3 +rqbn: 4 +srjc: cqsc + gllb +mczb: 11 +hqpv: 3 +rchh: gmdz + dbgc +lpld: 2 +qqzv: 11 +blnl: 5 +qnpg: fnnn + cdhn +mlcr: bzjj * cvjb +mbvj: 1 +tdgq: 8 +wlds: hlmp * trbp +bswm: htcn * nlzw +zbvq: 3 +zrhz: nsgn + hvpt +npqv: 17 +fgvw: 5 +hsls: 14 +ffdq: dzsp * mppg +vfrr: 11 +mnfw: 2 +gbpm: 3 +pfsr: 1 +rjbd: 5 +qmpz: 2 +hjqc: 4 +svrm: 5 +whwz: 3 +tgmh: 2 +hcvt: 5 +zrvg: btwf * qwgt +bzjh: 3 +wzzq: mpzw * cfvr +wvcl: 2 +jqgn: wqhv * tvzz +nvwv: lsdh / qswf +tsrt: rdhg / gdfl +frrf: 5 +qtzs: tpjm / sgqp +mhps: bnld + wtzj +mlvf: 5 +qszs: 7 +zvbl: jqbb + jbwg +cbhv: mbcw * zbvq +hjnp: 3 +drbc: 7 +fvzm: 5 +ssjw: 3 +dwmd: mjcf * sqrn +sbpl: 2 +rqwq: zlsj + lszh +vvmb: dfwp * wpgz +bfzt: 2 +lpwg: wtvs * fjsf +mhrp: 2 +jqbb: wmdf - zmwd +sdcq: 13 +mwrw: hzsv * gqrc +nlml: bprr + slnn +srqs: 4 +dtgh: 5 +ffjg: llhz * vpdd +mpvt: 9 +vmrz: mjzj * mbsb +hmvh: 3 +pltc: 2 +vtms: 4 +vmzq: 7 +wqtt: 4 +bzfv: 5 +mtgf: 13 +wpbq: znrh * gqbv +mqdq: hfdl * dtqb +tvpf: 2 +tppd: rlqb * sltv +zpvw: ggwn + rwpd +gllb: 9 +fvqq: 5 +zbqq: 2 +wzdn: 2 +qlgh: 17 +ttth: fjfv + rlfh +nwlj: 15 +lrpl: hvvm * cfqc +wjbz: bmdp * fztm +jzgn: vrqq + zcnc +rzdl: 20 +gcjc: 15 +qdtq: wfsl + rvfm +gmbl: dvjw + ggfs +tngp: bbhh + jblw +lsfl: mnfw * ljrh +blnh: jtwv + dffb +zjfq: 8 +rhwf: 5 +ldjl: whft + hzlw +cbsh: crfq * vqrc +tndg: 2 +zpvm: 2 +jtwv: 1 +jcwt: dwtv * wbmh +frrl: 2 +hphq: 2 +gfts: lzdv + zmwq +rhnq: qlss * dsmg +bsrm: gcdw + wqtm +qdtj: srqs + sfcf +ddrw: mmpg + wptg +bjnj: 4 +gqrc: 7 +qvjp: hbbb + wwzb +hrrj: 3 +crgp: dqzj * dbch +trbp: 11 +rbnb: 3 +pmtj: 2 +jlmw: 13 +sznf: 11 +lfht: vzlh * zmsh +qzds: 13 +bnfs: wmqt * tfbd +bwrf: 2 +rcmr: 3 +dllz: wdzn + trnf +gqqp: 1 +sszl: 12 +snds: dvjl + hmzs +qzhj: sclb * qhfr +bzlb: 2 +tlnz: wtzv + plzv +zlvb: 17 +qbbq: 20 +lswr: 3 +glhd: 2 +hjwl: 2 +rdbd: 10 +zzhj: tlnz + gjbb +dnft: bfbw + gslf +zmzv: pwvq - zfdt +zlgv: vpcq * phst +jwwn: 6 +mhzg: 6 +rrmg: shnl * cctt +ftwd: 7 +sjbj: rphq * mjch +lrnq: glnb * qwsr +qfsn: znld - pmdb +lrtb: tstm + dgzz +qswf: 2 +tpbs: 6 +hfsb: crmm + vfvl +wmsh: gjtw * crpm +jcfz: 10 +ppbm: qppl + tsnm +htzc: splh * pnfz +sqjm: jlrh * qdcl +lpjq: bwdg * lhqq +nwzg: hfjm + znbq +nglr: dhdt * mpvt +tpsm: vqpl * zscm +lbld: dnsd - gbcw +thtd: 2 +sbdl: zjzp + jgpw +cvjg: jzlt + jtjj +wppc: 7 +lzdr: 5 +vvgr: rwtt * rjgb +bzfq: zfzv * gswh +hwdc: 3 +phsq: 3 +mjtj: gcjc + sjjq +hzqp: 4 +zwtg: 13 +dgqm: tmwd * qnqt +tbln: ppzp * pgnd +ppsj: bwnm + rdbw +qcsn: 2 +gnvm: hnlb + qthh +jmws: 4 +csds: 5 +wlwn: 11 +vsvb: 5 +bmnh: zgss * mzcr +pqjw: jrpl + nsrc +vbrn: tdns * pvgb +gwnj: llwd * dpdh +cnqg: lzvb + rchh +gzbm: cspp + tbbl +hzvv: 14 +mzqv: 4 +dnmm: 4 +crmq: hztr + vzmc +rdhg: hdsf + wjwl +hshj: qzss + nlnt +fdnh: 4 +lszv: jlzc + mqgc +dnsv: 1 +tfgm: nrnn * tvcf +mndz: wcst * tscf +ldbf: tvgc + tpsm +dprm: gdsl * bpsf +mhhd: shgj / lmch +qvjw: ggwv * sjtb +cjzz: 3 +hwht: rnzm * fsdf +pcgq: whnr * vprm +bzrn: sgcf / ldpl +jjrh: fhtq + nvpl +gdfl: 2 +dmvp: vdtd * zwjv +htjr: mcvg / mnzt +ncbl: ddjm / vdst +jdhh: dmhz * pgld +tpqf: nhsn * bfpl +gwsw: 13 +dvfh: lqdw * hrbb +hgrb: 5 +lvsv: hnjf * zsms +hlbh: rspn + jcwt +dbmn: 3 +fjnl: cbmr + zcvz +fmln: tpjd + fsvt +ldps: vjhb * dqnh +cqfq: fjbm + zrqj +qdcl: bmjp - gdqb +vwrj: 3 +dnjf: 3 +zjsb: 1 +njmc: 3 +mzsr: 7 +hdvp: 2 +lmch: 2 +wjqg: 2 +vnwb: 2 +twgp: 11 +mqpd: hmln * qcvs +ldmb: 3 +fflp: 4 +bnhb: 3 +jmpv: jszm * dlbp +qggl: 13 +jsdl: 3 +czgd: cdjd / vlbb +hgsw: 20 +zrmn: 3 +gzdb: 9 +jbft: csrh * gvms +wdrb: 3 +fzpz: 2 +bprr: lhpp * qbbq +hcqw: dtgh * tvtl +dtzf: 6 +qspw: 10 +vgzv: 2 +bvsq: jjrh * swzq +stvw: 5 +zhwq: wdrb * mdvp +frwg: 6 +fbjd: 4 +vgvf: 7 +rltp: qppn + ldnw +fztz: fwqg * fspj +lsdh: twcw * gzdr +mwst: gjzm * srgm +ndhv: 3 +jgjl: wjbj + vgzv +mmmw: jrzg * lwrf +hzhn: 4 +dvjw: bggp + zgfh +tmtw: 10 +jbqh: zsww * wqjh +ljhh: 19 +vqlf: 13 +rncq: 2 +ztjq: 2 +jqmp: 4 +mvql: hfsb * gthl +vcqz: 9 +lnfd: ddww - qpwq +dczj: hgjw * qhwp +fwqg: hgmq + mqqq +chqt: 2 +vpqj: 2 +wfzm: vnqz * nhmm +vzmc: cqvm + dcfn +rsvv: tgrb + lpbz +gwqq: 5 +gctw: tgnc * ldjl +zbsp: 2 +ctnp: 3 +ndgz: 2 +lqch: cvzn + wrnr +svnj: 1 +pzjw: 2 +jzwp: 2 +gnrm: 8 +wmdf: pfdb / mgtr +ljvs: zqnt * rbmw +qppl: tdhb * jrwg +fvml: gzbm + cdhm +zhbf: 5 +rvfm: mncv / glcj +cbtq: fvcl * mjvd +tgsl: 2 +djnj: pbnl + nfch +lmcd: 2 +rvlp: 2 +lpmr: mjtj * gbft +hmtb: qsjg + djdt +tbrg: nsmc + qsrq +vbqr: plnq * rvlp +smhl: wlnt * lfqs +gtqt: mchq + pbdp +fffz: vpbq * dhqm +rtqc: 2 +wsgj: 17 +fjhq: dfwn * fjsz +stfd: whfn / jdpl +fvlq: 4 +dbqh: 4 +tvwc: hsll + jdhh +nbzv: 2 +gdjm: rpbj + lfht +fnzl: 5 +dbqf: dbqh * sglv +ndds: 2 +chvg: bngh * jlwn +smjm: 3 +dsmz: 2 +gjtw: 2 +sbmn: 3 +hmzt: hvgm + trjz +mpsf: 2 +mjml: 9 +nrwg: lrfd * mlqn +nltq: 2 +fvmv: 2 +wsjv: 9 +pqhd: fnfl + wjgb +dvpt: zqtj * vtjd +dzgl: qcwd * zspd +mmqq: 8 +bggp: 2 +vmfn: 5 +tnmq: lqqv + fzfs +wbqm: 2 +vhgn: qzqg + rllv +hvsr: ljwf * hhnd +gvcc: 5 +bhqt: jrzz - fnbg +tdns: cbfz - sbmn +qnwb: qbcp * crmq +vmnc: 9 +jnwd: zmsr / vpvg +hmpl: 2 +mgtr: 4 +wvgd: 7 +qzjp: 5 +ngml: 1 +qvhp: tmvh + dwcj +gpht: pcjt + vmnc +hlln: 4 +vvgf: 1 +zcnc: 4 +hzlw: hdvp * fphj +cjng: wgst * qtzl +tbbl: stvw * zrzh +slqc: 16 +tvcf: 4 +lwrf: pjzg + dtzf +fnld: ftjv * qlzj +sfsz: 2 +dvjl: 13 +fdqt: 19 +crlq: gvnr * dfqr +sjbq: 2 +zhbc: tdsq - slsw +ljwf: 3 +fspj: 2 +wjgb: shrr + wzzq +bjvz: nnjn + qbzh +rzms: 5 +qjqr: lvgq + rqpl +lrdc: mztc * tstt +rvbl: qzrc - dvwv +rjcg: tbln + cwqh +prvz: 2 +zqpr: 2 +mptj: nvmp + vhpp +szrj: 3 +rvjp: 9 +sfbf: wggr * lmpn +tvgc: ppqb * chwr +znfq: wzmf + fmgl +rdms: lwzh + ftng +lhpp: 7 +zgcc: wplg * smpn +trnq: jmws + ptzv +dqzj: zzcv + lzbw +ddjm: vnbj + njfq +bdvs: gflv + vfnt +wqwl: schp + pjfc +djvz: 3 +brvg: 6 +qjss: ghzb / qznn +nsrc: 15 +ltzg: 3 +wglw: qhzf * tbhh +vvzb: 3 +fphg: tpbs + trnq +gvms: 5 +hpzz: 3 +vtgj: 7 +jhgf: zgjq * wnvz +rrmq: glmv + zhfb +dbsj: wmnc + hwqb +gtls: gpvt - rnjp +mhvw: vztt * bbbv +svnh: 2 +jlwn: 2 +jtcz: bfdr - zzmb +hmjc: fqlf + gfts +sszc: qjtf * trdv +qvhh: mqlz - rbcj +pdvs: 18 +nhfv: dlrg * rqtm +smwj: rszt + qdgn +gvgp: 20 +dwtv: 2 +vdjr: ljbb + hbfw +znmj: 1 +lnrs: 1 +fwlf: 3 +gdmq: nbhp * bwrf +jrzz: dmrn + vhbc +snng: 2 +qgzw: jngt * jvmt +lzvb: sjjj + mjgv +jnlm: 3 +hfcm: tfwz * hrsf +csrh: 3 +lcjz: 9 +fvtb: 3 +pdch: 2 +nnpg: scsr + dglq +lntz: rsrf / btgf +lpbz: sqrf * tzgp +ddrp: cwzh + trzl +qfhq: 3 +gtmb: jbft * twtf +fjtz: qhnn + ndhd +nvdl: 3 +trjz: 5 +hgcf: dbhn + hzqp +hblp: 3 +hrpr: dprm * scsc +pfdb: mscj / sthr +gzdn: 6 +dhjs: rdps * hhth +wvzw: 2 +hqfr: 1 +lfqs: 7 +qfsc: 2 +fzgh: dhst - dhbq +flgg: dfzr / wwzh +qwpf: lqlc * shzl +cpcz: 4 +wwnh: 5 +tzsm: wzwf * qdqq +qnlg: ggfw * ndhv +shjm: cssz + mbzj +rnzp: 2 +jjfn: qprn * trmw +qrlj: qsbv + ccss +bbbv: wrrn + wcbl +mzbb: ncgf + pzpf +fwpt: lhsj + fjmz +rqtj: fcjv * hgsw +vltc: 3 +thll: lczh + ttsv +bvsp: 5 +dwnj: drzc + swfb +pzqs: 5 +shbj: fdlt + npqv +hrvs: hhrh + tfcv +bwnm: 7 +mfjp: 7 +vjjh: 8 +mvzl: 3 +dblf: lrtb + vbvh +ssnz: bhvm * ztvn +qnmv: zcdp + qqzv +shrr: 4 +svzg: znps + hvsr +rgjv: 2 +jwmt: hggp + zsvm +rmpc: 5 +gfpg: 2 +prsj: czjh * dvps +qhhz: dvsp / bwsz +zzwj: 4 +hzns: 12 +rdps: dwwc + zhbt +lmcb: 3 +clws: hmvh * mmhp +nvmp: 17 +hzcn: 2 +zqsd: 8 +mlsq: 3 +hhss: 5 +dlfc: 3 +ctvj: 3 +gwlr: 2 +shgn: bdcr * vwlz +wvts: 18 +llvb: prlq + psps +vhvt: zthb + zqsc +fttf: 3 +ncmc: jgdp * bjbv +nfnf: 4 +gdjv: 3 +mlbh: vwbw + ddrw +lqrj: 2 +qdgn: 1 +ljbb: mqpt + bsdf +cspp: hszv - hrfq +hbdz: lcbg * fwrq +wlnt: 2 +lbrc: zjfq * cctg +frld: 3 +nnrn: 3 +nnjn: pqqd + pjdn +ggnj: 17 +bqpb: qwfd + jqgd +cwvr: mbgw * wzlh +hcsm: sbjr * bcrw +nhmm: 3 +nfch: zvzb * cpnn +pmrz: 2 +bjtf: 4 +hhrt: 2 +dhqm: zlbr + swfn +znrh: 4 +hgtd: clpj / qhrl +qjml: 2 +jgvc: tlmf + smhl +zbmz: 2 +jlrh: 3 +jpfb: 16 +nrcq: fdnh * mzrc +vwvr: jznp * twzt +vvzt: 6 +vtnc: wwnq * lmcd +mdcw: chlt - ncbl +ttgl: 2 +wltr: nqsf * wtjm +qlss: 4 +tmlg: dbjs * vhvt +jpnn: 6 +jgpn: 3 +tcgs: ntcd + wpbq +mqlc: 5 +vhvn: lbld * fmrf +fpwq: fpsb + bwjb +ghrw: 5 +lbdj: gbvt + vbqr +cdtj: 3 +cctt: mlch - wddt +nhpb: qfhq * nrsh +lhqq: 10 +qvwl: 3 +plzv: 2 +pljz: tnqd * spvj +crlr: ctcm + tbrg +pvsv: rltp + hgtd +mfmp: 3 +svnq: rshw + lrdc +bwbt: 15 +rtdl: nnff - ssnz +nldm: 17 +whbg: 3 +dbnq: 3 +lthz: llvb + flzc +vnmv: 4 +mrpc: 3 +lsnr: 2 +wwjg: dwtq * rmlw +dqdb: swlc + lhzz +ltjt: 2 +mdrm: 8 +vtlr: 5 +jhfr: 2 +mzlf: 4 +fbfr: 2 +vbjh: 4 +wlzt: ddtg * cgzc +wrbs: 1 +zhbt: 5 +tqll: 3 +pjfc: 18 +jftn: 2 +jdhv: 8 +zqtj: 5 +nftj: jmrs + mlld +jwjt: lhww * rczc +hzph: 2 +bfpl: hdbf + tqrn +rbcj: fcgz * mdzp +zdpm: wbzc + bplm +ljlj: 3 +dcjz: qmtw + jhfr +prwj: 20 +wcbl: 15 +hrwd: cjng / jtrz +dzlh: 7 +pfcl: pwbl + zhvl +srjv: pwqv * lcsz +trzl: 7 +hzsv: tpnr + mjvq +qdqj: 3 +wwmm: cmgw * zcns +cnnq: 4 +gdpw: 4 +rnhl: 3 +cgmn: lhjh / fvrt +gqbv: svtd * dcgb +hcjn: 3 +wzlh: 3 +dhgs: pgzq * fttf +sgqp: 2 +fnsm: bzlb * rbgq +lmwr: 5 +vcql: 8 +pjqb: 3 +wptg: jjfn + rdtm +jghv: 2 +sjnt: hwht * lvzr +ghht: jfrj * mfjp +cwbb: qbnz + ljvs +vvpw: 10 +ntcd: lqzz * sfvp +jzss: nglq * ctrv +djrb: rzph + mbvv +lzrm: 10 +vbcp: vjpt - vltc +mgcn: lbrc + zbgm +zvft: rptc * lfcj +bfbw: qzpd + qqcb +tmvw: 2 +vprd: 2 +jwvr: zcwv * dqqp +chbl: 5 +sgbl: qbqw - llzd +jftv: 4 +tdhb: wfbf + rbcq +vbvh: rzdw + lmlc +fmgl: 3 +qsjg: cqrz * qwjt +hczq: bzsb * mmvt +hhmn: 10 +bvff: vtdz - qggg +qwfz: cbsh + fnsm +dffb: dncn * gshw +cpvb: 5 +ppnm: fppg / lgwp +zgfp: wglw + bwbt +rzvq: hwrl + jwzl +zrhq: frrl * czwr +gjml: grzh * jqjz +djhv: 13 +bhph: gzvd + wrbs +vdst: 2 +vvfz: 18 +bvmp: rzhb + csds +pzpn: qwpf + nvdl +qhdc: jgvc * mzwz +jpvc: btcl * cvbr +gnqz: 3 +cwcq: jddd * qsdz +djhh: qrtc - sqfh +spsr: 20 +zbzs: 3 +zfmm: jtsm * vgwd +ttvw: 3 +hzvq: 5 +gmmn: pgrs * mmcp +rwfv: 5 +mgjb: ndbz * zrrn +lqlc: 2 +vmjg: rswf + bbrp +wwzb: rnrh + hvjg +fpgl: 5 +tgmn: 2 +dhdt: jhsd * rptv +bplm: srdw * jldf +mzrc: 9 +nzgq: fphd * jssc +wwwf: nvds * tndg +hbfw: nnwj * qfqb +rqwc: hszt + frld +dsqh: mcfm * hjqc +cwwn: 20 +jqvf: lvgt * trzs +qwfd: 3 +zgzw: 4 +twcg: 2 +ppzp: wlds / bpfp +brjz: hnvn + htjr +jgpw: 9 +nvjg: 3 +jtrz: 2 +mvgh: nmsg * zgzw +dlvm: lsps * wzbr +ggzt: plbm * whph +fvcl: 19 +fmmh: tzld + sqjd +nnwj: zjlc * tqll +jfrj: rqhr * bbbz +zdtm: mfcn + trmh +gqnm: 2 +ggqm: mlvf + srjv +plvh: 3 +nrtj: 7 +vhsg: 4 +pwng: gjml + dqrn +wpcs: zjtf * qjqr +hqlv: nqwc / cpvb +hfsj: fwsb + vtlr +nzsl: jfnq * bqgw +gccm: 3 +qctt: 2 +mdvt: 3 +jrtr: 2 +zrvw: gdbn / bbbr +qwlj: 3 +drfl: 4 +nhvw: 2 +zcns: qvjw / gfpg +tqlh: 8 +zcfj: 3 +ddcv: gdpw * pbpg +tzqt: rfbb + hcqw +hcsf: 3 +jgnq: dzwb * cvjg +lfqg: wwfg - bwht +hlzh: lltn + mvwl +mqpt: lmvt + hqpf +smpn: czmc * hhjd +dlbc: bdmh + zhtl +rbcq: wzdd * jpfb +tpjm: wrdz + mfgv +drmd: 5 +mpmq: 2 +gjbb: nzmg / pmjj +ghfs: dfmr * hzbg +twtf: 2 +cqsl: 4 +nnpm: 4 +dbdm: 3 +jhfh: plgz * dhgt +wdgg: dcfw + ncmc +jfnq: gjbq * hrpb +gslf: djln * cffb +tjmp: pdch * wpms +twcw: mvgh + jmhp +npdq: wljf * zhww +lcsh: ffdq * zdpm +tngz: 5 +bmjp: qswh * vwdp +zrqj: mqlw * zhns +lbbz: 4 +fjmf: zzwj * hqtq +hrbb: 2 +fvbf: 2 +hrzt: 1 +bwlj: 2 +mfjg: sbdl + rhzh +trmh: 4 +dmnf: 2 +spjj: 7 +qhzf: 2 +pqsb: 11 +vvvv: 13 +pnfz: qnlg - qgcj +tjmq: 3 +snvz: 2 +rjfs: 8 +zbwz: 11 +jmwv: jcjt + zmnl +cvpv: 2 +nszt: 4 +grzh: hzhn + gccm +ftll: 4 +zzmb: wthn * lgdg +qcrp: bsmb * jppb +bbtl: 3 +qchb: 3 +cmsv: bbtl * nftj +mzcr: vvvw * nppj +gbgp: 2 +sqnw: 3 +hphs: bnjc + rqwq +zzcw: 3 +nglq: rmgw - hdgg +jlrq: 3 +gqst: 2 +dhgt: 5 +mmvt: 2 +sptm: tjmp * mvgs +pdnq: 2 +hfdl: 4 +ltwt: 3 +jsql: vmzq * jgpn +cffb: 10 +fzfs: lqch + cgll +wtzv: zvft + nzgq +wrlb: 6 +wzmf: 14 +hvtr: 3 +hlmp: 2 +hmln: 3 +rsbn: vtfr * gqwt +mjmh: tzsm + mmtz +rnjp: vrgp / pzjw +qzpj: dpfm / qmpz +thbq: 3 +mbgb: plgf + jpwt +bblj: 5 +dwcj: wqtt * tfht +cwzh: hrgt - qwfz +whhr: jcfz + zztr +fsml: 12 +shrc: dzrp * wvgd +dlbp: jhzl + hflc +mmhp: 7 +nwsv: 3 +bvqz: mrdp + rrqw +jjjm: 4 +nwfq: ctfn * zbsp +zqwb: 7 +llwd: bjbn + wvts +rhzh: qvdr + hmfb +bgft: frwg * pzdj +bcrr: 2 +hvvm: 2 +qdgv: 2 +rdsr: 5 +gcdw: cnsf + tthz +pcjt: 2 +ttfr: 6 +fnfl: hsls * hbbs +rfbb: bfhs * qjss +pgdw: 1 +rqtm: 5 +mjzh: 3 +bbrt: 5 +djcq: 9 +mbhj: pvcm * hshc +qvzq: 2 +wshg: 5 +mzwz: 3 +jrzn: dbwr * mzlf +pnbf: qzpg * fffz +pzdb: cmqs * zbdg +sqgt: ddrs * blnl +lqlq: ftqz * qgsb +btpj: tjmn * tgsl +nrpj: 3 +pwwq: jnlm * gzjd +bmpq: jwsl + drfl +wzwf: 2 +dfzr: bwlj * drzs +wljf: hhjc / hhrt +cmtn: wjpm + bbpn +fdzp: 3 +qvfg: dlvm + hzvb +bpsf: 3 +ppgd: 16 +dcfw: 1 +cmgn: 4 +phwz: 2 +jrrh: 2 +mmvj: wsgj + bjnj +qssp: 3 +qcbj: 13 +fcrl: zwhl - jhrl +pwnb: snds * hjnv +vtdz: 10 +ggwn: 12 +jhpn: dhhr + lthz +bbpn: slwg - dzzl +shsb: 1 +dwwc: 2 +wpgz: 2 +wtzs: jtbn + hnrh +rswf: dlfc * lhpq +tqzw: 1 +rrqw: slhl * wmwb +zwhq: rzwt * zmrs +vgwd: 4 +jgph: 3 +hsqh: lbdj / sbpl +sqrn: lmwf + jwvr +znfl: ftwd * sszl +rzdw: mptj / tgmc +rphq: fstp / msgw +bmpb: pdqv * fjmf +swfn: hpzl * bdqv +phhj: 4 +mbpm: 3 +jpsv: smgb * mjmh +mjzj: 3 +mrdp: vvfz * mmjj +vwfv: cnnq * pbzc +dczb: hftv * mbmd +bszp: 5 +lhvd: 13 +cvzb: lrvz + lhtt +hmrv: 4 +rdvq: gwlr * mjzh +wjpm: gnqz * dmlh +dqps: ccht * rdvq +qcwd: lgsg + cfjv +jwsm: sqnw + vbjh +pgmv: zqsd + cflt +bmsr: pjhp * nrtj +tmvh: nqhw * hsqh +mrjw: rwfv * dllz +qclr: wwcz * fgvw +zrzh: jjvv + pndj +mqqq: tbch * nhfv +bsvc: 4 +ctcm: pjrd * fpgl +rldh: 2 +sbvv: 3 +phcl: 3 +rcpd: dmvp - rlqz +nwmq: 3 +mnwq: pnbf / wfjh +sjjq: 2 +jwjv: 5 +ffbl: 7 +srgm: gsbh + fwbj +shvj: 9 +sqfh: bswm * gtmb +jhsd: 3 +qldc: tpdn + rfpw +qhwt: czgs * nnlc +dlrg: 4 +cswr: 4 +ndhd: 11 +czjl: snjv + djcq +rwpd: mrcr - qwlj +dmrn: bdlp + spsr +gvsp: rdsr * wvrv +tcms: 5 +zjtd: 3 +hvjv: sszc + dvqw +mgmp: 7 +qlmw: tswc * qrwj +qclp: 3 +bdmc: ljtc + fmsl +smjc: 2 +ggwl: tzqt * lgsl +vqsq: 5 +mcjf: 3 +rdbq: 4 +mlch: jsql + tdgq +vdzf: wltc * zhwq +nffl: swft / twcg +fppg: ndgg + dmhl +bvmz: 3 +hqdt: rjgp + hqfr +smgb: 17 +qjtf: 2 +rjdq: phwt + twml +mdhj: 3 +jssc: 5 +cfqc: nhss + hmmt +hhjc: zpnz * fvlq +hmlw: 9 +sznj: dwsv * tqls +mmtz: 1 +wtvs: 2 +wmwb: fpwq * zbhf +zbzn: cqsl * bzdh +jddd: 5 +mdvp: 2 +mvgs: szrj * mhjd +dmhz: 4 +djvb: dvpt + glwf +hzwm: 19 +rptc: wwzr * phhj +qwzv: nrrw * jzrl +gqwt: 2 +mnlr: 3 +wsdc: hlhp + zfmm +fvjc: 1 +gsgn: lqlq * tvmj +qvbs: 3 +lhlc: 17 +ncmj: qtqf + fvqn +hwzd: humn - cdcz +nvds: 5 +fstp: tngp / rncq +zqtp: sgvc + brct +mqlw: jnbm * bnbw +lwpp: ltbb * jwsm +hllz: 6 +sgtb: 2 +jdpl: 3 +fmqc: djrb * rtqc +rpbj: 4 +vwvt: 2 +bwjb: hcjn * zwmv +vztt: 2 +ddww: rzfp * crgp +clcl: dblf * wfwm +lrhh: 2 +jcjt: cfzl * blgr +nrsh: 4 +wzdd: 2 +vpvg: 3 +fphd: tbdw * vmsn +vjrq: 10 +zfjz: 2 +rnvf: 1 +ltvp: nrwg / tgmn +bwhl: 2 +tllf: vjww * mqpw +vrwl: mdnv * lfqg +pjhp: 3 +vbnz: 2 +lcts: 3 +lrfd: 2 +cgzc: 2 +bzjd: 14 +czgs: 2 +qgsj: zqtp * dwnj +chlt: jrpw - hgqf +qhrl: 3 +nqhw: 7 +gpbj: cjzz + slqc +shrv: 2 +tptq: 9 +schp: gzdn + rgtn +mght: 5 +hftv: qmzf * ndgz +mbgw: 2 +lszh: 13 +htrc: 2 +jzvc: shvj + svvz +gjsz: 16 +rtwh: ftll + fmln +rsrf: mdjq * rnbq +spfb: zrqr + mlcr +ftlq: cmtn * fgvz +rfcp: ttcz - jvwg +rzph: mdww + cwcq +zhvl: 16 +dbfr: wdmq + mmvj +qhfr: pgwh + tqvc +cdcz: zfjz * cwhv +dszf: 14 +jrpw: htvn * vtms +ffrj: 5 +whcg: 3 +spnb: lbgv + pjwn +vjcg: wbtd - ppbm +lvgq: npjm * zlgv +ljrh: 4 +cqsc: mvjw + lbbz +fpbd: zwhq * bcrr +ncwh: zhjs * pgsc +lhnr: jznz * hbzb +vqcr: 3 +bsmb: 2 +ctgw: 19 +rwtt: 2 +scqr: fmss - ljwm +lsgz: 2 +bnjc: 14 +phvd: 15 +ndbz: fsfs * lrpv +strg: brnm * rcjn +hqtq: 4 +wbjz: hqlv * svlw +dflr: 6 +ltbb: vrwl + pnjg +pbzc: 2 +qrqt: 2 +lqdw: 3 +zmsh: 2 +swlc: pdvs + rvjp +pdqb: 3 +zhcw: 2 +gzdr: 3 +dlnc: 20 +pczl: dzpd + vmcj +pzdj: jlcj + dcbm +wtlj: 16 +phzm: pwng * mrqn +cmdr: qnmv * pfqb +qgcd: gwtf - tjcr +rtfh: 14 +jglt: 11 +cnpj: 3 +bbhh: 19 +pgcq: 2 +mrcr: vhgn / trrw +hzbs: 5 +qswh: zbsf + gzpt +ljhw: crpp * mbgb +htvn: cswr + llnt +nqnv: tqhb + lwpp +ldpl: 9 +zhtl: 4 +mgcq: 5 +tbhh: 5 +qdrc: smcs * mlrb +brqv: 3 +bsmg: 13 +bntr: 5 +qwzw: 20 +swdm: mgcn * sdqn +dfwp: 3 +vwrc: 5 +bmjr: jcvd / mdhj +zqsc: 3 +ddrs: wshg * bntr +fbcs: 2 +vwlz: rqbn * wvcl +mjgv: hmlw * mdvt +gwfw: 3 +dvfn: dnjf * wcnr +zcvz: pfzz + gvww +zbgm: nglr - vdzf +qwjt: wsgr + srvg +smzd: hcsf + htzh +mjcf: 3 +vrqq: 17 +pjmt: nnpm * svnq +lzhd: mrpc * zbtt +fgwm: mwqt * hmnj +hvnj: 2 +jtbn: 4 +jbqq: ffbc + gmpb +dfwn: bmpq * jcps +vwhz: dczq * nldm +ndgg: fmrg * twgr +ljtc: cmgn * wwjg +wthn: 3 +tjrd: vfrr * vntg +fghf: grhd * vdzh +wwzr: 13 +dqrn: hrlp * vvmb +mqgc: ssjw * dpqj +jpws: ppjr * btzj +swzj: qjwl + fbdr +wplg: 6 +crpp: 2 +pjzg: 1 +lzdv: fsml * znll +nlht: rmpc * ncmj +fpwm: 5 +rzwt: 4 +zvdq: 11 +mppg: fmht + jpnc +lwzh: mqpd - ftph +dfdc: zpcr * mcjf +qthh: pzqs + dnsv +fmjh: 1 +cfzd: 2 +mbzj: qgcd * jwmt +dppw: pzrs + zlcq +vvvw: 3 +btgv: lbdn + bwqc +fczm: gqst * nzvf +rcbf: gsgn - sptm +zcth: 12 +rcrt: pgmv + wjbz +bmjf: glgl + hmjc +jpnc: sznj * nnrn +qqcs: 3 +nbhp: nhth * tdnq +llnt: lzrm - vwrj +pzrs: qwzv + cmsv +vfmz: vpqj * jwjt +gswh: 2 +wrnr: 9 +vwdp: gvgp * nwpp +tjcr: 11 +lhzz: 8 +gzmj: tdgz * hlvz +twgr: mhzg + ngml +rvjj: ftgw + pwnb +jppg: fjtz + cpfv +hnvn: fvdd - ttrt +vpbq: tchj + ldbf +djwb: 4 +jrrf: bcsr * rrmq +nrnn: 5 +ccss: srgr + fcrl +mpdb: dznt / hhss +rmvg: bdtn * vmfn +shnt: fphg * cqfq +lfjb: 2 +nhns: plvh * ljmb +nwrd: 3 +hmzs: jcjm * zjpq +zmrs: gqqp + tjjc +pmjj: 2 +wzzw: pzdb + dhgs +sjgz: 5 +tfjv: 5 +srdw: 17 +djps: 2 +hzws: vrhc + vwss +wjgz: 9 +lvgt: 2 +fmcm: 2 +mwqt: 2 +mvjw: zbqq * ltzg +zscm: twjm * tmpq +fwsb: 15 +bvcz: qdrc + wcpw +tfnd: pmhg * wnml +gdsl: cpcz + zgfp +wbrl: 7 +nnjh: 2 +dwtq: lhcf + vwvr +wslq: rlpz * qzmj +dhhr: fqfn * vmfw +spvj: 4 +nzvf: rvjj / fflp +glgl: 2 +zwjv: 3 +wlbh: lctr * vhdj +vnbj: 9 +qgjc: 5 +mqpq: zmzv + wtbw +fjvz: 2 +mdfp: 2 +vwbw: nvwv + zrwv +pwlm: 5 +znps: jpws / fvhf +nlcp: ldll + lpjq +dlqg: 2 +zhns: 3 +vdzh: lcts * lmwv +tlmf: 3 +rnbq: jrvg * lpwg +llhz: 3 +tfbb: 2 +rbgq: 3 +tpdn: 4 +sncl: 4 +swft: jhhv * htnf +rzhb: gnrm + wmhp +cctg: 5 +dmvt: qclr + lhlc +rjtp: vgcm * zvdq +fjpl: 3 +vhtm: tqtz + hnnl +root: bzrn + gvhs +qvvq: 2 +hztr: wmth / npmr +jwqw: 12 +brgz: sbnq + szwn +ntdb: srjc * wgqw +wnml: 7 +crmm: bzvl * bzjh +zmnl: 5 +pgld: nwzg + jlmw +mprn: 5 +qgsb: 6 +shwb: jwqw + lgpt +lqtg: ttrv + nffl +gcgj: 2 +plgz: 2 +dvsp: ldgf + jgjl +ftng: vfmz * rqwc +zgfh: phvd * flbg +cnfd: nqdc + dgtr +whft: wqgs * dqmw +tdgz: 3 +lbnb: 2 +zhrf: 2 +vjhz: brjh + qfjr +lczh: qchb * hrrj +gbft: 2 +sbfm: 3 +cmpb: 7 +tlvd: 5 +jjvv: 7 +nwqz: 5 +nzql: hzbs * hcvt +cfvr: 3 +bwjl: pbvv * wslq +sjjj: 2 +cgll: fbcs + qzjp +hdql: 15 +mcfm: qctt * wntb +vjww: 4 +blcv: mght * nqhv +zcwv: 5 +ltzn: 4 +pvcm: 7 +qfrl: 5 +qhwp: 5 +sltv: 19 +hddc: 8 +rqhr: 3 +bzsb: fpbd + btgq +bsdw: 17 +tvmq: 3 +mbvv: ffws - wqnw +tzld: 13 +wtzj: 3 +sqjd: 7 +mnzt: 2 +rjgp: 5 +hvjg: vwpn * rlsq +wbtd: sfrc + cmtg +glwf: mvzl * qdgw +jpqp: 3 +qldl: 5 +wtbw: zwlq + mpsf +jpnr: llwt - fmmh +nsgn: 10 +lchd: tdwg + cwmb +lhpq: slbz + gjmn +rmlw: 4 +tgmc: 2 +bqvn: nhpb + qhhz +pgnd: gvcc + mdqb +npbg: qdgv * nzjr +vzlb: qrlj / fqcb +cvbr: 2 +tmwd: 2 +qdgw: 4 +chdl: 5 +vmfw: 5 +grgl: 2 +bnld: 10 +mfgv: phsq * zdtm +zjzp: 3 +ldgf: qdtj * rsrm +vmcj: dvfh + zwgd +jqjz: ltlm + tqzw +fptg: 9 +bclm: 19 +dpqj: 2 +gvdd: rtqj * ffjg +fbmp: 4 +gwvz: zrhq - ggps +hwrl: 4 +wnvz: 3 +jtmr: 14 +srfw: 5 +btgf: 2 +fgjb: 2 +jlzc: 1 +btcl: 13 +rzlz: fvnz * wvzw +rfpw: 7 +ppzn: bslr * lpgv +tfbd: tppd + rgrf +sbnq: 12 +zwhh: spnb * mvql +rlsq: gwnj + dbqf +dhbq: 4 +zbhf: 3 +tsrb: gzdb + bfzt +tpjd: vqsq + qbbw +zwlq: 5 +cmwc: 4 +lgjp: tfcn * vtzp +lgsl: npbg / dpgz +zlbr: 5 +jwsn: 2 +qsdz: hsgt * tfct +ggps: pcpq + jsnc +sbjr: 7 +rdbw: vbdj + hzps +drzs: 19 +fjqc: cnrf * mssm +lfqh: crmh * smjm +hvsl: bvws + hrzt +thqf: 1 +vlms: mtgf + qggl +pzpf: jwvv + tnrt +lmvt: phcl * chdl +fmrf: 2 +vlbb: 6 +jszm: 3 +lrpv: 3 +dvps: 5 +lhtt: mzqv * ngmt +gcdj: 5 +mwtp: 19 +rfjz: snng * wzzw +qjwl: gpht * csrp +vbbp: 2 +fqfn: zrvg + vpvs +nqdc: cflr * qdqj +npmr: 2 +hrsf: 2 +gthl: 2 +pdtv: lpld * jnqm +bwht: 2 +qdmn: bvff + ngnz +tjls: pvtg + hjnp +jtjv: dmwl * wrsj +wqzz: zvbl * rdbg +cvzt: vvgs + rsvv +rtcv: 3 +cbtm: nrcq + sjzd +rcjn: jtsc * rtzd +zjvc: 2 +vjfd: fmqc / smcp +zrwv: ffbl * rtcv +wfgq: bmjf * ltjt +sfcf: fvtb + ttfr +hzvb: thvd * pltc +ngmt: bttc + brjz +jppb: 3 +zgss: 3 +lcwf: zwmj * djnj +cddq: 5 +jldf: hmzt + rjdq +cpfv: 18 +jwzl: brqv * dbnw +mshv: 19 +ttqc: rcbf * vbnz +hhjd: 2 +jwvv: dbmn + rtbr +rfdf: 3 +zrrn: 9 +jzlt: 1 +tcts: 5 +rlpr: 6 +srml: mzmw + tvwc +cfjv: sjbj + dvst +nzmj: lpmr + jppg +trtn: rdbq * mqpq +zlps: vmss + tngz +ppqb: frlh + gvwb +slrl: 14 +cdhm: qgjc * nqhg +hfls: 4 +htzh: 14 +pjdd: 8 +jtdg: nfvj * ddcv +jwqd: 2 +lbdn: 4 +zlsj: 4 +jblw: tndh + dsfp +bnnm: 4 +mjcq: 5 +fvwn: 17 +msfz: 13 +vrhc: 3 +mfcn: cnpj * shbj +mdmw: 2 +jhjz: pmjn + ppzn +rqqs: rdbd * rjpc +ffms: 4 +cppn: grvz - fvqq +thwd: 5 +hnnl: 4 +bwwh: smmv * gshc +wqgs: 5 +csrp: 5 +qhhf: nfpr * phwz +mqlz: hrvs + ghht +fcdn: 3 +hgfz: prsj + nwmq +glnb: jssv / prjm +ltlm: mpmq * nvjg +rlpz: jtcz - wrlb +wgst: 9 +ldnw: tltg + mhqb +hnfq: 2 +scsc: rnnh * jftv +tdwg: jjfl * dmnf +cvjb: djps + bqpb +slwg: nlml * wbgz +cdlc: 11 +mlrb: 3 +rlqb: 2 +gcjw: 6 +qwll: 7 +lccv: 5 +ntlp: jvjb * fvwn +swfb: jshd + zljq +rdbg: 5 +szwn: 6 +fvld: hvsl + jsfz +pldf: ggwl + lcsh +hgqn: 18 +slbz: mqdq / jrtr +ggfs: jzvc + rzlz +ttrv: lrsl + gntf +wbps: mqlc * dwvm +djln: chbl * vjcg +jrvg: 2 +ltlv: 1 +twjv: dqph * fmhd +pdqv: 2 +nfvj: 4 +lqzz: 11 +dncn: 2 +bqgf: vhtm + hpcf +wfnt: 5 +wdmq: 2 +wbmh: svfg + ltzn +lwmv: 2 +ddtg: dlzh / nbzv +cwwh: 2 +hdsf: pfpc * fbfr +rznw: fspn + pwhg +bwhd: wfgq / pmtj +zllt: nqhc * jlrq +qggs: vrbz + lrpq +slhl: 10 +htnf: jgnq + tnmq +zrqr: hqcr * nqfq +dpfm: nszt * cvzz +lqqv: 4 +wqtm: 15 +tfcn: dlbc * gfcg +dgfd: 7 +tqbq: 3 +qzpg: 2 +dzsp: 5 +czmc: gzmj + jtmr +hrgt: vvvv * jqmp +cwmb: ncwh + zvdt +hhnd: 13 +scsr: vnmv + qnzm +czjh: 8 +lltn: mdfp * zbcd +qlzj: tmtw + gdjv +dwsv: ztds / bhhj +sjtb: nzvt / jbjw +fwbj: 13 +hgmq: zwhh + bwnp +lmpn: vctd - mwrw +cnlg: tbwz + znmj +mvwl: snhg * dfdc +lgrc: 17 +qpzm: lfqh + vcsm +nzzt: fddj / gwlf +dzpd: 10 +pvgb: 18 +zgjq: 2 +dqqp: 5 +qvdr: clnl * svrm +fzfb: 2 +jpmf: 2 +gwws: 4 +nvqf: 2 +qlwj: nchp * jljn +crgm: 2 +fqlf: 15 +vthb: qqvm / zbmz +mjvd: 7 +sjzd: sjnt + pjmt +trzs: 7 +pwvq: tthn + lnrs +jtsm: 3 +ztvn: 4 +btjt: jqhf * nlht +jnth: 2 +vdlz: cnlg + htvv +jcps: 3 +hgjw: 5 +frgf: 2 +bqzm: ngmc * sbsb +dhst: ljhh + cmwc +nbzn: 5 +qbqw: dnft * jzgn +wdss: 9 +smpc: qgsj - hwdg +jcvd: ctgw * rnhl +hdgg: 3 +gzjd: 5 +cwrq: nhns + lszv +fdtg: bhqt * zrhz +fphj: zqpr + fvzm +zcjv: 7 +wfwm: 2 +hnlb: 2 +tpjl: 3 +nfrp: 6 +pfdj: pwwq - bnnm +lpgv: 2 +gvmg: 2 +frlh: qfbn + lqnw +vtjd: 5 +jhzl: zznw * ffrj +lsps: lgcb + gpbj +gvhs: ftlq * sgbl +qqvm: tvpz * bsmg +ghpn: 1 +fvhc: 15 +hjzj: ltfn + nwnj +bjbn: 1 +wrsj: 3 +jhfq: 18 +dvqw: wpsl * qcbj +gsjp: 2 +splh: 2 +ttcz: fmcq * gjtl +nlff: vssp * djhv +wrcb: 3 +ntnr: cvzb / lzlv +bzdh: 2 +fvcg: 3 +tndh: hlbh * ngtq +vhbz: dmvt * vwvt +rwgb: vmrz + cjwr +zvrv: jgmq * fmcm +zzld: pqls - zgcc +mpzw: 13 +lhjh: bclm * hpct +qbnz: bnwn + qqms +zcjg: svzg / rgjv +mjtq: frgf + hwmz +htcn: 4 +jzmv: hczq / thtd +slsw: 3 +qppn: dfbn * lsfl +jnqm: 17 +lhsj: czvp * pfgc +jsfz: 1 +qnqt: zzgp + wrcb +zzlb: 3 +rpcp: htzc + lchd +hhrh: 13 +rbvv: fffw / hvdn +fjbm: 4 +pbvv: bqvn + wprd +rlgp: 7 +jvjb: 2 +ggfw: 5 +jgdp: 3 +strj: hllw * jbqq +vfvl: 4 +qzqg: 13 +zpnz: shrv * qzds +mljz: svnj + rlpr +lrsl: lzhd + vvgr +nqwc: rcrt * jhst +gsbh: ggjh * vnjr +mlqn: bphw + rvzd +cjwr: cmpb + cwnc +clnl: 5 +pldm: cmdr * ttvw +tfht: ttgl * hlzh +wzmh: cdlc + nlcp +hlhp: 1 +bdtn: 2 +zwmj: 3 +tgrb: hzvq * drmd +vfhp: wsjv * bgft +nzjr: bvqz + hshj +jllb: jwpq + mljz +gflv: srdb + wsrh +mhqb: pjqb * fmpw +tfcv: gtvt * tfnd +vjhb: 7 +wprd: zcjg + vgwp +fqmt: pzfv * pdqb +zpcr: 3 +hvgm: 17 +bwqc: 5 +qsbv: qfpz + vbrn +crwh: 1 +lfcj: bwhl * hmrv +qpdp: vvgf + qhhf +prrc: ctzn / qgpm +tjmn: 5 +jssv: qlgh * dqpt +dbjs: jrzn - gdrc +cnrf: hgcf * bjtf +dbgc: hzph * mfmp +bdwh: dppw * zmsn +wfbf: tqbq * zcfj +nppj: 2 +mssm: vqcr * qggs +gbvt: gbgp * tmvj +ghpm: dlnc + dbfr +hllw: wsrd + zngq +jvmt: lqtg + bwjl +tthn: hjwl * fzgh +qrtc: rvbl / djvz +dlzh: rwll * lwmv +nzvt: fzfb * bwhd +cvzz: 15 +pwhq: 2 diff --git a/2022/day21/main.go b/2022/day21/main.go new file mode 100644 index 0000000..1cfcd18 --- /dev/null +++ b/2022/day21/main.go @@ -0,0 +1,143 @@ +package main + +import ( + "fmt" + "strings" + + h "git.bullercodeworks.com/brian/adventofcode/helpers" +) + +var output []string + +func main() { + inp := h.StdinToStringSlice() + part1(inp) + part2(inp) +} + +func showLog() { + fmt.Println(h.CLEAR_SCREEN) + fmt.Println(strings.Join(output, "\n")) +} + +func setLog(v ...string) { + output = []string{} + log(v...) +} +func log(v ...string) { + output = append(output, v...) +} + +func loadMonkeys(inp []string) map[string]*Monkey { + monkeys := make(map[string]*Monkey) + for _, v := range inp { + if len(v) == 0 { + break + } + m := NewMonkey(strings.Split(v, ": ")...) + monkeys[m.name] = m + } + for _, v := range monkeys { + v.init(monkeys, 1) + } + return monkeys +} + +func part1(inp []string) { + monkeys := loadMonkeys(inp) + log("# Part 1", fmt.Sprintf("%d", monkeys["root"].Value())) + showLog() +} + +func part2(inp []string) { + fmt.Println() + monkeys := loadMonkeys(inp) + + m1 := monkeys["root"].inp1 // <- Human is in here + m2 := monkeys["root"].inp2 // <- We need to make it match this + monkeys["humn"].Value = func() int { return 0 } + fmt.Println(m1.Value(), m2.Value()) + monkeys["humn"].Value = func() int { return 1000 } + fmt.Println(m1.Value(), m2.Value()) + //v := monkeys["root"].Value() + + /* + i := 0 + var lastV int + for { + monkeys["humn"].Value = func() int { + return i + } + v := monkeys["root"].Value() + if v == 0 { + output = append(output[:1], []string{"# Part 2", fmt.Sprintf("Found: %d", i)}...) + showLog() + return + } + output = append(output[:3], []string{ + "# Part 2", + fmt.Sprintf("Scanning... [ humn: %d ]", i), + fmt.Sprintf("CURR: %d =? 0", v), + fmt.Sprintf("LAST: %d", lastV), + }...) + setLog(output...) + showLog() + } + */ +} + +type Operation int + +const ( + opAdd = iota + opSub + opMlt + opDiv +) + +type Monkey struct { + name string + op Operation + inp1, inp2 *Monkey + rawValue string + Value func() int +} + +func NewMonkey(inp ...string) *Monkey { return &Monkey{name: inp[0], rawValue: inp[1]} } +func (m *Monkey) init(monkeys map[string]*Monkey, part int) { + pts := strings.Fields(m.rawValue) + if len(pts) == 1 { + m.Value = func() int { return h.Atoi(pts[0]) } + } else { + if part == 2 && m.name == "root" { + pts[1] = "-" + } + m.inp1, m.inp2 = monkeys[pts[0]], monkeys[pts[2]] + switch pts[1] { + case "+": + m.Value = func() int { + return m.inp1.Value() + m.inp2.Value() + } + case "-": + m.Value = func() int { + return m.inp1.Value() - m.inp2.Value() + } + case "*": + m.Value = func() int { + return m.inp1.Value() * m.inp2.Value() + } + case "/": + m.Value = func() int { + return m.inp1.Value() / m.inp2.Value() + } + case "=": + m.Value = func() int { + if m.inp1.Value() == m.inp2.Value() { + return 1 + } else { + return 0 + } + } + } + } +} diff --git a/2022/day21/problem b/2022/day21/problem new file mode 100644 index 0000000..81a0f17 --- /dev/null +++ b/2022/day21/problem @@ -0,0 +1,102 @@ + Advent of Code + + • [About] + • [Events] + • [Shop] + • [Settings] + • [Log Out] + + br0xen (AoC++) 35* + +       /*2022*/ + + • [Calendar] + • [AoC++] + • [Sponsors] + • [Leaderboard] + • [Stats] + + Our sponsors help make Advent of Code possible: + Teradyne - Do you like coding algorithms where milliseconds matter? What about nanoseconds? + +--- Day 21: Monkey Math --- + + The monkeys are back! You're worried they're going to try to steal your stuff again, but it seems like they're just + holding their ground and making various monkey noises at you. + + Eventually, one of the elephants realizes you don't speak monkey and comes over to interpret. As it turns out, they + overheard you talking about trying to find the grove; they can show you a shortcut if you answer their riddle. + + Each monkey is given a job: either to yell a specific number or to yell the result of a math operation. All of the + number-yelling monkeys know their number from the start; however, the math operation monkeys need to wait for two other + monkeys to yell a number, and those two other monkeys might also be waiting on other monkeys. + + Your job is to work out the number the monkey named root will yell before the monkeys figure it out themselves. + + For example: + + root: pppw + sjmn + dbpl: 5 + cczh: sllz + lgvd + zczc: 2 + ptdq: humn - dvpt + dvpt: 3 + lfqf: 4 + humn: 5 + ljgn: 2 + sjmn: drzm * dbpl + sllz: 4 + pppw: cczh / lfqf + lgvd: ljgn * ptdq + drzm: hmdt - zczc + hmdt: 32 + + Each line contains the name of a monkey, a colon, and then the job of that monkey: + + • A lone number means the monkey's job is simply to yell that number. + • A job like aaaa + bbbb means the monkey waits for monkeys aaaa and bbbb to yell each of their numbers; the monkey + then yells the sum of those two numbers. + • aaaa - bbbb means the monkey yells aaaa's number minus bbbb's number. + • Job aaaa * bbbb will yell aaaa's number multiplied by bbbb's number. + • Job aaaa / bbbb will yell aaaa's number divided by bbbb's number. + + So, in the above example, monkey drzm has to wait for monkeys hmdt and zczc to yell their numbers. Fortunately, both + hmdt and zczc have jobs that involve simply yelling a single number, so they do this immediately: 32 and 2. Monkey drzm + can then yell its number by finding 32 minus 2: 30. + + Then, monkey sjmn has one of its numbers (30, from monkey drzm), and already has its other number, 5, from dbpl. This + allows it to yell its own number by finding 30 multiplied by 5: 150. + + This process continues until root yells a number: 152. + + However, your actual situation involves considerably more monkeys. What number will the monkey named root yell? + + To begin, get your puzzle input. + + Answer: _____________________ [ [Submit] ] + + You can also [Shareon Twitter Mastodon] this puzzle. + +References + + Visible links + . https://adventofcode.com/ + . https://adventofcode.com/2022/about + . https://adventofcode.com/2022/events + . https://teespring.com/stores/advent-of-code + . https://adventofcode.com/2022/settings + . https://adventofcode.com/2022/auth/logout + . Advent of Code Supporter + https://adventofcode.com/2022/support + . https://adventofcode.com/2022 + . https://adventofcode.com/2022 + . https://adventofcode.com/2022/support + . https://adventofcode.com/2022/sponsors + . https://adventofcode.com/2022/leaderboard + . https://adventofcode.com/2022/stats + . https://adventofcode.com/2022/sponsors + . https://jobs.teradyne.com/?utm_source=adventofcode&utm_medium=ad&utm_campaign=2022 + . https://adventofcode.com/2022/day/11 + . https://adventofcode.com/2022/day/21/input + . https://twitter.com/intent/tweet?text=%22Monkey+Math%22+%2D+Day+21+%2D+Advent+of+Code+2022&url=https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F21&related=ericwastl&hashtags=AdventOfCode + . javascript:void(0); diff --git a/2022/day21/testinput b/2022/day21/testinput new file mode 100644 index 0000000..e14be60 --- /dev/null +++ b/2022/day21/testinput @@ -0,0 +1,15 @@ +root: pppw + sjmn +dbpl: 5 +cczh: sllz + lgvd +zczc: 2 +ptdq: humn - dvpt +dvpt: 3 +lfqf: 4 +humn: 5 +ljgn: 2 +sjmn: drzm * dbpl +sllz: 4 +pppw: cczh / lfqf +lgvd: ljgn * ptdq +drzm: hmdt - zczc +hmdt: 32 diff --git a/2022/day22/input b/2022/day22/input new file mode 100644 index 0000000..379cbef --- /dev/null +++ b/2022/day22/input @@ -0,0 +1,202 @@ + ...#...#..........#..........#......#.....#.........................#.................#............. + ............#.........#...#...................#.#.....#.............#...#........................... + ........#.....##.#...............#......#.......#........#....#...#............#.................... + ...##.#.....#....#....#.....................##...............................##..........##.##...... + ......#.#...........#..............#...........#..#........#.............................#......#... + ..........#.#...#...#.#........#....#.............................##......#......#.#..#.....#...#... + .........................#........................#......................#.#........................ + ..................#..........##.....#....#..##........#......#....#..#.#...............#.......#.... + #..#.#.........#...........#...............................##......#........#..........##......#.... + .......#...#.#.#..........#....#................................................#......#............ + ..#....#...............#.#..........................................#.......................#....... + .......#......................#.#...........##......##..#........#..............##....#............. + ............#.#.......##.........#........#..........................#.....#................#....#.. + ..#..........#.........#...............##............#.........#..#...........#....#.#.......#..#... + .................#.........#............#..........#...................#.............#.............. + ...............................#.............................................#...#...#......#....... + .................................#.........#..........#..........#....#..#.......................... + ...................#............#..#...#.#.........#..........................#..................... + #......#..........#...###.....##.....................#...#.......#.#.#.....#............#........... + ....#..##..#....#.#.........#..........#....#...#.......#......#............#.#.#.#................. + ........##.....#.............................................#...........................#.......... + .....#...........................................#.....................#........................#... + #.#..#.#....#.......#..................##...............#....#........#.#.....#...........##........ + .....#..........#.....#....................................#...#.........#........#......#.......... + ...#.........#..#......#..................#............................#...........#......#......... + .......#.........#....#...........#........................#........#...........#....#.............# + ...................#..#........#..#........#...#.......#......................#..........#.......... + ...#.........................#...#...#.....#.............#.......#..................##......#....... + ..#.................#..........................#.......................#....#....................#.. + .................#..................#..........#.#......###.....#.##..#...................#......... + #.....#......#.#.........#.............#......##........#.....................#..#.........#.....#.. + ..#...............#........................##..#..........#..#.............#....#.#..#..#........#.. + .................#....#....#....#..#.......................#.......#.#...............#...#.#........ + .#.#.....#............#....#...##.#...#....................................#.#.......#...#.#....#... + .................#.............##.............#.........#.......#.................#..............#.. + .#...#..........##...#....#.....#.............##.#......#...........#....................#.......... + ...........#........#......#........#.....#.#.#.#...........................................#....... + ........#.....#......#.....##...................#.#.......#........#............................##.# + ...#.....#.............#.....................##.....#.#.............##...............#....##..#..... + ..................#...........##.#.....#....#..........#.#...................#..........#..#....#... + #............#..#........#...................#...................#.......#.....#.................... + ..........................................#.....#.................#.......#.........##.............# + ...................#................................................................................ + ..#.........#.....#..............#...#............#.#.....#.#..........#.......#...#................ + ....................................#...........................#...#.....#................#........ + .....#...#......#.......................................#..............#.........##................. + .....#.............#...............#.......#.....#......#........................................... + #####.#.................#.........#.......#..#....#...............#..#..........#........#...#...... + ...........##.....#...##...#............#............................#.#...#...............#....#... + #.................#.........#.......#....#.............#............#........#...................... + #.............#......................#....#..#..#. + ....#.............#.........#...#.......#......... + ...#..................##......#................... + .........#...#..#..##............#................ + .......#.......#.#.......#.....................#.# + .......................#.....#....#....#.......... + #.....................#.........#................. + ............#.................##.....##........#.. + ................#...............#.........#......# + ..........................#...#....#.....#.....#.. + #.......#..#......#.....#.........#.....#......#.. + ..........................#...#................#.. + #...#...#..............#.......#..............#... + ........................##........#........#.##... + .........#........#..#.....#...................... + ......#...#......#..........#......#.......#.#.... + .........#......................#..........#...... + ..............................#.......#.#......... + .........##.................#................#.... + ..........#.............#......#.#...##.........#. + ..........#.#.....#.............................#. + ...#...#.##......#.#......#............#...#...... + ...#.#.........#...#.#...#..#....#.............#.# + .....#............................................ + .....#.#......#....#.....#......#.......#......... + .................................#................ + .................................................. + .................#...............#................ + .#.#..#.....#..#.............#.##.........#....... + ..#............#.................#...#............ + ..............................#.#.#..#..#....#.... + .............#.................#..#............... + ............#............#...........#..#......... + .....#.....#..........#....#..........##....##.... + .........#........................................ + ..#........#.....#.......#............#....#...... + ...#...#....#...........#...........#..........#.. + ................#........#.#...................... + ...............##....#...............#............ + .##.....................#....................#.... + ............................##....#.....##......#. + ........#.....#.................#.#..#......#..##. + .........#..............#..#...................... + #.............#......#................#....#..#... + ............#.................#..........#.#..#.## + .#.....#.....#.....................#.............. + ............#...#..............#...#.............. + .........#..............#.#...#............#...... + ..#.#.......#.#.........##.#...........#.......#.. + ..........#..#........##.............#....#....... +.........#..###.................#......................#...............##........................... +#..#.#...#..........#............#......#..##.........#.##.#........................................ +.........................#..................#.#......#..........................#.#..............#.. +....#.......#..#.#...#.#..#..............#.........................................#......#....#.... +.#..........#.....#...#..#.#...........#............#............................................... +#..................#.........#........#...#.............#......#.....................#.#............ +.........#............#........#.............................#..#..............................#.... +#.#...............................................#.#............................................... +...#..#........##......#...#..#.....#..................................#..............#.....#....... +.........................................#............#..................................#..#....... +#...#......#..#.....................#.........#..................................................... +.##.................#...#..........#......#...#....#..#....#...#.#.........#............#.....#..... +...#....#.......#............#..........##..................#.....#..............##..........#...... +...............#..#.........................#.......................#........##..................... +....#........#..###................#.....#.#.........#...............#...................#.........# +..#...............#.##...........#.#.....#............#.....#.............#.###.#..........#........ +.....#...#......................................#.#..............................#...............#.. +.......#.....#..#.............#.............................#..###...............#........#..#...... +.....#..#.....................#.#.....#...##...............................#.......#................ +....................#.#.................#................#..#......................#.##............. +.....#..#...........#.#.....................#..........#...#...........................#.#..#....... +.............#..............#.....#...........#..........#......##.................................. +.........#....#..........#............#.##.#.................#............................#......... +...#.....................................#........#..#.#..........................................## +...................#..#.#...................#...##.#.#...#..................#.......#............... +.............#.......................................#........#.#.....#.......................#....# +.....#....#..........#........#...##...........#....#......#......................#.......#.#..#.#.. +#...........................#.#..#.............#...........#...................#..........#......... +........#........#........#...#..............##.........#.................................##........ +...............................##...............#....#................................#.......#..... +..#.#........#..................#............#....#.........#....##.....#.................#........# +.#......................#....#........##............................#...........#.#...#............. +.......#.....#.......#.......#...................................#....#...#............##....#...... +...#................................#.......#..##...................................#...##....#..... +..#.#..........#..........#........#..........#...#......#..##............#.....................#... +......#..............#.............................................#...#.......#.#.......#.......... +...........#............#.#..#.........#.........#..........#............................#.......... +....#..#......##........#..........#...........#.....................#..........#..............#.... +...............................................#...................#.#.........#........#..#.#...... +.........#.............#.......#........#.....#..............#...............#...................... +.....#...#......#..#........##.........#......#................#........#.......................#..# +#....#.....#..............#..#....#.............#................#..........#..........#...........# +.#..........#...#.....#............#..............##......#.......#...#...........#......#.......... +...#.................................#................#.........#..........................#....#... +..#..........#....................................#.......#............#............................ +............#......#.........#....#.........#..................#..........#....#..#................. +..........#....#...#.............................................##.....#.....#......#..#.........#. +.....................#............#..........#..#....#.#........#..#.....#......#.#.............##.. +....##............#..............#..................##.................#.............#.#............ +..#..........#.......................................................................#.............. +.#...#......#.....................##..........##.. +....#.....................#.......#............... +...#...#.#....#..#............#..#....#..#.#...... +#.##..#....#........#.......................#..... +..........#....#.....#.#......#......#.......#.... +..#.....##........##......#....#...#.#...#........ +...#..........#..#..........#..................... +......#...#....##.#.#.#...........#......#......#. +.................................................. +.......#......#.......#..........##...#........... +....#.....#....................#.................. +.##...............#..........#..........#......#.. +.........#.#.......#.............................. +...........#........#....................#........ +..#...#...#...................#................... +....#.........#.#............#........#......#.##. +....................................#......#..###. +......#...#..................#...#................ +................................................#. +.............#.......#.#.....#.....##.......##.... +......#..#.............#.....................#.... +............#.........#....#...........##..#...... +..#................#...#..............#.........#. +....#.......#............#.....#......#........... +........##..#.......#...#......................... +.............#.......#........##............#....# +#........................#............#........... +......#............#..###..##.#.#................. +...#.#................#......#.................... +..#.......#............##....#...#........#....... +........#..#....#............................#...# +......................#.#.............#.......#..# +..........#.#...................#.#.......###..#.. +.#......................#................#........ +....#...#..............#......##...#...........#.. +....#..........#......#.....#..................... +.#.....#.......................................... +..#............................................... +......#...#.............#........#........#.....#. +......#.#..#..........##.......###................ +................#.#..#.......#..#................. +.................###.................#............ +.............#..#...............#........##....... +...............#..#............................... +......#........................#...........#....#. +...#.#...........................#.#...........#.. +.............#.#........................#...#..... +..#..........#..........#......................... +.#....#.....#...#............#.........#.......... +....#.#...#...................#.#.....#.#......... + +42L12R17L16L29R20R13L15R44L30R44R27L9L23R49R17L19L50L46L5R17L4R17R41R4R7R13R41R29R17R13R27R30L2R49R24L19L41L2L43L26R46L34R3L37L4L18L12L18L37R17R47L33L9R16L7R30R44L5L30R12R22L33L12R12R40R6R48L37R50L41L38L6R33L24L49L11L29L31L21R24R11L46R22L50R34R31L2L23R29L32R46L2L49L23L48L44R22R30L21L41R43R41L44R19R7R3R1R19R3R35L39R13R20L10R35L34L7R14L42R25L33L7L13R14R1L19R30L11L33R32L33R14R50R18L48R8L11L16L21L34R2L9L24L12R27L19R1L32R36L34L14L5L38L33L12R43L46R13R26R6R9L49R42R8L29R45L47R30R30R9R17R29R9R44L20L41R32L32L18R29R1L32R5R17R50R45R7R43R10R40R48L28R4L22R5L5L5R11L23R34L12R24R19L25R16L29L33R18L41L38R47L10R49L39R30L37R31L21L33L24L30L21L47R41L25L21R15L39R31R47L38L46R4R13L27L38R35L5L31L20L8R43L14L43L20L5R33L6L39L46R41L10R24L21L9R43R23L1L3R34R10L8L34R22R2L14L11R41L24L29L47L12L36L24L9R19L16R41L49R32R32R44R13R6R21R17R18L1L6R5L2L50R32L24L4R2R9R38R32R41L21L48L48R39R41R48R16R5L46L25R20R9R38R26L34R30L8L38R32R49R5L41L28R40R13R11L13R43R6R21R20L17R46R40L20L24L27L45R40R13R27R16R36R1R32L40L28L12L30L1R24L44L8R10R14R30L12R44R48L49R46R30L18R24L15R18R8R38R26L3L6L24R2R38R29L29R26R46L8L44L13L26R28L38L2R12L14R46L47R42L15L26R43L46R37L50L10L38R24R22L49R18R16R37R12R20R33L35R27R41R37R7R45R4L4L9L37L44L22R18L34R21R6L39L38L47R24L48L19R32L21R32L48R13L20R15L42R1R6L39L2R8L3L47R14L29L12L15R39R34L40R39R27L46R30L38R18R10L40L20R37R44R16L37L45R12R50L8L21R46R19L29L9R21L1R23L23L43R3R42L45L17R26L32R34R15R4L45L7R23R5L21R24R30L41R37L18R34L12L27L39R28R47L50R35L13L40L13R48L47R16R35R2L32L41R45R32L38L4R4L9L7R2R21L33L27L46L39R5R46L1R39L23R18L33L10L3L5L45L35L27L19R44L24R17R39L16R40R8L36R31R41L23R9R45R29R48R24L23R49L16L27R16R19R27R44L9R48R42L6R37R25L1L46R7L25R33R32R26L9L48R7R44L40L10R49R9L34L29R6R30L18R8R46R44R17R37L1L30R12L8R12R18R38R18R22R40R47L7L28R34L42L4L43L46L29L35L33L22R6R30L1R42L17R27L6L11R36L36L38L24L9R36R32R21R50R2R2R46R12L11R15L40R17L7R20R39L27L13R27R22L7L17L49L5R5L7R42R32R27L27L46R48L3R34L13R16R27R37R27L6R40L33R7R45R44L9L45R44L12R17R46R22R19R13R25R4L25R34R42L38R37L32R14L15L37R10L38R42R12R8L5R7R46R49L20L29R26R24L18R22R38L5R4L42R29R41L29R49L2R21L22L7R31R37R45R24R12R44L29L36R15L4L4R26R46R9L4R43R33L40R5L23R25R3R26L1R35L40R38R12R11R1L15L9L19R10R39R10R31R30R19L39L24L44R13L36R32L27R43L4L38R39L24L32R11L3R22R24R6R36L20R43R6L23L30R18R45R31R32R4R5R37R33R49L20L49R11R15R1R42L10R19R9L31L41R44R9R25L28R4L7L35L11L29L2L19L12L27R46R29L1L5L18R19L27L3R12R43R50R21R4L35R42R3R28R1R38R32L33R41L2L41L41R17L3R35L38R28L23R34L14L35R32R12R12R47L3L7R32R4L1R33L5L13R23R26L5R21L27R47R37R8R38R25R44L50R48L42L33L39R33R42L26R50L2L27R26R50L18R40L41R36R11L50L50R7R33L9L21L15L43R18L10R15R44L48L6L16L17R5R20L35R20L9L37R20L17R9L4L22R23L12R49R44L22L3L3R23R6L42L18L49L42L17L43L50L23L20R40R47L33L26R29R15L39R25R33R29L20L50L12R34R2R38L44L37L8L30R40L18R49R10L17L23R8L39R47L16L31R46L24R24R7L28R48R13R1L42L48R49R5R10R19L18L33R26L44R23L17L18L10R28L33L33L34R35R28R42R45L21L32L25R50R42L38R9R29L42R8L23R41R6L1L10R38R7L2L27R45L36L30L48R5R15R35R16R20L48R32R5R21L23R29L48L39R31L30L39R22R42L12R46R39L9L10R48R37R40L35L40R48R13R30R12L40R27L47R17L5L25R36L35R27L44L48L19L16L44L17L36L12L45L30R29L42R39L16R16R50L25R45L45R37L37R36R36R8R12R1L21R12R30L5L6L13L40L39R37L49L9L3L45R21L1R18L9L38L3R48L38R11R25L36L33L26R46L50L19L28L7L4R32R25L30L28L42L10R38R40R36L48R40R14R32R26R16L15R43R30L48R12R16L48R45R23L6L12L46L12R34R26R26L29R20L30L20L2L24L31R35L50L39L29R9R10L42R31L6L47L10R34L40R34R39R37R37R11R39L1R50R22R40R10R24L30L43L7L9R32L7R31R7R16R29R42R38R12L17L12R7L40L38L25L3L12L9L21R20L41L6R32L12L22R8L23R15L15L19R44L12L39R46R35R33L36R28R6L43L45L27R17L4R1L31L8R23R36R21R39R4L45R11R31L41R41R7R48L1L23R15R9L15L39R40L20L29L20L39R15R3L34L18L32R16R5R22L46R11L17R13L19R36L16L43R9L14L5L8L30R21R29L1R33R39L24L31R18R48R15L49R42R28R22L14R7R4R1R23R2L36R27L27R36L3R38L33L39R9L6L45L8L7L49L17L11L31L11L26L26L42R40L2R26R50R45L38L47R28R28R4R43R9L7R27R28R1L31L30L31L50R34R38R16L5R12L43L10L6L6L20L30R29L42R23R3R22R21R45L13R26L41L19L4R39R34L39R26L8R8L36L34L10L23R37R35R6L49L45L43L9R24R42L42R37R3L17L7L30L3R14R40R2R4R7L20L48L46L43L50R34R40L8L37L29R11R16L21R41L31R24L2L34L28L5L3R45L18R19L39L16L42R7L9R30R41R48L17L49R42R38L11R19R41R13L43R1L6R39R31R39R39R31L8L10L27L22R36L47L31L13L35R19R13R35R44R12R2R33L14R36R29L12L29R5R11R11L47L8L23L38R28R48L26R44R21L46R32L37R31R25R36L12R12L20R6L44R8R12R43L49L42L36R45L25R19L10L42L30R33L34R26R45R31R16R11R8R12L41L39L16L22L32R41R5L12R8R26R5L21L35L17L25L20L26L36R10L26L23R37R28R34L29R40R47L41R36R16R36L48R7R4L47L44L46L38R2L21R3L8L24L37R39L21L37L50L9R48R28L37L10R39R43L43R42R16R47R27R4R33L25L40R48R3R10L41L22L47R14L40L42L42L7R34L41L22L33L17R4R34R47R46L26R30R22R4R12R19L41L14L40L45L31L3L13R31L5L38L25L11R24L27L33L14R47L16L44R25R14R10L3R17R20R34R49L31R8L3L28R21R3R50L19L6R11L29R1R37R38L34L6L11L33L47R11L9L16R29L29L21L29L47R30L25L37R15L19R27L37R23L43R6L39R22R14R42L21R24R32R50R34L45R6L41R14L33R18L20L18L35L5R37L35R17R24R30L32L38R44R43R50L17R7R48R48R43L9L9L37L1L34L35R44R22L16L44R33R15R35L30L15R6R22R50L18L37L26L4L8L7R14L40L18R39R10L35R48R43L14L15L24R45L39R50L29R17L49L16L24L7R38R46L3L26R46R19R22R15R32L33L18L12R35L24L26R38L40L21R12R36L50R5R33L33R38R20L48L30L25L12R35L8R5R7L9L1L50L25R3R32L12L4L16R20L17R10L24L15R47L31R23L32R42R6L47L20L8L23L15R48L20R26L34R13R42L42R47L43L15R20L27L30L34L37R16L33R30R4L36L43L27L31R30L27R30R39R50L37L42R42L11L15L27L29R21R43R23R50R38L6L43L48R1L17L3R1L12R3R21L2R37L49L17L12L32L46R34R40L1L2R50L18L15R1L28R14L16L30R34L38L38R40R31L21R47R37L20R21L16L16R42L39R39L10R47R36R9R4R41L44L25R39L11L33L45L42L31R16L45L22L40R24R39R3R16R8L5L44L39L15L3L31L42L14L35L7R9L41L25R26L46L31R14R17L3L40L12L36L17R30L1L40L8L48L19R44R20L41R38R46L4L34L23R41R24R17L17L47L42L14L40R27L15R39R45R48L30R10L34L10R1L2R4R8R45L1L15L36R16L30L1R9R31R13L19L34R8R26L46R44L20R24L38R17L48L31R49R43R21L1R16L37R4R29R40R41L46R16R4L33 diff --git a/2022/day22/input-m b/2022/day22/input-m new file mode 100644 index 0000000..c64454f --- /dev/null +++ b/2022/day22/input-m @@ -0,0 +1,308 @@ +Right +..................#.................#............. +....#.............#...#........................... +.......#....#...#............#.................... +...........................##..........##.##...... +#........#.............................#......#... +................##......#......#.#..#.....#...#... +#......................#.#........................ +....#......#....#..#.#...............#.......#.... +.........##......#........#..........##......#.... +..............................#......#............ +..................#.......................#....... +..##..#........#..............##....#............. +...................#.....#................#....#.. +...#.........#..#...........#....#.#.......#..#... +.#...................#.............#.............. +...........................#...#...#......#....... +....#..........#....#..#.......................... +.#..........................#..................... +...#...#.......#.#.#.....#............#........... +......#......#............#.#.#.#................. +...........#...........................#.......... +.....................#........................#... +......#....#........#.#.....#...........##........ +.........#...#.........#........#......#.......... +.....................#...........#......#......... +.........#........#...........#....#.............# +.....#......................#..........#.......... +.......#.......#..................##......#....... +.....................#....#....................#.. +......###.....#.##..#...................#......... +......#.....................#..#.........#.....#.. +........#..#.............#....#.#..#..#........#.. +.........#.......#.#...............#...#.#........ +.........................#.#.......#...#.#....#... +......#.......#.................#..............#.. +......#...........#....................#.......... +..........................................#....... +#.......#........#............................##.# +..#.#.............##...............#....##..#..... +.....#.#...................#..........#..#....#... +...............#.......#.....#.................... +................#.......#.........##.............# +.................................................. +#.#.....#.#..........#.......#...#................ +..............#...#.....#................#........ +......#..............#.........##................. +......#........................................... +#...............#..#..........#........#...#...... +...................#.#...#...............#....#... +.....#............#........#...................... +Top +...#...#..........#..........#......#.....#....... +............#.........#...#...................#.#. +........#.....##.#...............#......#.......#. +...##.#.....#....#....#.....................##.... +......#.#...........#..............#...........#.. +..........#.#...#...#.#........#....#............. +.........................#........................ +..................#..........##.....#....#..##.... +#..#.#.........#...........#...................... +.......#...#.#.#..........#....#.................. +..#....#...............#.#........................ +.......#......................#.#...........##.... +............#.#.......##.........#........#....... +..#..........#.........#...............##......... +.................#.........#............#......... +...............................#.................. +.................................#.........#...... +...................#............#..#...#.#........ +#......#..........#...###.....##.................. +....#..##..#....#.#.........#..........#....#...#. +........##.....#.................................. +.....#...........................................# +#.#..#.#....#.......#..................##......... +.....#..........#.....#........................... +...#.........#..#......#..................#....... +.......#.........#....#...........#............... +...................#..#........#..#........#...#.. +...#.........................#...#...#.....#...... +..#.................#..........................#.. +.................#..................#..........#.# +#.....#......#.#.........#.............#......##.. +..#...............#........................##..#.. +.................#....#....#....#..#.............. +.#.#.....#............#....#...##.#...#........... +.................#.............##.............#... +.#...#..........##...#....#.....#.............##.# +...........#........#......#........#.....#.#.#.#. +........#.....#......#.....##...................#. +...#.....#.............#.....................##... +..................#...........##.#.....#....#..... +#............#..#........#...................#.... +..........................................#.....#. +...................#.............................. +..#.........#.....#..............#...#............ +....................................#............. +.....#...#......#................................. +.....#.............#...............#.......#.....# +#####.#.................#.........#.......#..#.... +...........##.....#...##...#............#......... +#.................#.........#.......#....#........ +Front +#.............#......................#....#..#..#. +....#.............#.........#...#.......#......... +...#..................##......#................... +.........#...#..#..##............#................ +.......#.......#.#.......#.....................#.# +.......................#.....#....#....#.......... +#.....................#.........#................. +............#.................##.....##........#.. +................#...............#.........#......# +..........................#...#....#.....#.....#.. +#.......#..#......#.....#.........#.....#......#.. +..........................#...#................#.. +#...#...#..............#.......#..............#... +........................##........#........#.##... +.........#........#..#.....#...................... +......#...#......#..........#......#.......#.#.... +.........#......................#..........#...... +..............................#.......#.#......... +.........##.................#................#.... +..........#.............#......#.#...##.........#. +..........#.#.....#.............................#. +...#...#.##......#.#......#............#...#...... +...#.#.........#...#.#...#..#....#.............#.# +.....#............................................ +.....#.#......#....#.....#......#.......#......... +.................................#................ +.................................................. +.................#...............#................ +.#.#..#.....#..#.............#.##.........#....... +..#............#.................#...#............ +..............................#.#.#..#..#....#.... +.............#.................#..#............... +............#............#...........#..#......... +.....#.....#..........#....#..........##....##.... +.........#........................................ +..#........#.....#.......#............#....#...... +...#...#....#...........#...........#..........#.. +................#........#.#...................... +...............##....#...............#............ +.##.....................#....................#.... +............................##....#.....##......#. +........#.....#.................#.#..#......#..##. +.........#..............#..#...................... +#.............#......#................#....#..#... +............#.................#..........#.#..#.## +.#.....#.....#.....................#.............. +............#...#..............#...#.............. +.........#..............#.#...#............#...... +..#.#.......#.#.........##.#...........#.......#.. +..........#..#........##.............#....#....... +Left +.........#..###.................#................. +#..#.#...#..........#............#......#..##..... +.........................#..................#.#... +....#.......#..#.#...#.#..#..............#........ +.#..........#.....#...#..#.#...........#.......... +#..................#.........#........#...#....... +.........#............#........#.................. +#.#............................................... +...#..#........##......#...#..#.....#............. +.........................................#........ +#...#......#..#.....................#.........#... +.##.................#...#..........#......#...#... +...#....#.......#............#..........##........ +...............#..#.........................#..... +....#........#..###................#.....#.#...... +..#...............#.##...........#.#.....#........ +.....#...#......................................#. +.......#.....#..#.............#................... +.....#..#.....................#.#.....#...##...... +....................#.#.................#......... +.....#..#...........#.#.....................#..... +.............#..............#.....#...........#... +.........#....#..........#............#.##.#...... +...#.....................................#........ +...................#..#.#...................#...## +.............#.................................... +.....#....#..........#........#...##...........#.. +#...........................#.#..#.............#.. +........#........#........#...#..............##... +...............................##...............#. +..#.#........#..................#............#.... +.#......................#....#........##.......... +.......#.....#.......#.......#.................... +...#................................#.......#..##. +..#.#..........#..........#........#..........#... +......#..............#............................ +...........#............#.#..#.........#.........# +....#..#......##........#..........#...........#.. +...............................................#.. +.........#.............#.......#........#.....#... +.....#...#......#..#........##.........#......#... +#....#.....#..............#..#....#.............#. +.#..........#...#.....#............#.............. +...#.................................#............ +..#..........#.................................... +............#......#.........#....#.........#..... +..........#....#...#.............................. +.....................#............#..........#..#. +....##............#..............#................ +..#..........#.................................... +Bottom +.....#...............##........................... +....#.##.#........................................ +...#..........................#.#..............#.. +.................................#......#....#.... +..#............................................... +......#......#.....................#.#............ +...........#..#..............................#.... +#.#............................................... +.....................#..............#.....#....... +....#..................................#..#....... +.................................................. +.#..#....#...#.#.........#............#.....#..... +..........#.....#..............##..........#...... +..................#........##..................... +...#...............#...................#.........# +....#.....#.............#.###.#..........#........ +#..............................#...............#.. +..........#..###...............#........#..#...... +.........................#.......#................ +.......#..#......................#.##............. +.....#...#...........................#.#..#....... +.......#......##.................................. +...........#............................#......... +#..#.#..........................................## +.#.#...#..................#.......#............... +...#........#.#.....#.......................#....# +..#......#......................#.......#.#..#.#.. +.........#...................#..........#......... +......#.................................##........ +...#................................#.......#..... +#.........#....##.....#.................#........# +..................#...........#.#...#............. +...............#....#...#............##....#...... +..................................#...##....#..... +#......#..##............#.....................#... +.................#...#.......#.#.......#.......... +..........#............................#.......... +...................#..........#..............#.... +.................#.#.........#........#..#.#...... +...........#...............#...................... +.............#........#.......................#..# +...............#..........#..........#...........# +##......#.......#...#...........#......#.......... +....#.........#..........................#....#... +#.......#............#............................ +.............#..........#....#..#................. +...............##.....#.....#......#..#.........#. +...#.#........#..#.....#......#.#.............##.. +..##.................#.............#.#............ +...................................#.............. +Back +.#...#......#.....................##..........##.. +....#.....................#.......#............... +...#...#.#....#..#............#..#....#..#.#...... +#.##..#....#........#.......................#..... +..........#....#.....#.#......#......#.......#.... +..#.....##........##......#....#...#.#...#........ +...#..........#..#..........#..................... +......#...#....##.#.#.#...........#......#......#. +.................................................. +.......#......#.......#..........##...#........... +....#.....#....................#.................. +.##...............#..........#..........#......#.. +.........#.#.......#.............................. +...........#........#....................#........ +..#...#...#...................#................... +....#.........#.#............#........#......#.##. +....................................#......#..###. +......#...#..................#...#................ +................................................#. +.............#.......#.#.....#.....##.......##.... +......#..#.............#.....................#.... +............#.........#....#...........##..#...... +..#................#...#..............#.........#. +....#.......#............#.....#......#........... +........##..#.......#...#......................... +.............#.......#........##............#....# +#........................#............#........... +......#............#..###..##.#.#................. +...#.#................#......#.................... +..#.......#............##....#...#........#....... +........#..#....#............................#...# +......................#.#.............#.......#..# +..........#.#...................#.#.......###..#.. +.#......................#................#........ +....#...#..............#......##...#...........#.. +....#..........#......#.....#..................... +.#.....#.......................................... +..#............................................... +......#...#.............#........#........#.....#. +......#.#..#..........##.......###................ +................#.#..#.......#..#................. +.................###.................#............ +.............#..#...............#........##....... +...............#..#............................... +......#........................#...........#....#. +...#.#...........................#.#...........#.. +.............#.#........................#...#..... +..#..........#..........#......................... +.#....#.....#...#............#.........#.......... +....#.#...#...................#.#.....#.#......... + +42L12R17L16L29R20R13L15R44L30R44R27L9L23R49R17L19L50L46L5R17L4R17R41R4R7R13R41R29R17R13R27R30L2R49R24L19L41L2L43L26R46L34R3L37L4L18L12L18L37R17R47L33L9R16L7R30R44L5L30R12R22L33L12R12R40R6R48L37R50L41L38L6R33L24L49L11L29L31L21R24R11L46R22L50R34R31L2L23R29L32R46L2L49L23L48L44R22R30L21L41R43R41L44R19R7R3R1R19R3R35L39R13R20L10R35L34L7R14L42R25L33L7L13R14R1L19R30L11L33R32L33R14R50R18L48R8L11L16L21L34R2L9L24L12R27L19R1L32R36L34L14L5L38L33L12R43L46R13R26R6R9L49R42R8L29R45L47R30R30R9R17R29R9R44L20L41R32L32L18R29R1L32R5R17R50R45R7R43R10R40R48L28R4L22R5L5L5R11L23R34L12R24R19L25R16L29L33R18L41L38R47L10R49L39R30L37R31L21L33L24L30L21L47R41L25L21R15L39R31R47L38L46R4R13L27L38R35L5L31L20L8R43L14L43L20L5R33L6L39L46R41L10R24L21L9R43R23L1L3R34R10L8L34R22R2L14L11R41L24L29L47L12L36L24L9R19L16R41L49R32R32R44R13R6R21R17R18L1L6R5L2L50R32L24L4R2R9R38R32R41L21L48L48R39R41R48R16R5L46L25R20R9R38R26L34R30L8L38R32R49R5L41L28R40R13R11L13R43R6R21R20L17R46R40L20L24L27L45R40R13R27R16R36R1R32L40L28L12L30L1R24L44L8R10R14R30L12R44R48L49R46R30L18R24L15R18R8R38R26L3L6L24R2R38R29L29R26R46L8L44L13L26R28L38L2R12L14R46L47R42L15L26R43L46R37L50L10L38R24R22L49R18R16R37R12R20R33L35R27R41R37R7R45R4L4L9L37L44L22R18L34R21R6L39L38L47R24L48L19R32L21R32L48R13L20R15L42R1R6L39L2R8L3L47R14L29L12L15R39R34L40R39R27L46R30L38R18R10L40L20R37R44R16L37L45R12R50L8L21R46R19L29L9R21L1R23L23L43R3R42L45L17R26L32R34R15R4L45L7R23R5L21R24R30L41R37L18R34L12L27L39R28R47L50R35L13L40L13R48L47R16R35R2L32L41R45R32L38L4R4L9L7R2R21L33L27L46L39R5R46L1R39L23R18L33L10L3L5L45L35L27L19R44L24R17R39L16R40R8L36R31R41L23R9R45R29R48R24L23R49L16L27R16R19R27R44L9R48R42L6R37R25L1L46R7L25R33R32R26L9L48R7R44L40L10R49R9L34L29R6R30L18R8R46R44R17R37L1L30R12L8R12R18R38R18R22R40R47L7L28R34L42L4L43L46L29L35L33L22R6R30L1R42L17R27L6L11R36L36L38L24L9R36R32R21R50R2R2R46R12L11R15L40R17L7R20R39L27L13R27R22L7L17L49L5R5L7R42R32R27L27L46R48L3R34L13R16R27R37R27L6R40L33R7R45R44L9L45R44L12R17R46R22R19R13R25R4L25R34R42L38R37L32R14L15L37R10L38R42R12R8L5R7R46R49L20L29R26R24L18R22R38L5R4L42R29R41L29R49L2R21L22L7R31R37R45R24R12R44L29L36R15L4L4R26R46R9L4R43R33L40R5L23R25R3R26L1R35L40R38R12R11R1L15L9L19R10R39R10R31R30R19L39L24L44R13L36R32L27R43L4L38R39L24L32R11L3R22R24R6R36L20R43R6L23L30R18R45R31R32R4R5R37R33R49L20L49R11R15R1R42L10R19R9L31L41R44R9R25L28R4L7L35L11L29L2L19L12L27R46R29L1L5L18R19L27L3R12R43R50R21R4L35R42R3R28R1R38R32L33R41L2L41L41R17L3R35L38R28L23R34L14L35R32R12R12R47L3L7R32R4L1R33L5L13R23R26L5R21L27R47R37R8R38R25R44L50R48L42L33L39R33R42L26R50L2L27R26R50L18R40L41R36R11L50L50R7R33L9L21L15L43R18L10R15R44L48L6L16L17R5R20L35R20L9L37R20L17R9L4L22R23L12R49R44L22L3L3R23R6L42L18L49L42L17L43L50L23L20R40R47L33L26R29R15L39R25R33R29L20L50L12R34R2R38L44L37L8L30R40L18R49R10L17L23R8L39R47L16L31R46L24R24R7L28R48R13R1L42L48R49R5R10R19L18L33R26L44R23L17L18L10R28L33L33L34R35R28R42R45L21L32L25R50R42L38R9R29L42R8L23R41R6L1L10R38R7L2L27R45L36L30L48R5R15R35R16R20L48R32R5R21L23R29L48L39R31L30L39R22R42L12R46R39L9L10R48R37R40L35L40R48R13R30R12L40R27L47R17L5L25R36L35R27L44L48L19L16L44L17L36L12L45L30R29L42R39L16R16R50L25R45L45R37L37R36R36R8R12R1L21R12R30L5L6L13L40L39R37L49L9L3L45R21L1R18L9L38L3R48L38R11R25L36L33L26R46L50L19L28L7L4R32R25L30L28L42L10R38R40R36L48R40R14R32R26R16L15R43R30L48R12R16L48R45R23L6L12L46L12R34R26R26L29R20L30L20L2L24L31R35L50L39L29R9R10L42R31L6L47L10R34L40R34R39R37R37R11R39L1R50R22R40R10R24L30L43L7L9R32L7R31R7R16R29R42R38R12L17L12R7L40L38L25L3L12L9L21R20L41L6R32L12L22R8L23R15L15L19R44L12L39R46R35R33L36R28R6L43L45L27R17L4R1L31L8R23R36R21R39R4L45R11R31L41R41R7R48L1L23R15R9L15L39R40L20L29L20L39R15R3L34L18L32R16R5R22L46R11L17R13L19R36L16L43R9L14L5L8L30R21R29L1R33R39L24L31R18R48R15L49R42R28R22L14R7R4R1R23R2L36R27L27R36L3R38L33L39R9L6L45L8L7L49L17L11L31L11L26L26L42R40L2R26R50R45L38L47R28R28R4R43R9L7R27R28R1L31L30L31L50R34R38R16L5R12L43L10L6L6L20L30R29L42R23R3R22R21R45L13R26L41L19L4R39R34L39R26L8R8L36L34L10L23R37R35R6L49L45L43L9R24R42L42R37R3L17L7L30L3R14R40R2R4R7L20L48L46L43L50R34R40L8L37L29R11R16L21R41L31R24L2L34L28L5L3R45L18R19L39L16L42R7L9R30R41R48L17L49R42R38L11R19R41R13L43R1L6R39R31R39R39R31L8L10L27L22R36L47L31L13L35R19R13R35R44R12R2R33L14R36R29L12L29R5R11R11L47L8L23L38R28R48L26R44R21L46R32L37R31R25R36L12R12L20R6L44R8R12R43L49L42L36R45L25R19L10L42L30R33L34R26R45R31R16R11R8R12L41L39L16L22L32R41R5L12R8R26R5L21L35L17L25L20L26L36R10L26L23R37R28R34L29R40R47L41R36R16R36L48R7R4L47L44L46L38R2L21R3L8L24L37R39L21L37L50L9R48R28L37L10R39R43L43R42R16R47R27R4R33L25L40R48R3R10L41L22L47R14L40L42L42L7R34L41L22L33L17R4R34R47R46L26R30R22R4R12R19L41L14L40L45L31L3L13R31L5L38L25L11R24L27L33L14R47L16L44R25R14R10L3R17R20R34R49L31R8L3L28R21R3R50L19L6R11L29R1R37R38L34L6L11L33L47R11L9L16R29L29L21L29L47R30L25L37R15L19R27L37R23L43R6L39R22R14R42L21R24R32R50R34L45R6L41R14L33R18L20L18L35L5R37L35R17R24R30L32L38R44R43R50L17R7R48R48R43L9L9L37L1L34L35R44R22L16L44R33R15R35L30L15R6R22R50L18L37L26L4L8L7R14L40L18R39R10L35R48R43L14L15L24R45L39R50L29R17L49L16L24L7R38R46L3L26R46R19R22R15R32L33L18L12R35L24L26R38L40L21R12R36L50R5R33L33R38R20L48L30L25L12R35L8R5R7L9L1L50L25R3R32L12L4L16R20L17R10L24L15R47L31R23L32R42R6L47L20L8L23L15R48L20R26L34R13R42L42R47L43L15R20L27L30L34L37R16L33R30R4L36L43L27L31R30L27R30R39R50L37L42R42L11L15L27L29R21R43R23R50R38L6L43L48R1L17L3R1L12R3R21L2R37L49L17L12L32L46R34R40L1L2R50L18L15R1L28R14L16L30R34L38L38R40R31L21R47R37L20R21L16L16R42L39R39L10R47R36R9R4R41L44L25R39L11L33L45L42L31R16L45L22L40R24R39R3R16R8L5L44L39L15L3L31L42L14L35L7R9L41L25R26L46L31R14R17L3L40L12L36L17R30L1L40L8L48L19R44R20L41R38R46L4L34L23R41R24R17L17L47L42L14L40R27L15R39R45R48L30R10L34L10R1L2R4R8R45L1L15L36R16L30L1R9R31R13L19L34R8R26L46R44L20R24L38R17L48L31R49R43R21L1R16L37R4R29R40R41L46R16R4L33 diff --git a/2022/day22/main.go b/2022/day22/main.go new file mode 100644 index 0000000..ac7faf5 --- /dev/null +++ b/2022/day22/main.go @@ -0,0 +1,422 @@ +package main + +import ( + "fmt" + "math" + + h "git.bullercodeworks.com/brian/adventofcode/helpers" +) + +func main() { + inp := h.StdinToStringSlice() + //part1(inp) + part2(inp) +} +func part1(inp []string) { + board, inst := inp[:len(inp)-2], inp[len(inp)-1] + b := BuildBoard(board) + var count int + var turn byte + fmt.Println(b) + fmt.Println(b.pos) + for len(inst) > 0 { + count, turn, inst = getNextInstructions(inst) + b.Move(count) + if turn == 'L' || turn == 'R' { + b.Turn(turn) + } + } + fmt.Println("Password:", b.Password()) +} + +func part2(inp []string) { + board, inst := inp[:len(inp)-2], inp[len(inp)-1] + b := BuildCubeBoard(board) + var count int + var turn byte + fmt.Println(b) + fmt.Println(b.pos) + for len(inst) > 0 { + count, turn, inst = getNextInstructions(inst) + b.Move(count) + if turn == 'L' || turn == 'R' { + b.Turn(turn) + } + } + fmt.Println("Password:", b.Password()) +} + +func getNextInstructions(inst string) (int, byte, string) { + for i := range inst { + if inst[i] == 'L' || inst[i] == 'R' { + return h.Atoi(inst[:i]), inst[i], inst[i+1:] + } + } + return h.Atoi(inst), 0, "" +} + +const ( + dirR = iota + dirD + dirL + dirU + dirErr + + sideTop = iota + sideBottom + sideRight + sideLeft + sideFront + sideBack +) + +type CubeBoard struct { + Top *CubeBoardSide + Bottom *CubeBoardSide + Left *CubeBoardSide + Right *CubeBoardSide + Front *CubeBoardSide + Back *CubeBoardSide + + // Pos now holds: + // y, x, dir, side + pos []int +} + +// For the purposes of directions, we treat the board like this: +// [T] +// [B][L][F][R] +// [B] +// So up from left, front, back, and right are all top +// Up from bottom is front +// Down from bottom is back +// Up from top is back +// Down from top is front +// So you can continually go left on the main level and circumnavigate the cube +// Continually going up from anywhere will eventually get you bouncing between top and back +// Continually going down from anywhere will eventually get you bouncing between bottom and back +func BuildCubeBoard(inp []string) *CubeBoard { + cb := CubeBoard{} + var side string + for i := 0; i < len(inp); i++ { + if len(inp) == 0 { + break + } + side = inp[i] + i++ + cbs := BuildCubeBoardSide(inp[i : i+len(inp[i])]) + switch side { + case "Top": + cb.Top = cbs + case "Bottom": + cb.Bottom = cbs + case "Left": + cb.Left = cbs + case "Right": + cb.Right = cbs + case "Front": + cb.Front = cbs + case "Back": + cb.Back = cbs + } + i = i + cbs.Size() - 1 + } + cb.pos = []int{0, 0, dirR, sideTop} + return &cb +} +func (cb *CubeBoard) Size() int { return cb.Top.Size() } +func (cb *CubeBoard) Move(count int) { + +} +func (cb *CubeBoard) GetPosUp() []int { + y := cb.pos[0] + x := cb.pos[1] + dir := cb.pos[2] + side := cb.pos[3] + if y == 0 { + // Going to another side + switch side { + case sideTop: + side = sideBack + case sideBottom: + side = sideFront + case sideFront: + side = sideTop + case sideBack: + side = sideTop + case sideLeft: + side = sideTop + case sideRight: + side = sideTop + } + } + return []int{y, x, dir, side} +} +func (cb *CubeBoard) GetPosDown() []int { + y := cb.pos[0] + x := cb.pos[1] + dir := cb.pos[2] + side := cb.pos[3] + if y == cb.Size()-1 { + // Going to another side + switch side { + case sideTop: + side = sideFront + case sideBottom: + side = sideBack + case sideFront: + side = sideBottom + case sideBack: + side = sideBottom + case sideLeft: + side = sideBottom + case sideRight: + side = sideBottom + } + } else { + y = y + 1 + } + return []int{y, x, dir, side} +} +func (cb *CubeBoard) GetPosRight() []int { + y := cb.pos[0] + x := cb.pos[1] + dir := cb.pos[2] + side := cb.pos[3] + if x == cb.Size()-1 { + // Going to another side + switch side { + case sideTop: + side = sideRight + case sideBottom: + side = sideRight + case sideFront: + side = sideRight + case sideBack: + side = sideLeft + case sideLeft: + side = sideFront + case sideRight: + side = sideBack + } + } else { + y = y + 1 + } + return []int{y, x, dir, side} +} + +// Get the current pos' side +func (cb *CubeBoard) Side() *CubeBoardSide { + switch cb.pos[3] { + case sideTop: + return cb.Top + case sideBottom: + return cb.Bottom + case sideFront: + return cb.Front + case sideBack: + return cb.Back + case sideLeft: + return cb.Left + case sideRight: + return cb.Right + } + return nil +} +func (cb *CubeBoard) Turn(dir byte) { + if dir == 'R' { + cb.pos[2] = (cb.pos[2] + 1) % dirErr + } else if dir == 'L' { + cb.pos[2] = (cb.pos[2] - 1 + dirErr) % dirErr + } +} +func (cb *CubeBoard) Tile(y, x, side int) byte { + switch side { + case sideTop: + return cb.Top.Tile(y, x) + case sideBottom: + return cb.Bottom.Tile(y, x) + case sideLeft: + return cb.Left.Tile(y, x) + case sideRight: + return cb.Right.Tile(y, x) + case sideFront: + return cb.Front.Tile(y, x) + case sideBack: + return cb.Back.Tile(y, x) + } + return 0 +} +func (cb *CubeBoard) Password() int { + return 0 +} + +type CubeBoardSide struct { + spots [][]byte +} + +func BuildCubeBoardSide(inp []string) *CubeBoardSide { + cbs := CubeBoardSide{} + fmt.Println("Building CBS from:", inp) + cbs.spots = make([][]byte, len(inp)) + for y := range inp { + row := make([]byte, len(inp[y])) + for x := range inp[y] { + row[x] = inp[y][x] + } + cbs.spots[y] = row + } + return &cbs +} +func (cbs *CubeBoardSide) Size() int { + return len(cbs.spots) +} +func (cbs *CubeBoardSide) Tile(y, x int) byte { + if len(cbs.spots) < y && len(cbs.spots[y]) < x { + return cbs.spots[y][x] + } + return 0 +} + +type Board struct { + spots [][]byte + // pos holds + // y, x, dir + pos []int +} + +func BuildBoard(inp []string) *Board { + maxX := math.MinInt + for y := range inp { + maxX = h.Max(maxX, len(inp[y])) + } + b := Board{ + spots: make([][]byte, len(inp)), + } + for y := range inp { + sl := make([]byte, maxX) + for x := range inp[y] { + sl[x] = inp[y][x] + } + b.spots[y] = sl + } + + b.pos = make([]int, 3) + for x := range b.spots[0] { + if b.spots[0][x] == '.' { + b.pos = []int{0, x, dirR} + break + } + } + return &b +} +func (b *Board) Password() int { + return ((b.pos[0] + 1) * 1000) + ((b.pos[1] + 1) * 4) + b.pos[2] +} +func (b *Board) Tile(y, x int) byte { + if len(b.spots) > y && len(b.spots[y]) > x { + return b.spots[y][x] + } + return 0 +} +func (b *Board) GetNextPos() []int { + switch b.pos[2] { + case dirU: + return b.GetPosUp() + case dirR: + return b.GetPosRight() + case dirD: + return b.GetPosDown() + case dirL: + return b.GetPosLeft() + } + return []int{-1, -1} +} +func (b *Board) GetPosUp() []int { + x := b.pos[1] + y := ((b.pos[0] - 1) + len(b.spots)) % len(b.spots) + for (b.spots[y][x] == 0 || b.spots[y][x] == 32) && y != b.pos[0] { + y = ((y - 1) + len(b.spots)) % len(b.spots) + } + return []int{y, x} +} +func (b *Board) GetPosRight() []int { + y := b.pos[0] + x := (b.pos[1] + 1) % len(b.spots[y]) + for (b.spots[y][x] == 0 || b.spots[y][x] == 32) && x != b.pos[1] { + x = (x + 1) % len(b.spots[y]) + } + return []int{y, x} +} +func (b *Board) GetPosDown() []int { + x := b.pos[1] + y := (b.pos[0] + 1) % len(b.spots) + for (b.spots[y][x] == 0 || b.spots[y][x] == 32) && y != b.pos[0] { + y = (y + 1) % len(b.spots) + } + return []int{y, x} +} +func (b *Board) GetPosLeft() []int { + y := b.pos[0] + x := ((b.pos[1] - 1) + len(b.spots[y])) % len(b.spots[y]) + for (b.spots[y][x] == 0 || b.spots[y][x] == 32) && x != b.pos[1] { + x = ((x - 1) + len(b.spots[y])) % len(b.spots[y]) + } + return []int{y, x} +} + +func (b *Board) Move(count int) { + var to []int + for count > 0 { + switch b.pos[2] { + case dirU: + to = b.GetPosUp() + case dirR: + to = b.GetPosRight() + case dirD: + to = b.GetPosDown() + case dirL: + to = b.GetPosLeft() + } + if b.Tile(to[0], to[1]) == '.' { + count-- + b.pos[0], b.pos[1] = to[0], to[1] + } else { + break + } + } +} + +func (b *Board) Turn(dir byte) { + if dir == 'R' { + b.pos[2] = (b.pos[2] + 1) % dirErr + } else if dir == 'L' { + b.pos[2] = (b.pos[2] - 1 + dirErr) % dirErr + } +} + +func (b Board) String() string { + var ret string + for y := range b.spots { + for x := range b.spots[y] { + bt := b.spots[y][x] + if b.pos[1] == x && b.pos[0] == y { + switch b.pos[2] { + case dirU: + bt = '^' + case dirR: + bt = '>' + case dirD: + bt = 'v' + case dirL: + bt = '<' + default: + bt = '!' + } + } + ret = ret + fmt.Sprint(string(bt)) + } + ret = ret + "\n" + } + return ret +} diff --git a/2022/day22/problem b/2022/day22/problem new file mode 100644 index 0000000..7901411 --- /dev/null +++ b/2022/day22/problem @@ -0,0 +1,156 @@ + Advent of Code + + • [About] + • [Events] + • [Shop] + • [Settings] + • [Log Out] + + br0xen (AoC++) 36* + +    var y=2022; + + • [Calendar] + • [AoC++] + • [Sponsors] + • [Leaderboard] + • [Stats] + + Our sponsors help make Advent of Code possible: + Infi - De kerstman wil weer cadeaus bezorgen maar komt tot de ontdekking dat zijn + Kerstman Positioning System (KPS) niet meer werkt. Kan jij hem helpen? + +--- Day 22: Monkey Map --- + + The monkeys take you on a surprisingly easy trail through the jungle. They're even + going in roughly the right direction according to your handheld device's Grove + Positioning System. + + As you walk, the monkeys explain that the grove is protected by a force field. To pass + through the force field, you have to enter a password; doing so involves tracing a + specific path on a strangely-shaped board. + + At least, you're pretty sure that's what you have to do; the elephants aren't exactly + fluent in monkey. + + The monkeys give you notes that they took when they last saw the password entered + (your puzzle input). + + For example: + + ...# + .#.. + #... + .... + ...#.......# + ........#... + ..#....#.... + ..........#. + ...#.... + .....#.. + .#...... + ......#. + + 10R5L5R10L4R5L5 + + The first half of the monkeys' notes is a map of the board. It is comprised of a set + of open tiles (on which you can move, drawn .) and solid walls (tiles which you cannot + enter, drawn #). + + The second half is a description of the path you must follow. It consists of + alternating numbers and letters: + + • A number indicates the number of tiles to move in the direction you are facing. If + you run into a wall, you stop moving forward and continue with the next + instruction. + • A letter indicates whether to turn 90 degrees clockwise (R) or counterclockwise + (L). Turning happens in-place; it does not change your current tile. + + So, a path like 10R5 means "go forward 10 tiles, then turn clockwise 90 degrees, then + go forward 5 tiles". + + You begin the path in the leftmost open tile of the top row of tiles. Initially, you + are facing to the right (from the perspective of how the map is drawn). + + If a movement instruction would take you off of the map, you wrap around to the other + side of the board. In other words, if your next tile is off of the board, you should + instead look in the direction opposite of your current facing as far as you can until + you find the opposite edge of the board, then reappear there. + + For example, if you are at A and facing to the right, the tile in front of you is + marked B; if you are at C and facing down, the tile in front of you is marked D: + + ...# + .#.. + #... + .... + ...#.D.....# + ........#... + B.#....#...A + .....C....#. + ...#.... + .....#.. + .#...... + ......#. + + It is possible for the next tile (after wrapping around) to be a wall; this still + counts as there being a wall in front of you, and so movement stops before you + actually wrap to the other side of the board. + + By drawing the last facing you had with an arrow on each tile you visit, the full path + taken by the above example looks like this: + + >>v# + .#v. + #.v. + ..v. + ...#...v..v# + >>>v...>#.>> + ..#v...#.... + ...>>>>v..#. + ...#.... + .....#.. + .#...... + ......#. + + To finish providing the password to this strange input device, you need to determine + numbers for your final row, column, and facing as your final position appears from the + perspective of the original map. Rows start from 1 at the top and count downward; + columns start from 1 at the left and count rightward. (In the above example, row 1, + column 1 refers to the empty space with no tile on it in the top-left corner.) Facing + is 0 for right (>), 1 for down (v), 2 for left (<), and 3 for up (^). The final + password is the sum of 1000 times the row, 4 times the column, and the facing. + + In the above example, the final row is 6, the final column is 8, and the final facing + is 0. So, the final password is 1000 * 6 + 4 * 8 + 0: 6032. + + Follow the path given in the monkeys' notes. What is the final password? + + To begin, get your puzzle input. + + Answer: _____________________ [ [Submit] ] + + You can also [Shareon Twitter Mastodon] this puzzle. + +References + + Visible links + . https://adventofcode.com/ + . https://adventofcode.com/2022/about + . https://adventofcode.com/2022/events + . https://teespring.com/stores/advent-of-code + . https://adventofcode.com/2022/settings + . https://adventofcode.com/2022/auth/logout + . Advent of Code Supporter + https://adventofcode.com/2022/support + . https://adventofcode.com/2022 + . https://adventofcode.com/2022 + . https://adventofcode.com/2022/support + . https://adventofcode.com/2022/sponsors + . https://adventofcode.com/2022/leaderboard + . https://adventofcode.com/2022/stats + . https://adventofcode.com/2022/sponsors + . https://aoc.infi.nl/?mtm_campaign=aoc2022&mtm_source=aoc + . https://adventofcode.com/2022/day/22/input + . https://twitter.com/intent/tweet?text=%22Monkey+Map%22+%2D+Day+22+%2D+Advent+of+Code+2022&url=https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F22&related=ericwastl&hashtags=AdventOfCode + . javascript:void(0); diff --git a/2022/day22/testinput b/2022/day22/testinput new file mode 100644 index 0000000..8bc2e1e --- /dev/null +++ b/2022/day22/testinput @@ -0,0 +1,14 @@ + ...# + .#.. + #... + .... +...#.......# +........#... +..#....#.... +..........#. + ...#.... + .....#.. + .#...... + ......#. + +10R5L5R10L4R5L5 diff --git a/2022/day22/testinput-m b/2022/day22/testinput-m new file mode 100644 index 0000000..b6eeaaf --- /dev/null +++ b/2022/day22/testinput-m @@ -0,0 +1,32 @@ +Top +...# +.#.. +#... +.... +Back +...# +.... +..#. +.... +Left +.... +.... +...# +.... +Front +...# +#... +.... +..#. +Bottom +...# +.... +.#.. +.... +Right +.... +.#.. +.... +..#. + +10R5L5R10L4R5L5 diff --git a/2022/day23/input b/2022/day23/input new file mode 100644 index 0000000..ff490ba --- /dev/null +++ b/2022/day23/input @@ -0,0 +1,73 @@ +.#.###...###....##..####.#.###.####.#..##......#.####.###.###...#.####.## +.#...#.####.##.#.#.#####.#.#.....#...#.####.#..#.###.###....##.#.###.#... +.....#..#........###.##.......###..#.....#####......###.#.#.####..#...#.# +.##.##.#.####....###.#..###..#########..##....#..##..#.##.#....#.#.##.#.# +..#..##...#.#..##.#...###.#.#..#...#....####.##.##...#.###.###...##..#.#. +###.###....#.##.#...#.##.##.##..###.#.#..##...###.###...###.#.#..#.###### +.#.#####..#.####.###..##.#.#.#.#.#.#...##.####.#..#.#####.#..#....#.#..#. +..######.##.#.##.###..#.#.#.#.##..###.######..#.......######.#.##.##..#.# +#####......#.......######.#####.###..###......#..#..###.....#.#####...... +##...#.#..###.#######.###.##########...#...#.##.#..#..##.#...#.##....##.. +####.#...######....##..#.###.#...#.#.#..########...#..#######.####.#.#.## +#....###..#.##..###.....#.#####...#.##....###..##.#..##..#....###......#. +##.#..#.##.#.####...#.....##.##.#.#.######.#.###.....##..#......#..##.#.. +.......#.#####.#..#.##.#....##..#.##.#..#..#.###.#.##...#..#.##.#..#..... +#.#..#...#..####.#.#.###..###..#######.#...#....##..###...#...##.###.###. +#.#..#..#...##..#.#...#..#.#.#..#.#..#####......##..##.#...#.#.###....##. +#..#...##.#.#.#....##......##...#.###.#..#..#...#.###.####.#.##..##....#. +###.#..#.#.##..#.##......#...####.....##...#.#......##..######.#.#..#..#. +.......#.######...##..#....#.#...##......#.....#..###.######.#...#.####.# +...##.....#....#.##.##.########.#..#....#####.######....##.###...#.#.##.. +##...##..#...#.#..#..#.#.##.###.########..##...#..##....##..##..#####..## +##..#####..#.####..##...#.##..##.##..#....####..####..#.########.#######. +.#.#.######..#.##.###.#.#...#.#...###..#.##.#####.##.####.#...####.##.### +##.#..#.#####.#....#..##...##..##.###..#.#....#.##....###.....#..##.##..# +##.##.#..##.###.#.##.#..###...##.##...##.###...####.###...#.####.#.....#. +.#.##..#####..#..#.....#####.#.#.###.#.#.####.##....##..#..##.####.###... +.#...#.#.######.#....##.##.#.##...#..#.##....##...#.##.....###.#......### +##....###.##.###.##.###..##...####..#..#####..##..........##.....#.#.#..# +..#####.##.#...#......#..###..#...##..#.###....##.##.##.####.#.##.###..## +##.##..#####..####..#..##.#....##...#..####..######...##..##.#.###.#.##.# +.#.#..#...######.###..##.#......##.##..#.##.##..#.##.#.#.###.##..###....# +..###.#...#......#.#.#........#.#######..#.#.######..##.#...###.##.#....# +#..####.....#.#.#.#.###...#..##.#.#.##.#.#...###.#.#.#.#####..#.##.###..# +##...####.....#....#.####.#....#...####.########..#....######.#..##..#.## +.#.#.##...########.#######.......##......###..#....########..#......#..## +.##......#..#######..#....#..##.#.####..##.#.#..##..##..#######..###.#.#. +..##.######...##..#.#.##...##.###.##.##....##.#...#..#..#..###.####...... +.#.###.###.#..###..#.#.##.#..##.#.#..#.####.#.#...##.#####.#.##..#..##.#. +.#..#........#..#..#.#..####.#.#....#.#.#.#...##...####..##.##.##.#.##.#. +##...#.#.#.###...#....###..####.##..##.##..#.#####.##....#..##.########.# +.#.#..##.#.####..#..#...#.######...###.#.#####.###.##.##..............##. +.....###.#..###.#.##...#.#.####..##.#####.##..#.###.##.....#..##.#.#.#.#. +##.#...###.#.#.###.#...#....#.#.....#.#..#.#..###.##.#...##..#####.#..#.. +.###....#######.##.#..#####.#.#.##.#..###.#.#.###.#.#.###...#.##.....###. +##.#.#.#...#...#.#...#.....##..###..#......#.#.###.#.#.##.##..####.####.. +#.###.#####.#####....#..###..####.###.#####..##.....#.#####.###...#..#.#. +.#..#..#..##..####.######...#...#.#.#.#....#.#......###...###.....#..###. +#..####.##.#.#..##..#####.###..#.######.##..####.........##.....##..#.#.. +#..#.#..##.#.#..##..##.#.#.#.#..#.#....#.#.###.#.#.##.#.#.#..###..#...### +##....###.##..#..##.##.#.##.#.....#...###.######....#.##.##.#..##.##...## +.#..#....#...#.###..########.#...#..#.#.###.#.###...#..#.#..##.###.##..## +#.#.##.##.#...######.#...#...###.###.##...###.#..#.##...#.###.###.##.#.## +.....#..##..##.####..##..#.###.#######.#...##..#...#####..##...####...... +#.#####..##...#.##...#.#...##....######.#.#####...#.....#.#..#.#...#..#.. +#####.####.####.#..#.####..##..###.######..##.###..####.#...#.#.###....#. +###..#.##.#######.#.#.#.#......###.#.##..##.##.##..#.#....#..####......#. +.....#..#..#..###...#.###..####.#...###...######.#.##....###.##..#..#..#. +#.#..##..##.##...#.###.#.###.#####.#.#.####.###.##.####..##.###..#.#####. +.###....#...#.##.####.#.....####..#.##..##..##.##.#.##.##..###.###.#..#.. +..#.###.....#...##..###.##....###..####.#.##.###.####.##.#.##.#...#.##### +.##.#..#....#..##.###..#..#.#..####.##.#...#.......###.#...#.##......#.#. +......###.##########..###.##..#...#....#....#.####....##.#.#.##.##......# +#.#.####..#.#..##..##......##..#####..##.#.#.###........#.#..#.#####.#.#. +#...###..#...##..#.#.##..#.#..#..#.##..#.#...#####..#.#.###.##.#..##.#.#. +..#.###.###..###..#.#.#.##.###.#####......#.###...##.#.##.###.##.##.##### +....###..##.#.##....#..###.#.##.###.#....#.##...#...####.#.#..##..##.#.#. +#..#.###.###.######.#.##.#..#.#.#...#..#........##..#...##.###.#.##.#...# +####...###...#.###.#..#.#.#..#.#..##....#.##.#..#.##.#..#.###.#.##.####.. +.#####....##.#..##.....##.#..#......#..##..#.....#..#.###.#.#.###...###.# +.#........#.....###.####..##....##.##....####.##.#####...##..#........#.. +...#####.#.####.#.#....#..##.#..#.#.##....###....#..#..#...##.#.##.##...# +#...##..#.####.####.##.##.###.##....#...#.####..##.#.......#..#.###..#..# +.##...#####..####..#.###.##..##.#.#...#....#.#..####..##...#.....#.##.##. diff --git a/2022/day23/main.go b/2022/day23/main.go new file mode 100644 index 0000000..dce5ad9 --- /dev/null +++ b/2022/day23/main.go @@ -0,0 +1,201 @@ +package main + +import ( + "fmt" + "math" + "sort" + + h "git.bullercodeworks.com/brian/adventofcode/helpers" +) + +func main() { + inp := h.StdinToStringSlice() + part1(inp) + part2(inp) +} + +func part1(inp []string) { + field := plotElves(inp) + for i := 0; i < 10; i++ { + proposals := buildProposals(field, i) + for k, v := range proposals { + delete(field, v) + field[k] = true + } + } + fmt.Println("# Part 1") + fmt.Println("Empty Tiles:", countEmpties(field)) +} +func part2(inp []string) { + field := plotElves(inp) + var lastHash string + for i := 0; i < 100000000; i++ { + proposals := buildProposals(field, i) + for k, v := range proposals { + delete(field, v) + field[k] = true + } + currHash := fieldHash(field) + if currHash == lastHash { + fmt.Println("# Part 2") + fmt.Println("Stable on round", i+1) + return + } + lastHash = currHash + } + fmt.Println("# Part 2") + fmt.Println("No solution found.") +} +func fieldHash(field map[h.Coordinate]bool) string { + var sorted []h.Coordinate + for k := range field { + sorted = append(sorted, k) + } + sort.Slice(sorted, func(i, j int) bool { + if sorted[i].X == sorted[j].X { + return sorted[i].Y > sorted[j].Y + } + return sorted[i].X > sorted[j].X + }) + return fmt.Sprintf("%v", sorted) +} + +func countEmpties(field map[h.Coordinate]bool) int { + maxX, minX := math.MinInt, math.MaxInt + maxY, minY := math.MinInt, math.MaxInt + for k := range field { + maxX = h.Max(maxX, k.X) + minX = h.Min(minX, k.X) + maxY = h.Max(maxY, k.Y) + minY = h.Min(minY, k.Y) + } + var ret int + for y := minY; y <= maxY; y++ { + for x := minX; x <= maxX; x++ { + if _, ok := field[h.Coordinate{X: x, Y: y}]; !ok { + ret++ + } + } + } + return ret +} +func printField(field map[h.Coordinate]bool) { + maxX, minX := math.MinInt, 0 + maxY, minY := math.MinInt, 0 + for k := range field { + maxX = h.Max(maxX, k.X) + minX = h.Min(minX, k.X) + maxY = h.Max(maxY, k.Y) + minY = h.Min(minY, k.Y) + } + maxX = maxX + 2 + maxY = maxY + 2 + for y := minY; y <= maxY; y++ { + for x := minX; x <= maxX; x++ { + if _, ok := field[h.Coordinate{X: x, Y: y}]; ok { + fmt.Print("#") + } else { + fmt.Print(".") + } + } + fmt.Println() + } +} +func plotElves(inp []string) map[h.Coordinate]bool { + field := make(map[h.Coordinate]bool) + for y := range inp { + for x := range inp[y] { + if inp[y][x] == '#' { + field[h.Coordinate{X: x, Y: y}] = true + } + } + } + return field +} +func buildProposals(field map[h.Coordinate]bool, round int) map[h.Coordinate]h.Coordinate { + props := make(map[h.Coordinate]h.Coordinate) + var errProps []h.Coordinate + for k := range field { + var neighbors []h.Coordinate + for _, n := range k.GetAllNeighbors() { + if _, ok := field[n]; ok { + neighbors = append(neighbors, n) + } + } + if len(neighbors) == 0 { + continue + } + var hasNorth, hasEast, hasSouth, hasWest bool + for _, n := range neighbors { + if n.Y < k.Y { + hasNorth = true + } + if n.Y > k.Y { + hasSouth = true + } + if n.X < k.X { + hasWest = true + } + if n.X > k.X { + hasEast = true + } + } + addProp := func(c h.Coordinate) { + if _, ok := props[c]; ok { + errProps = append(errProps, c) + } else { + props[c] = k + } + } + testNorth := func(c h.Coordinate) bool { + if !hasNorth { + addProp(k.North()) + return true + } + return false + } + testSouth := func(c h.Coordinate) bool { + if !hasSouth { + addProp(k.South()) + return true + } + return false + } + testWest := func(c h.Coordinate) bool { + if !hasWest { + addProp(k.West()) + return true + } + return false + } + testEast := func(c h.Coordinate) bool { + if !hasEast { + addProp(k.East()) + return true + } + return false + } + findProposal := func(c h.Coordinate, tests ...func(h.Coordinate) bool) { + for i := range tests { + if tests[i](c) == true { + return + } + } + } + switch round % 4 { + case 0: // North First + findProposal(k, testNorth, testSouth, testWest, testEast) + case 1: // South First + findProposal(k, testSouth, testWest, testEast, testNorth) + case 2: // West First + findProposal(k, testWest, testEast, testNorth, testSouth) + case 3: // East First + findProposal(k, testEast, testNorth, testSouth, testWest) + } + } + // Now remove all conflicts + for i := range errProps { + delete(props, errProps[i]) + } + return props +} diff --git a/2022/day23/problem b/2022/day23/problem new file mode 100644 index 0000000..c4a80fd --- /dev/null +++ b/2022/day23/problem @@ -0,0 +1,299 @@ +Advent of Code +br0xen (AoC++) 39* + +--- Day 23: Unstable Diffusion --- + + You enter a large crater of gray dirt where the grove is supposed to be. All around + you, plants you imagine were expected to be full of fruit are instead withered and + broken. A large group of Elves has formed in the middle of the grove. + + "...but this volcano has been dormant for months. Without ash, the fruit can't grow!" + + You look up to see a massive, snow-capped mountain towering above you. + + "It's not like there are other active volcanoes here; we've looked everywhere." + + "But our scanners show active magma flows; clearly it's going somewhere." + + They finally notice you at the edge of the grove, your pack almost overflowing from + the random star fruit you've been collecting. Behind you, elephants and monkeys + explore the grove, looking concerned. Then, the Elves recognize the ash cloud slowly + spreading above your recent detour. + + "Why do you--" "How is--" "Did you just--" + + Before any of them can form a complete question, another Elf speaks up: "Okay, new + plan. We have almost enough fruit already, and ash from the plume should spread here + eventually. If we quickly plant new seedlings now, we can still make it to the + extraction point. Spread out!" + + The Elves each reach into their pack and pull out a tiny plant. The plants rely on + important nutrients from the ash, so they can't be planted too close together. + + There isn't enough time to let the Elves figure out where to plant the seedlings + themselves; you quickly scan the grove (your puzzle input) and note their positions. + + For example: + + ....#.. + ..###.# + #...#.# + .#...## + #.###.. + ##.#.## + .#..#.. + + The scan shows Elves # and empty ground .; outside your scan, more empty ground + extends a long way in every direction. The scan is oriented so that north is up; + orthogonal directions are written N (north), S (south), W (west), and E (east), while + diagonal directions are written NE, NW, SE, SW. + + The Elves follow a time-consuming process to figure out where they should each go; you + can speed up this process considerably. The process consists of some number of rounds + during which Elves alternate between considering where to move and actually moving. + + During the first half of each round, each Elf considers the eight positions adjacent + to themself. If no other Elves are in one of those eight positions, the Elf does not + do anything during this round. Otherwise, the Elf looks in each of four directions in + the following order and proposes moving one step in the first valid direction: + + • If there is no Elf in the N, NE, or NW adjacent positions, the Elf proposes moving + north one step. + • If there is no Elf in the S, SE, or SW adjacent positions, the Elf proposes moving + south one step. + • If there is no Elf in the W, NW, or SW adjacent positions, the Elf proposes moving + west one step. + • If there is no Elf in the E, NE, or SE adjacent positions, the Elf proposes moving + east one step. + + After each Elf has had a chance to propose a move, the second half of the round can + begin. Simultaneously, each Elf moves to their proposed destination tile if they were + the only Elf to propose moving to that position. If two or more Elves propose moving + to the same position, none of those Elves move. + + Finally, at the end of the round, the first direction the Elves considered is moved to + the end of the list of directions. For example, during the second round, the Elves + would try proposing a move to the south first, then west, then east, then north. On + the third round, the Elves would first consider west, then east, then north, then + south. + + As a smaller example, consider just these five Elves: + + ..... + ..##. + ..#.. + ..... + ..##. + ..... + + The northernmost two Elves and southernmost two Elves all propose moving north, while + the middle Elf cannot move north and proposes moving south. The middle Elf proposes + the same destination as the southwest Elf, so neither of them move, but the other + three do: + + ..##. + ..... + ..#.. + ...#. + ..#.. + ..... + + Next, the northernmost two Elves and the southernmost Elf all propose moving south. Of + the remaining middle two Elves, the west one cannot move south and proposes moving + west, while the east one cannot move south or west and proposes moving east. All five + Elves succeed in moving to their proposed positions: + + ..... + ..##. + .#... + ....# + ..... + ..#.. + + Finally, the southernmost two Elves choose not to move at all. Of the remaining three + Elves, the west one proposes moving west, the east one proposes moving east, and the + middle one proposes moving north; all three succeed in moving: + + ..#.. + ....# + #.... + ....# + ..... + ..#.. + + At this point, no Elves need to move, and so the process ends. + + The larger example above proceeds as follows: + + == Initial State == + .............. + .............. + .......#...... + .....###.#.... + ...#...#.#.... + ....#...##.... + ...#.###...... + ...##.#.##.... + ....#..#...... + .............. + .............. + .............. + + == End of Round 1 == + .............. + .......#...... + .....#...#.... + ...#..#.#..... + .......#..#... + ....#.#.##.... + ..#..#.#...... + ..#.#.#.##.... + .............. + ....#..#...... + .............. + .............. + + == End of Round 2 == + .............. + .......#...... + ....#.....#... + ...#..#.#..... + .......#...#.. + ...#..#.#..... + .#...#.#.#.... + .............. + ..#.#.#.##.... + ....#..#...... + .............. + .............. + + == End of Round 3 == + .............. + .......#...... + .....#....#... + ..#..#...#.... + .......#...#.. + ...#..#.#..... + .#..#.....#... + .......##..... + ..##.#....#... + ...#.......... + .......#...... + .............. + + == End of Round 4 == + .............. + .......#...... + ......#....#.. + ..#...##...... + ...#.....#.#.. + .........#.... + .#...###..#... + ..#......#.... + ....##....#... + ....#......... + .......#...... + .............. + + == End of Round 5 == + .......#...... + .............. + ..#..#.....#.. + .........#.... + ......##...#.. + .#.#.####..... + ...........#.. + ....##..#..... + ..#........... + ..........#... + ....#..#...... + .............. + + After a few more rounds... + + == End of Round 10 == + .......#...... + ...........#.. + ..#.#..#...... + ......#....... + ...#.....#..#. + .#......##.... + .....##....... + ..#........#.. + ....#.#..#.... + .............. + ....#..#..#... + .............. + + To make sure they're on the right track, the Elves like to check after round 10 that + they're making good progress toward covering enough ground. To do this, count the + number of empty ground tiles contained by the smallest rectangle that contains every + Elf. (The edges of the rectangle should be aligned to the N/S/E/W directions; the + Elves do not have the patience to calculate arbitrary rectangles.) In the above + example, that rectangle is: + + ......#..... + ..........#. + .#.#..#..... + .....#...... + ..#.....#..# + #......##... + ....##...... + .#........#. + ...#.#..#... + ............ + ...#..#..#.. + + In this region, the number of empty ground tiles is 110. + + Simulate the Elves' process and find the smallest rectangle that contains the Elves + after 10 rounds. How many empty ground tiles does that rectangle contain? + + Your puzzle answer was 4000. + +--- Part Two --- + + It seems you're on the right track. Finish simulating the process and figure out where + the Elves need to go. How many rounds did you save them? + + In the example above, the first round where no Elf moved was round 20: + + .......#...... + ....#......#.. + ..#.....#..... + ......#....... + ...#....#.#..# + #............. + ....#.....#... + ..#.....#..... + ....#.#....#.. + .........#.... + ....#......#.. + .......#...... + + Figure out where the Elves need to go. What is the number of the first round where no + Elf moves? + + Your puzzle answer was 1040. + + Both parts of this puzzle are complete! They provide two gold stars: ** + +References + + Visible links + . https://adventofcode.com/ + . https://adventofcode.com/2022/about + . https://adventofcode.com/2022/events + . https://adventofcode.com/2022/settings + . https://adventofcode.com/2022/auth/logout + . Advent of Code Supporter + https://adventofcode.com/2022/support + . https://adventofcode.com/2022 + . https://adventofcode.com/2022 + . https://adventofcode.com/2022/support + . https://adventofcode.com/2022/sponsors + . https://adventofcode.com/2022/leaderboard + . https://adventofcode.com/2022/stats + . https://adventofcode.com/2022/sponsors + . https://adventofcode.com/2022 + . https://adventofcode.com/2022/day/23/input diff --git a/2022/day23/testinput b/2022/day23/testinput new file mode 100644 index 0000000..14005cf --- /dev/null +++ b/2022/day23/testinput @@ -0,0 +1,7 @@ +....#.. +..###.# +#...#.# +.#...## +#.###.. +##.#.## +.#..#.. diff --git a/2022/day23/testinput2 b/2022/day23/testinput2 new file mode 100644 index 0000000..57a5784 --- /dev/null +++ b/2022/day23/testinput2 @@ -0,0 +1,6 @@ +..... +..##. +..#.. +..... +..##. +..... diff --git a/go.mod b/go.mod index 355a45b..2d3b962 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.bullercodeworks.com/brian/adventofcode -go 1.13 +go 1.16 require ( github.com/br0xen/termbox-screen v0.0.0-20190712162752-c91f70ac38c6 diff --git a/helpers/coordinate.go b/helpers/coordinate.go index a5c7a39..157487a 100644 --- a/helpers/coordinate.go +++ b/helpers/coordinate.go @@ -66,6 +66,13 @@ func (c *Coordinate) SE() Coordinate { func (c *Coordinate) GetOrthNeighbors() []Coordinate { return []Coordinate{c.North(), c.East(), c.South(), c.West()} } +func (c *Coordinate) GetAllNeighbors() []Coordinate { + return []Coordinate{ + c.North(), c.NE(), + c.East(), c.SE(), + c.South(), c.SW(), + c.West(), c.NW()} +} func (c *Coordinate) GetNorthCoord() *Coordinate { return &Coordinate{