diff options
author | Oscar Najera <hi@oscarnajera.com> | 2023-12-08 12:41:42 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2023-12-08 12:41:42 +0100 |
commit | 62e05f0717a2173e729cf10b4f29edc1270d6278 (patch) | |
tree | a4ae59df2a0cad0f9edbeeb13cad9a04e3c3a983 /AoC2023 | |
parent | 6034110b9ffdadde83dc57f14e8d24a94b6587ff (diff) | |
download | scratch-62e05f0717a2173e729cf10b4f29edc1270d6278.tar.gz scratch-62e05f0717a2173e729cf10b4f29edc1270d6278.tar.bz2 scratch-62e05f0717a2173e729cf10b4f29edc1270d6278.zip |
[AoC2023] day08 lisp part1
Diffstat (limited to 'AoC2023')
-rw-r--r-- | AoC2023/day08/input | 756 | ||||
-rw-r--r-- | AoC2023/day08/solver.lisp | 41 |
2 files changed, 797 insertions, 0 deletions
diff --git a/AoC2023/day08/input b/AoC2023/day08/input new file mode 100644 index 0000000..f4dab37 --- /dev/null +++ b/AoC2023/day08/input @@ -0,0 +1,756 @@ +LLRRRLRLLRLRRLRLRLRRRLLRRLRRRLRRRLRRRLRRRLRRRLRRLRLLRRRLRRLLRLRLLLRRLRRLRLRLRLRRRLRLRRRLRRLLLRRRLLRRLLRRLLRRRLLLLRLRLRRRLRLRRRLRLLLRLRRLRRRLRRRLRRRLRRRLLRRLLLLRRLLRRLLRRLRLRRRLRRRLRRRLRRLRRRLRRLRRLRRLRLRRRLRRLRRRLRRRLRRLRLRRRLRRLLRLRRLRRRLRLRRLRRRLRRLRRLRRRLLRRRR + +GXF = (XQB, GFH) +QQC = (HQF, BNK) +TPP = (XNG, FDD) +LQD = (MGR, GJN) +XNG = (RCM, BJG) +NQC = (KNT, DQF) +DGJ = (PGM, LSB) +RBF = (RCH, RCH) +DNH = (RTL, MLF) +VKF = (SRV, TQR) +MPT = (FVV, TVP) +TKX = (VRN, KNV) +XLQ = (MCF, MCF) +MNJ = (FRT, QGV) +STF = (LFQ, QDS) +FFH = (JVM, TCJ) +KRT = (GFC, HRX) +FVG = (QFS, RSJ) +DBH = (GXF, DJL) +RKP = (VNL, MSC) +VQX = (GGG, RPB) +FCM = (VMC, MGV) +SRL = (LVV, JQN) +HHM = (BDM, FRV) +GMN = (LPK, FHT) +QCF = (RCH, NJM) +PCB = (MDJ, KDM) +VMR = (THX, HHB) +XQK = (BJQ, LST) +FCS = (KPT, RSC) +XTG = (XTL, SVX) +FVF = (KXB, VVV) +NNR = (SBM, TPP) +NPH = (RHN, FRR) +GJF = (FXG, MLP) +TRR = (LVC, RMR) +NBS = (SFH, JGT) +SSH = (KTK, DDM) +CJH = (QJK, XHB) +DQF = (NSR, MJB) +FHT = (PFK, GPS) +GTJ = (QXC, XBR) +KQB = (JXT, KGR) +JLL = (GTJ, CBN) +QPH = (LTX, BDJ) +BSP = (MRH, BXJ) +QBX = (GPR, SHJ) +SPJ = (SLD, XQK) +PML = (TTV, BHX) +FQN = (TPJ, BTV) +GTK = (NBS, VNP) +DSQ = (RFN, QGB) +KTK = (JHR, FCM) +FXV = (BBN, VPK) +LJC = (VKH, PPQ) +NBA = (JBL, LSR) +RKK = (VTL, SNM) +FVV = (DQS, CSM) +MGJ = (QHP, DPL) +RND = (JRQ, XGJ) +DVP = (RBF, RBF) +JXR = (TJN, CVC) +FMV = (CVJ, BVZ) +XBL = (KFC, HHT) +GDR = (KCV, KCV) +NGN = (VKH, PPQ) +NJB = (VTH, FSQ) +MBD = (JKS, SFQ) +TGC = (PXP, TTF) +VMT = (XJN, CCH) +LBF = (QRB, SKN) +DGH = (CSD, RND) +SFH = (XHH, GSC) +QQD = (VTT, NLX) +BLB = (GHJ, KQD) +LFG = (TLH, XJT) +CQS = (FRR, RHN) +XRS = (QLF, KLC) +DJL = (GFH, XQB) +LJM = (RPM, HPF) +HHT = (LBF, VCS) +GFL = (LFG, MGQ) +TNX = (TSJ, HCK) +HPR = (MTG, TJX) +LKP = (BXL, BHG) +KRC = (DCT, CTS) +PSJ = (QPF, MQT) +CXG = (NPG, JQP) +QTK = (XBL, DSM) +SVP = (MLF, RTL) +NDT = (NLC, MLK) +TDR = (DJR, CJQ) +RHS = (HXN, PSZ) +PSZ = (VNG, NNK) +KKL = (GLH, SPJ) +RSB = (SFQ, JKS) +PQS = (XVK, LMV) +TTV = (MLG, FRH) +CJQ = (CTM, KCC) +VTT = (QSQ, TVV) +TCJ = (MTD, KKX) +CNM = (SXQ, RGK) +XCC = (DNP, FQN) +CXD = (TJX, MTG) +VTL = (JFV, DHN) +BJG = (FHB, QVJ) +MJR = (HDL, LSF) +CSV = (CTS, DCT) +LFQ = (LNX, RHQ) +MNL = (XBL, DSM) +NDR = (PGT, TPC) +CKS = (CDQ, GLT) +VVV = (BVL, QQC) +GGG = (JGS, VRC) +QRT = (SQJ, VSJ) +HQF = (NJK, NJK) +JGK = (FJK, PXJ) +RXG = (CLT, GTK) +TNH = (SJM, QNX) +HLX = (QJX, PGN) +FRR = (CKP, NHC) +QMK = (QVH, QLH) +FRT = (TMB, VRX) +KJD = (GBS, QMT) +RCH = (TGC, TGC) +JGF = (DKD, CHG) +TSM = (TDR, XHJ) +MTG = (DRP, KRR) +DCF = (NQC, KNM) +VPQ = (HRB, MGG) +XVK = (MPC, XMX) +NNK = (FKT, CMD) +TBF = (JDV, LQD) +TTH = (SJM, QNX) +NLX = (TVV, QSQ) +HGT = (LSF, HDL) +FCB = (KLC, QLF) +GBH = (HTJ, LXL) +BJQ = (XDH, RGV) +FLH = (FXV, SMJ) +XGN = (CHN, BLJ) +RGV = (QCB, TCC) +BCV = (NHF, NDH) +GQD = (LDC, TVB) +BCT = (KGS, QCH) +NGC = (MGJ, RPT) +LSL = (QVH, QLH) +SQJ = (TTH, TNH) +VNL = (RLV, CRK) +XCQ = (KQB, BLP) +CDL = (DJL, GXF) +MJB = (CRR, HHM) +GSP = (DQJ, FLV) +NCM = (SQN, VPJ) +JRQ = (RJM, CXG) +SXA = (QPH, CFB) +LBT = (GPL, NDJ) +QNX = (PJT, PQC) +PBV = (RRP, TSM) +CSD = (XGJ, JRQ) +MLK = (GLG, SKB) +CFB = (LTX, BDJ) +BCH = (HPQ, JBR) +BBN = (RHR, VMT) +KCV = (RHL, RHL) +SGG = (SMP, QSP) +GFB = (KCF, KJR) +TSD = (NSD, NDL) +CXL = (FVG, JCJ) +FSQ = (FQG, GXQ) +BQF = (HRB, MGG) +LRK = (JPG, BHR) +LBB = (BHX, TTV) +CXR = (BXX, STP) +MGV = (RLK, FDX) +FHB = (LCN, KSX) +JDQ = (GFK, BHD) +FJL = (GDR, GDR) +TSN = (RKJ, GLN) +VPK = (RHR, VMT) +VCS = (SKN, QRB) +BKG = (RSC, KPT) +LQB = (MMQ, BCT) +KJK = (SMF, VPM) +XMV = (PQS, RCX) +TCC = (GPP, KRT) +BFS = (DDP, VJJ) +FDD = (RCM, BJG) +BHG = (MKG, BSM) +GQP = (PRR, FFH) +GXQ = (BLH, FMB) +XBV = (NSH, GCB) +MCF = (QPH, CFB) +BTD = (BCH, GFM) +JQD = (VPQ, BQF) +JGT = (XHH, GSC) +KGS = (MGB, QQS) +JMF = (PSK, GDD) +VTZ = (NNR, NVQ) +JGS = (KHM, DTS) +CBF = (NDJ, GPL) +XPM = (MCF, VGZ) +RSJ = (VCC, MGS) +BLQ = (HJP, MPP) +HHB = (NKX, PXK) +JKS = (DKV, GMN) +GFH = (RXG, VGP) +MSC = (RLV, CRK) +KJR = (SLQ, FLH) +KFC = (VCS, LBF) +GGM = (KJK, QJF) +QDS = (RHQ, LNX) +TPC = (PFD, DJN) +DSM = (HHT, KFC) +BPJ = (RKK, GGV) +MLG = (PDG, SGF) +HTJ = (RBJ, PKL) +HJR = (MRH, BXJ) +JVA = (NVQ, NNR) +PXK = (CRV, RHB) +NJK = (CVJ, CVJ) +XPR = (PGT, TPC) +DTS = (FCS, BKG) +XJN = (TFT, LKP) +SNV = (DDT, LBL) +BXX = (KKQ, GBH) +PQM = (MXJ, FTT) +NSX = (HLX, GVH) +CVJ = (JBL, LSR) +HKQ = (VMR, DSR) +RQJ = (QFV, XMV) +CMQ = (KKL, QDL) +PGM = (VBL, KFF) +LST = (RGV, XDH) +CMD = (HKQ, SPB) +XSV = (LBB, PML) +JHB = (SSB, CXR) +LVC = (JHB, TVH) +QNT = (RBB, NDT) +QPF = (FJG, TKX) +NDH = (RRT, PQM) +TSJ = (LGH, FBN) +KDM = (GJJ, NVX) +HMJ = (HPF, RPM) +STP = (GBH, KKQ) +LDC = (LBT, CBF) +RCB = (BPN, JXR) +MSN = (PDF, JHF) +KKX = (HVX, BKX) +GLT = (VHR, GGM) +MRH = (LCD, CKD) +VGP = (CLT, GTK) +LLV = (MRN, PBV) +PDL = (DGH, LNK) +PFD = (RCB, VRH) +CRK = (NGC, KQR) +TVP = (CSM, DQS) +VTH = (GXQ, FQG) +RHJ = (SHN, PNR) +MMQ = (QCH, KGS) +GFK = (VDV, XCC) +PQC = (SRF, KML) +SHJ = (CHD, DCB) +QJF = (SMF, VPM) +QLF = (NGX, RKP) +LTX = (RNS, VHH) +RQB = (MGQ, LFG) +BHD = (XCC, VDV) +FQG = (BLH, FMB) +SNM = (JFV, DHN) +LRQ = (JDL, QBX) +SHP = (FRT, QGV) +DDP = (CRJ, SXV) +LMV = (XMX, MPC) +KMP = (HQB, SSK) +GXM = (SRV, TQR) +SMP = (JGK, GST) +KRH = (PBV, MRN) +RDM = (FKN, MSN) +FNF = (VJJ, DDP) +VKH = (CJX, PDB) +NHF = (PQM, RRT) +PBJ = (RMR, LVC) +FRG = (QJC, BPL) +RHG = (BGQ, XCQ) +RPB = (VRC, JGS) +KQD = (VBS, MBN) +LSR = (SRH, CSS) +KFF = (MFT, NSX) +TJX = (KRR, DRP) +GPL = (FPQ, SSH) +XNM = (BCH, GFM) +MPP = (RLX, FVF) +HQB = (DJJ, SPV) +SSK = (SPV, DJJ) +XVA = (SHP, MNJ) +TMT = (VRS, JHH) +NGX = (MSC, VNL) +SMF = (HFP, JMF) +SFQ = (DKV, GMN) +GBM = (NDH, NHF) +DKV = (FHT, LPK) +PTN = (FCD, SRL) +GPB = (CVS, GFD) +QFR = (BLQ, LCT) +TLH = (KMP, LFS) +TVG = (BHD, GFK) +RRT = (MXJ, FTT) +DCB = (BPC, GJF) +VRN = (CVH, PLG) +MGG = (RGR, DDB) +XND = (LGX, FCN) +HDC = (DJP, BPJ) +TCV = (NNV, MDV) +JQP = (LSL, QMK) +KLC = (NGX, RKP) +DPL = (VSL, GQP) +BHX = (MLG, FRH) +HNK = (LFQ, QDS) +RHR = (CCH, XJN) +RCM = (FHB, QVJ) +JVN = (RHL, VTZ) +HSS = (LXF, LXF) +XQB = (RXG, VGP) +XJQ = (NLN, XLD) +HFP = (PSK, GDD) +HCK = (FBN, LGH) +VHR = (KJK, QJF) +MLF = (MPT, SGJ) +TPS = (PGM, LSB) +HJJ = (CQS, NPH) +LMQ = (JQD, VPR) +GPR = (CHD, DCB) +QFS = (MGS, VCC) +SKB = (SMG, STS) +CKT = (CCJ, RJH) +SDV = (NGN, LJC) +DJB = (DVP, SHV) +CDR = (RQJ, BPH) +QHP = (VSL, GQP) +PFK = (HQJ, XSV) +PNM = (NRQ, JGF) +SQN = (LJM, HMJ) +KXB = (BVL, QQC) +NHX = (XDQ, PTN) +TFT = (BHG, BXL) +XDH = (TCC, QCB) +XFN = (QGB, RFN) +BLJ = (QRV, GGH) +QLH = (SGG, QHQ) +KPT = (LQB, TNG) +VBS = (PDL, PJH) +RFN = (GFL, RQB) +JDL = (GPR, SHJ) +NNV = (VSN, BRN) +JNV = (KDM, MDJ) +SLK = (FLV, DQJ) +JPG = (XRS, FCB) +DQJ = (NGR, XKM) +LMT = (GJC, BKT) +GFD = (DMP, XND) +RJM = (NPG, JQP) +GLH = (XQK, SLD) +SPB = (DSR, VMR) +MGQ = (TLH, XJT) +SNL = (MLR, VTM) +KNT = (MJB, NSR) +DDM = (FCM, JHR) +TDD = (GLN, RKJ) +RRX = (XLQ, XPM) +SGF = (SNL, FJF) +BTV = (GFB, SMX) +BPH = (XMV, QFV) +VSJ = (TNH, TTH) +DSD = (DVP, SHV) +JXT = (DGJ, TPS) +DDV = (NNV, MDV) +DRP = (KDS, TNJ) +MTD = (HVX, BKX) +CVH = (FFD, RDM) +LCD = (CMJ, CMJ) +NLC = (SKB, GLG) +XJT = (LFS, KMP) +CHG = (DHF, FVX) +MFT = (HLX, GVH) +HRX = (HPM, XGN) +KGR = (TPS, DGJ) +GLJ = (NSH, GCB) +GPP = (GFC, HRX) +TVV = (NFR, QNT) +QJK = (QKQ, KDV) +XHH = (NJB, PVR) +BHR = (FCB, XRS) +CKD = (CMJ, RRX) +XKM = (VQX, RDL) +PXJ = (GBM, BCV) +DCT = (HDC, BFG) +HXN = (NNK, VNG) +QGG = (BPH, RQJ) +DQS = (FKL, NCM) +STL = (DDT, LBL) +PDB = (FNF, BFS) +ZZZ = (TTF, PXP) +SHV = (RBF, QCF) +NGL = (GDR, XRQ) +QVH = (QHQ, SGG) +CBN = (XBR, QXC) +RNT = (KRC, CSV) +GCB = (DDF, LMQ) +NDL = (DDV, TCV) +SRV = (CDR, QGG) +DMP = (LGX, LGX) +RKJ = (KFG, FRG) +SKG = (KBH, LRQ) +QGB = (RQB, GFL) +XBR = (GQD, QJV) +DHN = (LMT, NBB) +LPK = (PFK, GPS) +QVS = (HJJ, TQJ) +MSV = (RJH, CCJ) +CCK = (SQJ, VSJ) +QHQ = (SMP, QSP) +PKL = (RVD, BDX) +JDV = (MGR, GJN) +FDX = (JFT, TNX) +DJN = (RCB, VRH) +XGJ = (CXG, RJM) +DJJ = (VKF, GXM) +VPR = (VPQ, BQF) +PGT = (PFD, DJN) +RGR = (RPS, NBT) +BRK = (BSP, HJR) +KKQ = (LXL, HTJ) +VRC = (DTS, KHM) +GST = (FJK, PXJ) +SLD = (BJQ, LST) +GHL = (NRQ, JGF) +HQJ = (PML, LBB) +BLH = (RNT, JFC) +SPV = (GXM, VKF) +VPM = (JMF, HFP) +RBB = (MLK, NLC) +FTT = (PVF, DVS) +XRQ = (KCV, JVN) +LSB = (VBL, KFF) +QMT = (CCK, QRT) +FBN = (XNM, BTD) +JFT = (TSJ, HCK) +HDL = (QHL, XNP) +BPC = (FXG, MLP) +TVB = (LBT, CBF) +KNM = (KNT, DQF) +CHN = (QRV, GGH) +SRH = (XQN, NNC) +LXF = (HXN, HXN) +VCC = (SKG, QQR) +VMM = (RGK, SXQ) +FCD = (LVV, JQN) +FMB = (RNT, JFC) +CNC = (PTN, XDQ) +KCC = (JLL, VFC) +CDQ = (VHR, GGM) +QFV = (RCX, PQS) +XQN = (RHG, TKF) +SMJ = (VPK, BBN) +SRF = (JDQ, TVG) +SKN = (RLS, RHJ) +KXX = (KHL, LFJ) +GJN = (BRK, FPX) +QGV = (VRX, TMB) +SXV = (GQM, KJD) +VGZ = (CFB, QPH) +JQN = (XFN, DSQ) +BKT = (CBT, PVD) +QJC = (PBJ, TRR) +BLP = (JXT, KGR) +TTF = (MMV, MFK) +PXP = (MMV, MFK) +PSK = (KMJ, QQD) +VPJ = (HMJ, LJM) +RPQ = (CDL, DBH) +RPS = (NDR, XPR) +QQS = (VDG, XJP) +GGH = (PCB, JNV) +KHL = (MLT, PSJ) +NPG = (QMK, LSL) +XDQ = (SRL, FCD) +MXJ = (PVF, DVS) +VGG = (XLD, NLN) +DNP = (TPJ, BTV) +XRN = (LRK, QXS) +XTS = (NQC, KNM) +FJF = (MLR, VTM) +MVL = (THG, GPB) +TPJ = (GFB, SMX) +FJG = (VRN, KNV) +NDX = (JDV, LQD) +JHR = (MGV, VMC) +KNV = (CVH, PLG) +NSH = (LMQ, DDF) +THG = (CVS, GFD) +RDL = (RPB, GGG) +BNK = (NJK, FMV) +FHG = (THG, GPB) +NKX = (RHB, CRV) +MMV = (CKS, FRS) +RHB = (GSP, SLK) +GVH = (QJX, PGN) +LFS = (HQB, SSK) +SJM = (PQC, PJT) +TVH = (CXR, SSB) +FKN = (JHF, PDF) +KRR = (TNJ, KDS) +HPQ = (FJL, NGL) +PDG = (FJF, SNL) +RRP = (TDR, XHJ) +LGX = (XVV, XVV) +QKQ = (TDD, TSN) +GQM = (GBS, QMT) +MQT = (FJG, TKX) +HRB = (RGR, DDB) +HQS = (DJB, DSD) +XMX = (MNL, QTK) +LGH = (XNM, BTD) +QJX = (PPC, KXX) +JBR = (FJL, NGL) +FRV = (HGT, MJR) +BXN = (QXS, LRK) +GFM = (HPQ, JBR) +MDV = (VSN, BRN) +PPQ = (PDB, CJX) +FRH = (PDG, SGF) +KBH = (QBX, JDL) +LNX = (XTG, MJV) +PHD = (XJQ, VGG) +DJR = (KCC, CTM) +LNK = (RND, CSD) +SVX = (HRJ, RPQ) +BVZ = (LSR, JBL) +STS = (CMQ, MGX) +DDF = (VPR, JQD) +GHJ = (MBN, VBS) +HVX = (CXD, HPR) +JBL = (CSS, SRH) +HPF = (BNS, QFR) +DSR = (THX, HHB) +KMJ = (VTT, NLX) +GFC = (XGN, HPM) +CJX = (FNF, BFS) +FKT = (SPB, HKQ) +MBN = (PDL, PJH) +NLN = (CXL, KNR) +GSC = (PVR, NJB) +LFJ = (MLT, PSJ) +NBT = (NDR, XPR) +RLK = (TNX, JFT) +SSB = (BXX, STP) +FJK = (GBM, BCV) +VRX = (CJH, KXH) +DJP = (RKK, GGV) +HRJ = (CDL, DBH) +XHB = (QKQ, KDV) +BVL = (HQF, HQF) +PVF = (VMM, CNM) +GLN = (KFG, FRG) +KHM = (BKG, FCS) +VHH = (MBJ, PHD) +XPV = (DJB, DSD) +MJV = (XTL, SVX) +BDJ = (VHH, RNS) +RLS = (SHN, PNR) +CBT = (RQM, JJX) +PRR = (JVM, TCJ) +DVS = (VMM, CNM) +KXH = (QJK, XHB) +SHD = (LXF, RHS) +GPS = (XSV, HQJ) +MGR = (BRK, FPX) +BXJ = (LCD, CKD) +RBJ = (RVD, BDX) +JFC = (KRC, CSV) +GDD = (QQD, KMJ) +KDS = (TBF, NDX) +BRN = (HSS, SHD) +QXC = (QJV, GQD) +GLG = (STS, SMG) +MGX = (QDL, KKL) +MLT = (MQT, QPF) +HPM = (BLJ, CHN) +CKP = (CNC, NHX) +KML = (TVG, JDQ) +AAA = (PXP, TTF) +BPZ = (MNJ, SHP) +FPQ = (DDM, KTK) +NSR = (CRR, HHM) +XLD = (CXL, KNR) +PLG = (FFD, RDM) +RPM = (BNS, QFR) +SGJ = (FVV, TVP) +BPL = (PBJ, TRR) +RHN = (NHC, CKP) +MGB = (XJP, VDG) +RJH = (BTK, FBK) +VNP = (JGT, SFH) +BDX = (SNV, STL) +VSN = (HSS, HSS) +LCT = (MPP, HJP) +NBB = (GJC, BKT) +VRS = (GHL, PNM) +JJX = (BLB, FBQ) +TMB = (KXH, CJH) +RLX = (KXB, VVV) +NJM = (TGC, ZZZ) +VNG = (CMD, FKT) +GJJ = (MSV, CKT) +CVC = (SNH, TMT) +CVS = (DMP, DMP) +MFK = (CKS, FRS) +XHJ = (DJR, CJQ) +FCN = (XVV, BPZ) +JVM = (KKX, MTD) +RQM = (FBQ, BLB) +SLQ = (FXV, SMJ) +BNS = (LCT, BLQ) +DKD = (FVX, DHF) +JHF = (MBD, RSB) +FBQ = (GHJ, KQD) +KDV = (TSN, TDD) +FVL = (HJJ, TQJ) +LXL = (PKL, RBJ) +VDV = (FQN, DNP) +BDM = (HGT, MJR) +VDG = (KHJ, SDV) +BFG = (DJP, BPJ) +PNR = (XPV, HQS) +XTL = (RPQ, HRJ) +PGN = (PPC, KXX) +XNP = (LLV, KRH) +VTM = (DNH, SVP) +VJJ = (CRJ, SXV) +NVQ = (SBM, TPP) +RLV = (NGC, KQR) +THX = (NKX, PXK) +MLP = (GLJ, XBV) +MPC = (MNL, QTK) +FPX = (BSP, HJR) +NHC = (NHX, CNC) +CRV = (SLK, GSP) +NNC = (RHG, TKF) +SNH = (JHH, VRS) +KNR = (FVG, JCJ) +CRJ = (GQM, KJD) +PJT = (SRF, KML) +XJP = (KHJ, SDV) +BXL = (BSM, MKG) +QRB = (RHJ, RLS) +SMX = (KCF, KJR) +CSM = (FKL, NCM) +MGS = (QQR, SKG) +RTL = (SGJ, MPT) +CND = (NDL, NSD) +BTK = (QVS, FVL) +TNJ = (TBF, NDX) +JFV = (LMT, NBB) +CMJ = (XLQ, XLQ) +CCJ = (BTK, FBK) +SXQ = (FHG, MVL) +MLR = (DNH, SVP) +PJH = (LNK, DGH) +KFG = (QJC, BPL) +MRN = (RRP, TSM) +LBL = (HNK, STF) +NFR = (RBB, NDT) +NGR = (RDL, VQX) +PVR = (VTH, FSQ) +LVV = (XFN, DSQ) +RCX = (XVK, LMV) +FLV = (NGR, XKM) +CRR = (FRV, BDM) +BSM = (CND, TSD) +FVX = (XRN, BXN) +TKF = (XCQ, BGQ) +QSQ = (NFR, QNT) +XVV = (SHP, MNJ) +RVD = (SNV, STL) +MKG = (TSD, CND) +QCB = (GPP, KRT) +NVX = (MSV, CKT) +GGV = (VTL, SNM) +GJC = (PVD, CBT) +QSP = (JGK, GST) +VBL = (MFT, NSX) +DDB = (RPS, NBT) +BKX = (HPR, CXD) +FKL = (VPJ, SQN) +VRH = (BPN, JXR) +QQR = (KBH, LRQ) +RSC = (LQB, TNG) +NRQ = (DKD, CHG) +RHL = (NVQ, NNR) +QCH = (MGB, QQS) +CTS = (BFG, HDC) +KHJ = (NGN, LJC) +RGK = (MVL, FHG) +CCH = (LKP, TFT) +VSL = (FFH, PRR) +KQR = (RPT, MGJ) +LCN = (XTS, DCF) +TJN = (TMT, SNH) +CLT = (NBS, VNP) +JCJ = (QFS, RSJ) +BPN = (TJN, CVC) +FXG = (GLJ, XBV) +BGQ = (KQB, BLP) +RMR = (TVH, JHB) +CTM = (JLL, VFC) +KCF = (SLQ, FLH) +DHF = (XRN, BXN) +NDJ = (SSH, FPQ) +KSX = (XTS, DCF) +RPT = (DPL, QHP) +QJV = (TVB, LDC) +TNG = (BCT, MMQ) +FBK = (FVL, QVS) +MBJ = (XJQ, VGG) +CHD = (GJF, BPC) +LSF = (QHL, XNP) +SHN = (HQS, XPV) +TQR = (CDR, QGG) +GRA = (NNK, VNG) +RNS = (MBJ, PHD) +VFC = (GTJ, CBN) +PPC = (LFJ, KHL) +DDT = (STF, HNK) +NSD = (TCV, DDV) +VMC = (FDX, RLK) +QXS = (JPG, BHR) +PDF = (MBD, RSB) +QRV = (PCB, JNV) +QVJ = (KSX, LCN) +QDL = (GLH, SPJ) +MDJ = (GJJ, NVX) +HJP = (FVF, RLX) +FRS = (GLT, CDQ) +SBM = (FDD, XNG) +SMG = (CMQ, MGX) +TQJ = (NPH, CQS) +RHQ = (MJV, XTG) +FFD = (MSN, FKN) +CSS = (XQN, NNC) +PVD = (RQM, JJX) +GBS = (QRT, CCK) +JHH = (PNM, GHL) +QHL = (LLV, KRH) diff --git a/AoC2023/day08/solver.lisp b/AoC2023/day08/solver.lisp new file mode 100644 index 0000000..b552ef5 --- /dev/null +++ b/AoC2023/day08/solver.lisp @@ -0,0 +1,41 @@ +(ql:quickload '(fiveam str)) + ;12:13 + ; +(defparameter eg-input "LLR + +AAA = (BBB, BBB) +BBB = (AAA, ZZZ) +ZZZ = (ZZZ, ZZZ)") + +(defun parse-input (lines) + (let ((graph (make-hash-table))) + (destructuring-bind (instructions blank . nodes) lines + (declare (ignorable blank)) + (dolist (line nodes) + (with-input-from-string (in (str:replace-all "=|," "" line :regex t)) + (setf + (gethash (read in) graph) + (read in)))) + (values instructions graph)))) + +(defun traverse (instructions graph location steps) + (if (eq location 'ZZZ) + (values steps location) + (let ((new-steps (loop + for direction across instructions + do + (setf location + (ecase direction + (#\L (first (gethash location graph))) + (#\R (second (gethash location graph))))) + count direction until (eq location 'ZZZ)))) + (traverse instructions graph location (+ steps new-steps))))) + +(defun solver1 (lines) + (multiple-value-bind (instructions graph) + (parse-input lines) + (traverse instructions graph 'AAA 0))) + +(fiveam:test solutions + (fiveam:is (= 6 (solver1 (uiop:split-string eg-input :separator '(#\Newline))))) + (fiveam:is (= 19199 (solver1 (uiop:read-file-lines "input"))))) |