diff --git a/Day08/Day08/input-sample-2.txt b/Day08/Day08/input-sample-2.txt new file mode 100644 index 0000000..86fc262 --- /dev/null +++ b/Day08/Day08/input-sample-2.txt @@ -0,0 +1,6 @@ +LLR + +AAA = (BBB, BBB) +BBB = (AAA, ZZZ) +ZZZ = (ZZZ, ZZZ) + diff --git a/Day08/Day08/input-sample-part2.txt b/Day08/Day08/input-sample-part2.txt new file mode 100644 index 0000000..b103ceb --- /dev/null +++ b/Day08/Day08/input-sample-part2.txt @@ -0,0 +1,11 @@ +LR + +11A = (11B, XXX) +11B = (XXX, 11Z) +11Z = (11B, XXX) +22A = (22B, XXX) +22B = (22C, 22C) +22C = (22Z, 22Z) +22Z = (22B, 22B) +XXX = (XXX, XXX) + diff --git a/Day08/Day08/input-sample.txt b/Day08/Day08/input-sample.txt new file mode 100644 index 0000000..9029a1b --- /dev/null +++ b/Day08/Day08/input-sample.txt @@ -0,0 +1,9 @@ +RL + +AAA = (BBB, CCC) +BBB = (DDD, EEE) +CCC = (ZZZ, GGG) +DDD = (DDD, DDD) +EEE = (EEE, EEE) +GGG = (GGG, GGG) +ZZZ = (ZZZ, ZZZ) diff --git a/Day08/Day08/input.txt b/Day08/Day08/input.txt new file mode 100644 index 0000000..b1b82ae --- /dev/null +++ b/Day08/Day08/input.txt @@ -0,0 +1,728 @@ +LRLRLLRRLLRRLRRLRRRLLRLRLRLRLRRLRRRLRLRRLRLLRRLLRLRRLRLRRLLRRRLRLRLRRRLRLLRRRLLLLLLRRRLRRLLLRRLRLRRLRRLRLRRLRRLLRRLRRRLRRRLLRLRLLLRRLLLRRLLRRLRLLRRRLRRRLRRRLRLRRLRRLLLRRRLRRLLRRLRRRLRLRLRRLRRLRRRLRRRLRLLLLRRRLRLRRRLRRRLLRLRRLRRLLRLLLRRLRLRRLRRRLRRRLRRRLLRRRLRLLRRRLRRRLRRRLRRRLRRLRRRLLRRLLRLRLRRRLRRRLRLRRRR + +LFM = (PCJ, GQH) +THP = (SPP, MKB) +PBL = (VVX, JMM) +DSR = (BST, MPD) +QKF = (DSR, KGX) +AAA = (SLH, CVN) +DSH = (DVN, VXT) +VTK = (NSF, QJM) +QQR = (FNB, CBM) +RQV = (XQQ, NQQ) +CGV = (CCB, FTX) +RXL = (HXQ, HLQ) +MQP = (MSH, TJB) +MPL = (JSJ, TJR) +XQK = (RQT, JKB) +GXT = (JFP, MTT) +LHK = (BVR, MFH) +BXH = (PGR, NDC) +FFV = (MJC, TLD) +TFM = (DKJ, RTC) +MVG = (TNC, PXR) +QXN = (CGV, KKM) +LTN = (MQC, XGD) +NLP = (SQQ, DKG) +QTK = (MBH, GJX) +SSR = (DHV, NHN) +DGJ = (QSX, CKB) +SFD = (GRS, DLD) +HBT = (NVN, HJF) +VKH = (CBT, CBT) +VRH = (FVN, JNB) +HTJ = (JNB, FVN) +BDL = (SQS, QVX) +MMC = (MJC, TLD) +RBL = (VNF, BXD) +RNM = (HJQ, PJF) +CTZ = (NCP, PLT) +JFK = (TPJ, JGX) +HPJ = (MMC, FFV) +RJC = (RBH, DFJ) +DHL = (RJC, JFD) +LVR = (BBB, LHK) +LFD = (GCQ, SGC) +BVG = (BSQ, QXH) +DVN = (MTL, NDG) +XGD = (TML, JQL) +RQS = (VXX, BDV) +CPC = (PGB, SVP) +QLQ = (CLK, CBH) +RXZ = (SHG, MDS) +NTR = (RGP, PNX) +BBB = (MFH, BVR) +RGK = (FRD, FRD) +JLV = (DVV, GSF) +NLS = (VFF, HCX) +RHC = (DKG, SQQ) +NVB = (TTG, QTK) +SLZ = (DJM, BVG) +BFK = (SKJ, BBD) +HXX = (XQK, BVT) +SKS = (SLL, FQH) +SGB = (RLT, RHK) +NPD = (RFJ, DJN) +XSJ = (TSF, MVT) +LLH = (RPV, VML) +NXD = (DJS, FJG) +GJX = (SGS, LBJ) +FBV = (CXG, DCJ) +FRX = (GDV, RQB) +SDC = (RGC, THM) +JCT = (CSC, GNM) +SPS = (MLP, TRQ) +BNG = (PFC, CLX) +SHH = (LPM, VRC) +SGC = (FCH, JLC) +FJB = (MVK, JKT) +DRN = (KGL, LTN) +RJB = (NTR, BDN) +DMC = (JBM, KNV) +HBG = (RQB, GDV) +VRC = (RDD, MRD) +JJP = (GQC, VMP) +PLB = (VKX, BGL) +DVV = (QTS, NHG) +LGL = (SSX, JRQ) +RGC = (DVG, RDQ) +GPK = (DDL, FLG) +NVN = (HPJ, SFK) +DVQ = (JFJ, FRC) +VDP = (PFL, GLN) +CVN = (HNX, QKF) +QXP = (VTG, BDC) +LKT = (SBP, SBP) +QSX = (FNN, FKT) +CSC = (HPQ, SLS) +FNN = (DCV, JKF) +MTH = (NVN, HJF) +TPJ = (HNM, NGV) +NHN = (VCC, RXL) +BHF = (JKK, LFD) +HXQ = (VNH, FBV) +KDR = (HDN, HJJ) +SVD = (VRK, STT) +FGJ = (TNM, CRD) +XFF = (NPD, RXQ) +TNC = (XKT, LRP) +VBM = (GJM, PBK) +XBV = (DGJ, QJN) +GXH = (LVK, QGX) +SLH = (HNX, QKF) +ZZZ = (CVN, SLH) +RTC = (TPH, FJT) +NQP = (MJH, MSP) +XSD = (STT, VRK) +HJJ = (XMV, TJX) +JFP = (XSV, KBQ) +FTD = (NMN, PXX) +NVQ = (MSP, MJH) +SHC = (PTV, XDR) +DCV = (TFX, TFX) +BTX = (JJG, FLL) +RDQ = (DCF, FRH) +MTT = (KBQ, XSV) +DRB = (RML, LGR) +PBD = (VSX, FRS) +HFS = (KBM, KSJ) +SKJ = (NXN, LJM) +MTS = (GJC, SQX) +BRL = (TMJ, JTT) +TTQ = (KFC, DPL) +LQF = (DJS, FJG) +TKG = (JFD, RJC) +PGB = (BFJ, BQJ) +BQX = (VHC, PQH) +MRD = (BTB, NJK) +LJF = (XQR, PMH) +BCL = (VBK, JHN) +BHQ = (VMB, SQF) +BSR = (LPM, VRC) +VNK = (GBH, LPQ) +KHJ = (NJG, QQL) +VMB = (BBK, VXF) +QJM = (QDN, VFV) +KFC = (FSM, PMF) +JVN = (DMJ, SPR) +MVT = (RGM, HDH) +PQB = (BVP, NTH) +QQF = (KJP, BDP) +RGP = (JJP, MFM) +DLD = (VSG, BDL) +SCV = (CBT, LHV) +VTD = (KLC, QVL) +FCH = (GGR, TFM) +GJR = (QMX, CFM) +PMH = (GSG, JSF) +DCJ = (CDJ, TRP) +QJX = (NVQ, NQP) +DJN = (JFK, HFM) +DQP = (DSS, PBL) +XXH = (NTX, QLG) +MXK = (JTT, TMJ) +FDL = (JCT, TRR) +MGA = (PLT, NCP) +HPS = (RFQ, VXV) +SBC = (NPD, RXQ) +XPD = (VHH, PDH) +SRX = (SSX, JRQ) +CKJ = (MQQ, QJX) +FKT = (DCV, JKF) +JKP = (VFF, HCX) +JMN = (XSJ, CQP) +GLN = (SFQ, SGB) +PTV = (JNS, FXR) +FXM = (NTR, BDN) +DJS = (XMQ, KSN) +LVC = (FRD, PNN) +JPD = (PQP, XCX) +GQC = (NSQ, GJD) +SFK = (FFV, MMC) +JBD = (TFG, MSN) +BSZ = (RGR, FTD) +SQX = (XRQ, PQB) +PPV = (VBD, SNX) +JSF = (FRT, MVG) +JMT = (TJG, BNV) +JMJ = (DCX, BNG) +KJP = (QFH, VSP) +VXV = (SHM, NMD) +KLC = (XLB, MCH) +JMD = (XQQ, NQQ) +PJN = (FDL, BQC) +PLT = (MCP, VHB) +BGL = (DSC, PSN) +RXH = (SLH, CVN) +VSG = (QVX, SQS) +BDC = (RPS, RBL) +JMM = (XMJ, XDG) +RHK = (QKH, BTX) +RQX = (KSM, PLB) +FQH = (MHT, CDG) +SRM = (PLV, QGV) +HNX = (DSR, KGX) +JNS = (RJN, RXD) +MLP = (JMN, PCR) +LVK = (JHS, QMJ) +PRG = (TJB, MSH) +VGS = (JXR, JLP) +XQQ = (KTJ, BMN) +DGA = (FTD, RGR) +HTX = (MTG, XBV) +CCB = (TXB, VTK) +RQT = (TLR, LDB) +QMX = (SHQ, DPB) +MDS = (KQD, DMC) +JDC = (LCL, SSR) +NHG = (JMD, RQV) +CBM = (DBH, BHQ) +RKB = (VGP, LLP) +SJD = (PLB, KSM) +CDG = (FBC, TJF) +QGV = (TLB, QVB) +BDS = (SPS, BGH) +DGF = (VKH, VKH) +RLV = (MKB, SPP) +SHG = (KQD, DMC) +KQD = (KNV, JBM) +RMV = (DVV, GSF) +MSH = (XXH, TVV) +FJX = (BVG, DJM) +KCV = (PLV, QGV) +MFH = (HCQ, CNF) +TLD = (MCK, KXR) +SLB = (VGP, LLP) +KSN = (HFF, PPV) +RGV = (BDP, KJP) +CNF = (NBF, PCM) +TJF = (GQB, JNP) +NDG = (MTS, JLF) +VHH = (FXM, RJB) +MPH = (CLK, CBH) +RPM = (NXD, LQF) +JHS = (PGH, MXS) +TRJ = (PJF, HJQ) +RJK = (SSR, LCL) +DPB = (SLB, RKB) +XXD = (FFJ, BBX) +QBX = (CRF, VBM) +RMX = (NGM, CPL) +VXT = (MTL, NDG) +KQN = (QQF, RGV) +SFQ = (RLT, RHK) +QGJ = (XDR, PTV) +MSN = (RMV, JLV) +HCQ = (PCM, NBF) +GKF = (PLT, NCP) +VCC = (HLQ, HXQ) +MSJ = (JKP, NLS) +RFF = (BXM, SPH) +FBD = (DGF, VNG) +GLJ = (MQF, RRT) +QRN = (MTH, HBT) +QGS = (TNM, CRD) +XPP = (FNB, CBM) +QQQ = (GHK, DVD) +RBK = (PPQ, XTT) +HHG = (DPL, KFC) +SBP = (FTD, RGR) +MJH = (MLQ, QTG) +JLX = (BDS, TMM) +DVG = (FRH, DCF) +DFJ = (NSK, PDS) +RHJ = (DKM, TDJ) +FQN = (JKT, MVK) +RMD = (LGR, RML) +JTB = (VDP, BSL) +GJM = (NLD, RHJ) +LGP = (CPC, NQN) +JHN = (NBQ, MSJ) +SQF = (BBK, VXF) +HST = (CFM, QMX) +LBJ = (TBP, VNK) +SNX = (PCX, RMX) +PJF = (MGX, SKS) +RRT = (JTB, LSC) +JTT = (MLM, GLJ) +DLQ = (JBQ, RND) +LGR = (QRV, XXD) +LPT = (BSR, SHH) +HQB = (BRL, MXK) +TRP = (LFM, LCT) +JKT = (RNM, TRJ) +MXS = (GQR, KQN) +MKB = (LVQ, NNX) +NDC = (RGK, LVC) +LFN = (RRL, XNF) +SHQ = (RKB, SLB) +JGX = (NGV, HNM) +RPN = (BCL, CDR) +JSJ = (CRH, FHR) +FRH = (THR, TSX) +BNV = (RXS, LGP) +FLL = (GSR, PVF) +DNS = (JLP, JXR) +HDN = (TJX, XMV) +HJQ = (SKS, MGX) +TNX = (SJD, RQX) +XQD = (BFR, MDM) +GNM = (HPQ, SLS) +NML = (DGF, VNG) +BXM = (FJB, FQN) +MSP = (QTG, MLQ) +PBJ = (XLJ, TKD) +MNN = (DNS, VGS) +RBH = (PDS, NSK) +BFJ = (KNT, SDP) +CRD = (PBC, BFK) +TJB = (XXH, TVV) +PDJ = (SRN, SRN) +XJS = (HBG, FRX) +BBK = (LLH, PNP) +QQL = (MFR, KKZ) +FVN = (LGL, SRX) +LRP = (GXT, BSF) +SVX = (MSN, TFG) +PFC = (PCP, FGB) +XMJ = (GKF, GKF) +LLL = (DNS, VGS) +VSX = (TKG, DHL) +RND = (SBC, XFF) +MLQ = (DXT, JMT) +XLC = (TTG, QTK) +TJG = (RXS, LGP) +DPL = (PMF, FSM) +PCR = (CQP, XSJ) +BSQ = (XSD, SVD) +DHP = (HPS, MNQ) +SCB = (HXX, NQV) +FFJ = (LJF, BSV) +FTX = (VTK, TXB) +TRQ = (PCR, JMN) +GDL = (PBD, BJK) +MLM = (RRT, MQF) +TLA = (QXP, MKM) +SMN = (LFN, FVJ) +RRL = (CKJ, JNK) +BDP = (VSP, QFH) +CBC = (DVN, VXT) +JLP = (PTL, SJK) +FRS = (TKG, DHL) +SQQ = (MPL, QBQ) +DVD = (RLK, JPD) +PQP = (LGN, SFD) +FSM = (JDC, RJK) +PSN = (XJS, NRN) +QDN = (SHC, QGJ) +RJN = (XPD, GMS) +HRT = (PPQ, XTT) +CBH = (SRM, KCV) +FSC = (XBV, MTG) +DCX = (CLX, PFC) +XQR = (GSG, JSF) +HBP = (XDT, KNF) +BQJ = (KNT, SDP) +CDJ = (LFM, LCT) +JNK = (MQQ, QJX) +BVP = (MTF, SDC) +TLR = (RHC, NLP) +SJK = (DQP, LMN) +NJG = (MFR, MFR) +RLK = (XCX, PQP) +TPH = (BXH, GSQ) +NSK = (DDS, MLV) +HLQ = (FBV, VNH) +JTP = (FSN, QQQ) +PGH = (KQN, GQR) +SRJ = (PXK, GDL) +TJR = (FHR, CRH) +XDT = (BKJ, PPJ) +GQH = (RLV, THP) +GRS = (BDL, VSG) +DLJ = (CRF, VBM) +VMP = (GJD, NSQ) +MKM = (VTG, BDC) +PVF = (VLX, LBB) +GPV = (SRJ, FNQ) +NTL = (FSN, QQQ) +FQL = (BFR, MDM) +TMJ = (MLM, GLJ) +XKT = (GXT, BSF) +PCX = (NGM, CPL) +XMV = (HQB, JRJ) +QKH = (FLL, JJG) +VQP = (FLG, DDL) +SLS = (CKK, HVF) +THM = (RDQ, DVG) +PPJ = (GCT, TNX) +TMM = (BGH, SPS) +GVL = (PCG, RQS) +DCF = (TSX, THR) +BJK = (FRS, VSX) +SPP = (NNX, LVQ) +QGX = (QMJ, JHS) +RPV = (HGR, DHP) +MTG = (DGJ, QJN) +KGL = (XGD, MQC) +DHD = (RND, JBQ) +BXD = (KFH, HTM) +KGX = (MPD, BST) +QVB = (LKT, RGT) +CBK = (RDG, PKT) +BTB = (JMJ, CTD) +FSN = (DVD, GHK) +KXR = (FFT, DVQ) +TML = (GPV, PVN) +VXF = (PNP, LLH) +DBH = (SQF, VMB) +FCP = (JKK, LFD) +RXQ = (DJN, RFJ) +NTH = (SDC, MTF) +JBM = (SVX, JBD) +PNN = (FJX, SLZ) +GQR = (QQF, RGV) +PXR = (LRP, XKT) +VRK = (RDJ, SMN) +LDB = (RHC, NLP) +LHV = (RXH, ZZZ) +FNB = (DBH, BHQ) +MFM = (VMP, GQC) +PGV = (PKT, RDG) +SPR = (XJP, SHD) +CCR = (LQF, NXD) +GJC = (XRQ, PQB) +LGN = (GRS, DLD) +RDG = (FBD, NML) +MCP = (DLC, TGK) +NMD = (XFR, GRK) +MVK = (TRJ, RNM) +JKF = (TFX, KHJ) +XFR = (SMG, JNQ) +NGM = (XPX, JLX) +MFD = (GVL, MBR) +RNT = (CDR, BCL) +VVX = (XMJ, XMJ) +GNC = (HST, GJR) +CRF = (PBK, GJM) +JKK = (GCQ, SGC) +GBH = (QDR, RFF) +FJG = (XMQ, KSN) +GDV = (GQN, GXH) +XLB = (FMN, JVN) +KNV = (JBD, SVX) +PXX = (HHG, TTQ) +TDJ = (MFD, QJT) +QLG = (PJN, VFS) +NRN = (HBG, FRX) +SHM = (GRK, XFR) +FHV = (HXX, NQV) +QFH = (GNC, CHX) +PCM = (QLQ, MPH) +VLX = (QMR, PBJ) +RPP = (HRT, RBK) +JXR = (SJK, PTL) +LPQ = (QDR, RFF) +BFR = (STC, PJT) +XTT = (CBC, DSH) +HVF = (VTD, KDC) +JFJ = (FCP, BHF) +LVQ = (PRG, MQP) +JFD = (RBH, DFJ) +HFM = (TPJ, JGX) +BSV = (XQR, PMH) +JLC = (GGR, TFM) +NSQ = (FHV, SCB) +NCP = (VHB, MCP) +JKB = (LDB, TLR) +BLX = (PDJ, GBX) +SVP = (BQJ, BFJ) +VSP = (CHX, GNC) +SPH = (FJB, FQN) +RPS = (VNF, BXD) +QMR = (TKD, XLJ) +QMJ = (MXS, PGH) +JNB = (LGL, SRX) +RGM = (JTP, NTL) +GHK = (JPD, RLK) +TFX = (NJG, NJG) +NBQ = (JKP, NLS) +NTX = (VFS, PJN) +QTS = (RQV, JMD) +LMN = (DSS, PBL) +CLK = (SRM, KCV) +MPD = (RMD, DRB) +PDS = (DDS, MLV) +NNX = (PRG, MQP) +BST = (DRB, RMD) +DSG = (SGV, DVB) +KDC = (QVL, KLC) +VKX = (PSN, DSC) +LJM = (DBB, QXN) +VFV = (SHC, QGJ) +FXR = (RJN, RXD) +HGR = (HPS, MNQ) +BMN = (CCR, RPM) +CRH = (FSC, HTX) +QRV = (BBX, FFJ) +CKK = (VTD, KDC) +SDP = (RNT, RPN) +XLJ = (JTX, QRN) +BSL = (PFL, GLN) +GJD = (FHV, SCB) +VNH = (DCJ, CXG) +BCB = (MXJ, LVR) +NBF = (MPH, QLQ) +MCK = (DVQ, FFT) +RFJ = (HFM, JFK) +BBD = (LJM, NXN) +FMN = (SPR, DMJ) +JXK = (GPK, VQP) +SLL = (MHT, CDG) +TRR = (GNM, CSC) +MJC = (KXR, MCK) +MHT = (FBC, TJF) +TSF = (HDH, RGM) +FLG = (FQL, XQD) +MGX = (SLL, FQH) +RGR = (NMN, PXX) +RDA = (BVG, DJM) +VXX = (DHD, DLQ) +DXT = (BNV, TJG) +LCL = (DHV, NHN) +CKB = (FNN, FKT) +KNH = (LVR, MXJ) +GSQ = (PGR, NDC) +CFM = (DPB, SHQ) +HDH = (JTP, NTL) +NSF = (VFV, QDN) +HSF = (KSJ, KBM) +GSR = (VLX, LBB) +GCT = (RQX, SJD) +RBN = (XDT, KNF) +XNF = (JNK, CKJ) +TCF = (RBK, HRT) +DPA = (MDS, SHG) +QTG = (JMT, DXT) +RGT = (SBP, BSZ) +XCX = (SFD, LGN) +KSJ = (KDR, GKG) +GQN = (QGX, LVK) +MDM = (PJT, STC) +KKZ = (MKM, QXP) +MQC = (JQL, TML) +VFS = (FDL, BQC) +TJX = (JRJ, HQB) +BSF = (MTT, JFP) +VMD = (PQH, VHC) +JTX = (HBT, MTH) +MCH = (FMN, JVN) +VBK = (MSJ, NBQ) +TBP = (GBH, LPQ) +TVX = (VQP, GPK) +NQN = (SVP, PGB) +SMG = (XLC, NVB) +SHD = (BCB, KNH) +JLF = (SQX, GJC) +GSF = (QTS, NHG) +BDN = (PNX, RGP) +GRK = (SMG, JNQ) +PLV = (TLB, TLB) +SQS = (HTJ, VRH) +PDH = (FXM, RJB) +VGP = (LLL, MNN) +JRQ = (TVT, BLX) +CLX = (PCP, FGB) +PMF = (JDC, RJK) +JRJ = (BRL, MXK) +XMQ = (PPV, HFF) +BVT = (RQT, JKB) +FJT = (BXH, GSQ) +FRT = (TNC, PXR) +QVL = (XLB, MCH) +TNM = (BFK, PBC) +XPX = (BDS, TMM) +XCN = (SHH, BSR) +PKT = (FBD, NML) +TLB = (LKT, LKT) +TFG = (RMV, JLV) +SRN = (MDS, SHG) +FRC = (BHF, FCP) +GGR = (RTC, DKJ) +KFH = (JXK, TVX) +JNQ = (XLC, NVB) +MTF = (RGC, THM) +STT = (RDJ, SMN) +CPL = (XPX, JLX) +FGB = (XPP, QQR) +DLC = (RPP, TCF) +DJM = (QXH, BSQ) +MBH = (SGS, LBJ) +VBD = (RMX, PCX) +CXG = (TRP, CDJ) +NGV = (VMD, BQX) +GQB = (DRN, NXS) +FHR = (HTX, FSC) +DDL = (FQL, XQD) +FBC = (JNP, GQB) +DKJ = (TPH, FJT) +RQB = (GQN, GXH) +LPM = (RDD, MRD) +BKJ = (GCT, TNX) +GMS = (PDH, VHH) +HTM = (JXK, TVX) +PPQ = (CBC, DSH) +MBR = (RQS, PCG) +PJT = (FGJ, QGS) +PQH = (RBN, HBP) +CBT = (RXH, RXH) +CHX = (HST, GJR) +BQC = (JCT, TRR) +NJK = (JMJ, CTD) +QVX = (VRH, HTJ) +KKM = (FTX, CCB) +NXN = (DBB, QXN) +JQL = (GPV, PVN) +MFR = (QXP, MKM) +VML = (HGR, DHP) +PCJ = (THP, RLV) +XRQ = (BVP, NTH) +PXK = (PBD, BJK) +HCX = (HFS, HSF) +QJT = (MBR, GVL) +RLT = (BTX, QKH) +DKG = (QBQ, MPL) +CQP = (TSF, MVT) +HFF = (VBD, SNX) +KNF = (BKJ, PPJ) +FFT = (JFJ, FRC) +DDS = (PGK, DSG) +PFL = (SGB, SFQ) +RXS = (CPC, NQN) +XSV = (XCN, LPT) +MNQ = (VXV, RFQ) +PVN = (SRJ, FNQ) +VNF = (KFH, HTM) +HPQ = (HVF, CKK) +PGK = (DVB, SGV) +VHC = (HBP, RBN) +GBX = (SRN, RXZ) +SGV = (CBK, PGV) +TVV = (QLG, NTX) +KNT = (RPN, RNT) +TXB = (NSF, QJM) +PCP = (XPP, QQR) +PCG = (BDV, VXX) +MQF = (LSC, JTB) +QJN = (CKB, QSX) +QXH = (SVD, XSD) +LCT = (PCJ, GQH) +GKG = (HDN, HJJ) +TKD = (JTX, QRN) +KBQ = (XCN, LPT) +KSM = (VKX, BGL) +MQQ = (NQP, NVQ) +VFF = (HFS, HSF) +SSX = (TVT, TVT) +DSS = (VVX, VVX) +QDR = (SPH, BXM) +PGR = (RGK, RGK) +RML = (QRV, XXD) +XDR = (JNS, FXR) +DVB = (PGV, CBK) +TSX = (QBX, DLJ) +QBQ = (TJR, JSJ) +BBX = (LJF, BSV) +PTL = (DQP, LMN) +PBC = (BBD, SKJ) +VHB = (DLC, TGK) +XJP = (BCB, KNH) +STC = (QGS, FGJ) +FNQ = (PXK, GDL) +MXJ = (LHK, BBB) +JNP = (NXS, DRN) +SGS = (TBP, VNK) +RFQ = (SHM, NMD) +MLV = (DSG, PGK) +CDR = (VBK, JHN) +CTD = (DCX, BNG) +FRD = (FJX, FJX) +GCQ = (FCH, JLC) +NXS = (KGL, LTN) +JBQ = (SBC, XFF) +NLD = (DKM, TDJ) +VTG = (RBL, RPS) +JJG = (GSR, PVF) +DKM = (QJT, MFD) +RDJ = (LFN, FVJ) +KTJ = (RPM, CCR) +GSG = (FRT, MVG) +MTL = (JLF, MTS) +PNP = (RPV, VML) +TTG = (MBH, GJX) +LSC = (VDP, BSL) +THR = (DLJ, QBX) +NQV = (BVT, XQK) +LBB = (PBJ, QMR) +NQQ = (KTJ, BMN) +DMJ = (XJP, SHD) +DSC = (XJS, NRN) +RXD = (GMS, XPD) +KBM = (GKG, KDR) +LLP = (LLL, MNN) +HNM = (VMD, BQX) +VNG = (VKH, SCV) +XDG = (GKF, CTZ) +PNX = (MFM, JJP) +PBK = (RHJ, NLD) +BVR = (CNF, HCQ) +DHV = (VCC, RXL) +TGK = (RPP, TCF) +RDD = (NJK, BTB) +NMN = (HHG, TTQ) +HJF = (HPJ, SFK) +BDV = (DLQ, DHD) +TVT = (PDJ, PDJ) +BGH = (TRQ, MLP) +FVJ = (RRL, XNF) +DBB = (KKM, CGV) diff --git a/Day08/Day08/main.swift b/Day08/Day08/main.swift new file mode 100644 index 0000000..ba40cc2 --- /dev/null +++ b/Day08/Day08/main.swift @@ -0,0 +1,138 @@ +import Foundation + +let day = "08" +print("AoC 2023, Day \(day)\n") + +let path = "/Users/david/Library/CloudStorage/OneDrive-Personal/20-29 Projects/21 Code/21.24 AdventOfCode/AdventOfCode2023-Swift/" +//let content = try String(contentsOfFile: path + "/Day\(day)/Day\(day)/input-sample-part2.txt", encoding: String.Encoding.utf8) +let content = try String(contentsOfFile: path + "/Day\(day)/Day\(day)/input.txt", encoding: String.Encoding.utf8) +let lines = content.components(separatedBy: "\n").filter { !$0.isEmpty } + +let commands = Array(lines[0]) +let nodes = lines[1...].map { Node(string: $0) } + +// part 1 + +var end = false +var step = 0 +var ci = 0 +var current = "AAA" + +//while (!end) { +// +// let command = commands[i] +// +//// print("\(step): \(command) \(current)", terminator: "") +// +// let next = nodes.filter { $0.start == current }.first! +// current = command == "L" ? next.left : next.right +// +//// print(" -> \(current)") +// +// if current == "ZZZ" { +// end = true +// } else { +// step += 1 +// i += 1 +// if i >= commands.count { i = 0 } +// } +//} + +print("Part 1: \(step + 1)") + +// part 2 + +end = false +step = 0 +ci = 0 + +var currents = nodes.filter { $0.start.last == "A" } + +while (!end) { + + let command = commands[ci] + + // let next = nodes.filter { $0.start == curr }.first! + // curr = command == "L" ? next.left : next.right + + for i in 0..= commands.count { ci = 0 } + +// print("\(step): \(command) | \(currents)") + +// if currents.allSatisfy({ $0.start.last == "Z" }) { + if currents.allSatisfy({ $0.loopLen != 0 }) { + end = true + print("\(step): \(command) | \(currents)") + } +} + +// least common multiple +var a: Int = 0, b: Int = 0 +a = currents[0].loopLen +b = currents[1].loopLen +var l = lcm(a, b) +for i in 2.. Int { + let rem = a % b + return rem != 0 ? gcd(b, rem) : abs(b) +} + +func lcm(_ a: Int, _ b: Int) -> Int { + return (a * b) / gcd(a, b) +} diff --git a/Day10/Day10/input-sample.txt b/Day10/Day10/input-sample.txt new file mode 100644 index 0000000..689fff6 --- /dev/null +++ b/Day10/Day10/input-sample.txt @@ -0,0 +1,5 @@ +-L|F7 +7S-7| +L|7|| +-L-J| +L|-JF diff --git a/Day10/Day10/input-sample2.txt b/Day10/Day10/input-sample2.txt new file mode 100644 index 0000000..682499d --- /dev/null +++ b/Day10/Day10/input-sample2.txt @@ -0,0 +1,5 @@ +..F7. +.FJ|. +SJ.L7 +|F--J +LJ... diff --git a/Day10/Day10/input.txt b/Day10/Day10/input.txt new file mode 100644 index 0000000..3eabd8b --- /dev/null +++ b/Day10/Day10/input.txt @@ -0,0 +1,140 @@ +FJ77.F7F.FF.F..7-J.7F|7-7-7-7FJJ-7J-LL-7FL.F-7.F-F77F7F7-77-F--7-FF|-F-L7-|.F7|7.F-77..-FF|--F.J7..|7FFL-JJ7-F-..J77.|FFJ77L---J7F7.J-F77JJ. +F.J-F.7--J-JJ--77J7LF77...|---|JFJ.|.|--JF-J-7FJ.FL-JJJL-JLLJF|.LF-.|L7FF.F-LJ77.--J7FF--|.-JL-77-7.L-J.|JF|FF--7LJ||J-.FLL7-FJF-7|-L-JL7J.F +LF-FJ-77F-7L7|LLJJ..JL77-LF-JJ|J.FFLJ..LJ-|J-LJJ.|7|L|-L|JJ|-7L7LFLF-7LJ.7.|F||F-|F||LJF|L-.FLLFFJ|7FL-JL----7FL-7|L|..FJ.LJ-FJLLL7-L7|..FFJ +.--J.|F7JLJFJJ7L|.FJ.F|J.LLJ.FJ.F|.F|F7-|7L|.F7J.FF-7-7|.|--7L.L7||J.L-L7L77L|7LF|-JL-F.|F.F77FL7F77J|--|.L7||.L7JF-J-7|.F|FF77|.FL7J.LF.-LJ +||LFFJ|JF---J||.-.FLFLJ7FFL.-7|LFJLFJF7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7-||F--7L|FJ|FJ||FJ|F7F7||L-7||L7FJF-J|F--J||L-7L-7L7|L7||F--JLJ|FJ|FF7|L7F7L7||FJ.F7F7|F|-L|-JLF-JF|J|L| +7-|F||L|L-77-L-7|F7F7L------7|FJ||FJFJ|L-7|FJ|FJ|.||L7LJLJ||L-7|LJFJL7L77||F7.|L-7|F-J7|L-JLJL-7F7F7L7L7|LJFJ|L7|||L-7||||F7-JFFF--JJJ||7F.- +|L7-|7-|7J|7.F-JLJ|||F7F7-F7||L7|||FJFJF7|LJFJL7|FJ|FJF---JL-7|L-7L-7L7|FJ||L7L-7LJL--7L---7F--J|||L7|FJ|F-JJ|FJ|||F-J||||||7.FFJFJ|FF--FJ7| +7-J.|F-L7.FF7|F--7LJLJ||L7|LJL-JLJ|L7||||L-7|F7||L7|L7L---7F7|L-7|F-JFJ|L7||FJF7L-7F--JF---JL-7L||L7|||FJL--7|L-JLJ|F-JLJLJL--7J-F7JF|J|L-F7 +L-|FJ--F|7FJ|LJF7L---7|L7||F7F---7|||L7||F-JLJ|||FJL7|F---J|||F7LJL7FJFJFJ||L7|L7F|L-77L---7F-JFJL7|||||F---J|F----JL7F-------JFL|L7-LJF7..| +JLL-JJ77FLL7L--JL7F--JL7||LJLJF7FJL7L7||||F---J||L-7LJL7-F7||LJL--7LJFJ7L7|L7||FJFJF7L-7F7FJL-7|F-J|||||L7F7FJL-7F7JFJL-----777FFJFJFF7.77L. +FF-|F|.FJ-LL----7|L---7LJ|F-7FJ|L-7L-J||LJ|F7F7|L7FL7F-JFJ||L-7F-7|F7L7F7|L7||||FJFJL--J|LJF--J||F7||||L7LJLJF--J|L7L7F--7F-J-F7L7|-FL--LF-L +|J7|7LLL..LF--7J||F--7L-7|L7|L7|F7L7F-JL-7|||||L7|F7||F7L7||F-J|FJLJ|FJ||L7|||||L7|F7.F7L-7|F7-||||||||7|F---JF-7|FJFJ|F7LJL|||L7|L-7L|J.|F| +7L-JLJ.LFFFJF7L-J||F-JF7||FJL7|LJL-JL7F7FJLJ||L7|||||LJ|FJ|||F7||F7FJ|FJL7||||||FJ||L7||F7|||L7|||||LJ|FJL----JFJ||FJFJ||F7FF7L7LJF-J7|.L7|J +JFL7L.FF7FL-JL7F7LJL7FJLJLJF7LJF7F--7|||L--7|L7LJ||||F-J|LLJ||LJ|||L7|L-7||||||||FJ|FJ|||||LJFJ|||||F7LJ|F-----JFJLJFJ||||L7||FJF-J-L7JF|7|J +.JJJ.FFJ|F7F7LLJL7F7LJF7F7FJ|F-JLJF-J|||F7FJL7|F-J|||L7FJF--J|F-J|L7||F7|||LJ||LJ|FJ|FJ|||L-7L7||||LJ|F--JF---7||F--JF7|||FJ||L7L--7-JLLJJLJ +|L7.|FL7LJLJ|F7F7||L--JLJ|L7LJF-77L-7||||||F7||L-7|||F|||L-7FJ|F7|L||||LJ||F-JL-7||FJ|FJ|L7FJFJ|||L7FJL7F-JF-7L7|L7F7||||||FJL-JF--JF7.FL7L| +|FJ-L|FL---7LJ|||LJF----7L-JF7L7L---JLJ|||||LJL-7|||L7LJF--J|FJ|LJFJ||L-7|||F-7FJ||L7|L7|FJ|-L-J||FJL7FLJF7L7L-JL7LJLJLJLJLJF7F7L----7.|LJ-- +F7J..F---77L-7|||F7L---7L7F7||LL-7F7F7|LJ|||F7F7|LJ|FJF-JF-7|L7L-7|FJ|F7||||L7||FJ|FJL7||L7L---7LJ|F7|F--JL7L----JF--7F7F7F-JLJ|F-7F-J---JFJ +FJF-FL--7|F7FJLJLJL--7F|FJ|LJL--7LJLJL-77LJ|||||L7FJ|FJF7|FJ|.L7FJ||FJ||||||FJLJL-JL7FJ|L7L7F-7L-7||||L7F-7|F7F7F7L7FJ|||LJF--7LJJLJF7777L|. +LF|7LFF-JLJLJF--7F--7|FJL7L----7L------JF-7||LJ|FJ|FJL7||||FJF-JL7|||FJLJ||||JF-----JL7|FJFJL7|F7|LJLJ7LJFJLJLJLJL-JL-J|L7||F-JF--7FJL7FF7-- +.LLF--L7F---7|F-J|F-JLJF7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FJ|||FJ|F7L--JFFLL-F +|7||F7F--JL--JL-JF7L-JFF--JL7F---7F--7FJF7F7|L--JLJL--7F7LJF7|FJLJ|L7|L7J.L||L7F|7.L-7FJF--J|||L7|||LJL----7|L7F-JFJF7FJL-7||L7LJL--7-FJFJ7| +LJ7LJLJ|JF7F7F7F7||F7F7L----JL--7|L-7||FJLJLJF---7F-7FJ||.FJLJ|L|7|FJL7||-J|F-|-F7JFLLJJL7F7LJL-JLJL-------JL7||F7L-J|L7F-JLJJ|F----J7|F|LF| +.|LJJ.LF-J||LJLJLJ|||||F--7-F7F7||FFJ|LJF7F-7L--7|L7LJ||L-JF--J.F-JL-7LJ--FF|.|LJJJF--7F7||L7F------------7F-JLJ||F7FJJ|L----7||F----7J-L7F7 +.F7|7-LL-7|L---7F7|||||L-7|FJLJLJL7L7|F7||L7L-7FJL7L---JF-7L--7FJF7F7|JJ.FLJLJ|7|-LL-7LJLJ|JLJF-----------JL----JLJLJ|FJF---7||LJF7F-J-LLL-- +F-JL7.LF-JL----J||LJLJL-7||L-7F--7L-J||LJL7L-7|L-7|F-7F-J|L7F-JL7|||LJJ.F-7JLLJF-F-|FL----JF7FJF7F7F7F7F-----------7F7L7L--7LJ|F7|LJ.|FLFL|| +J|--F7.L-------7|L7F-7F7LJL-7LJF7L-7FJL7F7L--JL7FJ|L7|L-7F-JL7J-LJLJJ|..|L-77J|LLJ-LFF7F77FJLJFJLJ||LJLJF---------7LJL7|F--JF7LJ|L--7J--|LL7 +L|7L|-FF-------J|FJ|FJ|L7F-7L--JL7FJL-7LJL---7JLJ7L7|L7FJL7F-JJ.FLJ.LL7FL-LL7-F-|7.LFJLJL-JF--JF7F||F--7L--------7L-7FJ|L---JL7|L--7|.77J.|J +.L-JL|.L-7F7F7F7|L-J|FJLLJFL---7FJL--7L---7F-JF---7|L7LJ77||7LFJ-LJ7FL|7JF|J|-L777FFJF-7F7FJF--JL7LJL-7L---------JF7LJ|L-7F--7L---7|L7L--FL. +--J7-L7LFJ|LJ||LJF--J||F7F7F--7|L----JF--7LJF-JF--JL-JF7F7LJ7.|||-FF-FJJF.LFJLLLL|-L7||LJLJLL---7L7LF7L7F--------7|L----7LJ-FJF7F7|L-J.|7LJ7 +|7.L7JL7L-JF-J|F7L7F7|FJLJLJF7LJF7F---JF-JF7L-7L7F7|F7||||-F7-JF7F7.F|7FLJF7|7FL|J|FJ|F-7F7F7|F7L7L7|L7LJF------7LJF7F-7|F-7L-JLJLJ|FL-|F.FF +77F|-7LF77LL--J||FJ|LJL---7FJL--J||F---JF7||F-JFJ||FJ||LJL-J|7L--J|J-J|-.LF77FF7LFFL-JL7LJLJL7|L-JFJ|FJF7L-----7|F-JLJFJ||FJF--7F--777.|.FLJ +L--7J|||L-7F---J|L7|F-----J|F----J||F7F7|||LJF7L-J|L7LJF---7L-7J|.|J.|F7|.|J-|LJF-F---7L7F7F7|L--7|FJL-JL------JLJF7F7L-J|L-JF7LJF-J7-7|JJ.F +7|.LFF-JF-JL--7FJ|LJL7F-7F7|L7F---JLJLJLJLJF7|L7F7L-JF7L--7|F-JJJLF7.--L7.||-7-JFLL--7|J||LJ|L---JLJF------7JF7F--JLJ|F-7|F--JL--JF-7-JJ7L7J +F-JFFJF7|F7F7-||F7.F-J|7LJLJ.LJF--7F7F---7FJLJ.LJ|F7FJL7F-JLJFJJLF|77||L|FL-7JL-JL|.FJL7LJF-JF-7F7F7|F7|F-7L-JLJF----JL7|||F---7F7|FJJJLL.|| +|F77L-J|||LJL-JLJL7L--JF7F-----JF7LJLJ7F7|L----7LLJ|L7FJL-7F77F7--J|.|-F-F-JJ7.|L|F7L-7L--JF-JLLJ|||||L7L7L7F7F7L--7F7FJLJLJF7FJ|LJ|JL|.L-L7 +|LF-LF-JLJF-7F7F7FJF7F7||L----7FJL-----J|L7F7F-JF7FL-JL-7FJ||-7L|J.F|LFF.-|J.L|J|FJL--JF--7|F7F-7LJLJL7L-J7LJ|||F-7LJLJF7F7FJLJ||F-JL7.F.FFF +LFJJ|L--7FJ7LJ|||L-JLJ|||F7F7FJ|F---7F-7L7LJLJF-JL---7F7LJF||F77F-7FLFF-JL|.-7L-LL---7FJJFJ|||L7|-F7F7L7F--7||||L7|F---JLJLJF7F-JL--7J||FFJ| +LL||FJ.F||F--7LJL----7|||||||L-JL--7LJLL-JF---JF7F7F7LJL--7||7.FJ7L7JJ||F7JFJL7LLF--7LJF7L-J||FJL-JLJL7LJF7L7LJL-JLJF7F-----J|L7F---JF77FL|7 +FJ.-FJ.-||L-7|F7F7F--JLJ||||||F7F7-L---7F7|F---JLJLJL-----J||F77J7|.J7-LF.--JLL7|L-7L-7|L7LFJLJF--7F-7L--JL-JLF----7||L7F---7L-JL----J|--7JJ +F77-L--LLJF-JLJLJLJF---7LJLJL-JLJ|F----J|LJL--7F--------7F7||||F7F|77FJ.J7LL7J-FFF7L7FJL7L-JF-7|F-J||L7F-7F7F7|F---J|L-JL--7L7F-------J.L7-7 +JL-7L|FLLLL-7F-7F--JF7JL--7F----7|L-7F-7|F----J|F-------J|||||LJL7--FJ.FJ77|.FF--JL-J|F7L7F7|FJ||F7|F-JL7LJLJ|||F7F7|F7F7F7L7|L----7-|.7.|-7 +||7J.LL7|L|FJ|FJ|F--JL---7LJF7F-JL7FJ|FJ|L----7||F7FF7F77||||L7F-JJ-7|-L|L7JFFL7F-7F7LJL7LJLJL-JLJLJ|F--JF---J|LJLJLJ|LJLJ|FJL7F7F-JL|--.-7J +LLL-|7-7JLLL7|L7|L7F7F7F7L-7||L--7|L7||FJF-7F-J|LJL7|LJL-JLJL7|L7|L-F|.F7||F|7LLJFLJL-7FJ7F7F-------J|F--JF7F7|F----7L---7|L7LLJLJJJ-77J7|L7 +||L7||7.|.JLLJJ|L7LJ||||L-7|||F--JL-J|LJFJFJL--JF-7LJF7F7F-7FJ|FJ7-FLJF7.FFLF7.||F7F7FJL7FJ|L----7F7FJL---JLJLJL---7L----JL-JF7F7|F7.F777|.7 +JFFL7JL7|.LF---JFJ7FJ||L7FJLJLJF7F---JF-J7L7F-7FJLL7FJ|||L7||FJL--7.LF|L7F|LF77F7||||L-7|L7|F-7F7LJLJF-----7F7F7F--JF7|F7F7F7|LJL-JL-JL7-J.| +|F7||7JF7FLL----JF7L-JL-JL--7F-J||JF--JF7F7|L7|L-7LLJFJ||FJLJL7F--JF--JFJ7-F||7|LJLJL-7||FJ|L7||||F7JL----7|||||L---JL-JLJLJLJF--------JJL-J +FJL|L--L7.LF-----JL-7F7F7LF-JL-7||FJF--JLJ|L-JL--JJF7L-J|L-7F-JL--7L7F-JF77FJL7L---7F7|||L7|FJ|||FJ|F7F-7FJLJLJ|F----7F----7F7|LF7F-7JF|.F7J +LJ-77L||F-7L-------7|||||FJF-7FJLJL-JF----JF--7LF7FJ|F-7L-7|L--7F-JFJ|F7|L7|F-JF-7JLJ|LJL-JLJFJ||L7|||L7LJF7F7FJL---7||F7F7|||L-JLJFJF77|LJ- +L-.--7-|JFJ..F7F7F7|LJLJLJFJFJL7F----JF7F--JF-JFJ||FJ|FJF7LJF7FJL7FL7|||L7|||FFJFJF--JF---7F7L-JL-JLJL-JF-JLJ||F7F--JLJ|LJ|LJL7F--7|JJLF-7|. +|LL-JJ7J7FFFFJLJLJ|L7F7F-7|FJF-JL----7||L7F7L7JL7LJL-JL-JL7FJ|L7FJF7|LJL-J|||FJFJ|L-7FJF7FJ||F-7F7F7F7F7|F---JLJ|L-----JF7L-7FJ|F7||J.7--7|7 +F7JFL-L77LF7L-7F-7L7||||7LJL-JF7LF7F7LJL7||L-JF7|F7F------JL7|FJL7||L----7LJLJFJ77F7LJL||L7|LJ7||LJLJLJLJL----7FL------7||F7|L7LJ|LJJ.7L7|LJ +LF7|J7J.|FL||FJL7L7LJ|LJF--7.FJL-JLJL7F7LJL-7FJLJ|LJF--7F7-FJ|L7FJ||F---7|F---JF7FJ|-F7||JLJF-7LJJF-----7F----JF------7|||||L7|F7|-J.F-7L|.7 +F|-L.L7FL7J|FJF7L7L--JF7L-7L7L-----7FLJL7F-7LJF7FJF7|F-J|L7L7|FJL7||L7F-J|L7F--J|L7L7||||F-7L7|-F7L----7|L-----JF-----JLJLJ|FJ||||||.|-7F--- +FL.|F|L.F-F-JFJL7|F---J|F7L7L-7F7F7L---7LJFJF-J|L-J||L-7L7|L||L-7LJ|FJ|F7L7LJF7FJ-L7LJLJ|L7|FJL-J|F7-F-JL--7F7F7L-----7F7F7||FJ|LJ--F.FLFJ.| +|L-J7L7FL.|F7|LLLJL-7F7||L-JF7LJLJL----JF7L7|F7L7F-JL7FJFJL7||F7|F-J|FJ||FJF-JLJ|LFL7F-7L7||L7F-7LJL7L---7FLJLJL------J||||LJL-JF|JL-7JJF-J7 +|F|.7F|J.-LJLJ|F7|F7LJ|LJF7FJL7F7F-7F7F-JL7|LJL7||F--JL7L7FJ|LJLJL-7||FJ||FJF7FF7-F7LJFJFJ||FJL7L7F7|.F77L---77F---7F7FJLJL7F-7J-|7J.J.LL|.| +FF|-L-||.J-LF--J|FJL--JF7||L7-LJLJFJ|LJF7FJL---J||L---7L-J|7L-7F---J||L7||L7|L7||FJ|F7L7|FJ|L7FJ7LJ|L-JL----7L-JF--J|LJF7F7LJFJJ.|J.|.F77F-7 +-7|L|FL7.LF.L--7LJF--7FJLJL-JF7|F7L-JF-J|L--7FF7LJ-F7.L--7L--7||F-7|||FJ|L7||FJ|||FJ||FJ|L7|JLJLF7FJF7F7F--7L---JF7.|F-JLJL--JF7F777JFJ7JLJJ +.||LFF7F7.-..|7|F7|F-JL7F----JL-JL--7|F7L---JFJL7F7||F--7|F7FJ||L7L7||L7|FJ||L7|||L7|LJFJFJL7F7FJ|L7|LJLJF-J-F--7|L-JL----7F--JL-7LF7||J.F77 +FJL-F7-JF.FFFFFJ||||F--JL-------7F-7LJ||LF77FJF7LJ|||L-7|LJ|L7||JL7LJ|F|||FJL7|||L7|L7FJ-L7FJ||L7L7||F---J7F-JF-J|F---7F7FJ|F----J-FF|7-L-J7 +|7|L-.LFL-J.LFJFJLJLJF----------J|FJFFJ|FJL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L7-L|FFLJ7|7JJ|F|.JFF-7-7F7-|L-||F|7-.JJ|FLF7-LJJ-FF.L7|L7LLF7-7LJ-JF77FJ.|FF7.LL-JLJ.LFFF-FJ|FL-7L| +J-|-|-7-J7F7-LJLFJL|7FJ||7FFF7JLL7J.7J7.F7.|LL7L||.L7LF|J|.FL-|JL-|FLL-|FFL7.JJJLJF-JF.FL.FF-JFJFF7-F.F-LLF-|-77|FL|L-7.FL|F7LF|..F77F7JF77F +L--J|7J-LJ-J7J.FJLLL77.FJ-F-JJF.LLJ-LL|-F7-7LLJJF--J7.LF.-7.LFJ--J.JJ-LJJL|J-LLJLL7JL7-L|-LJ--J-F-|L|-L--JJ-LJL-L-L|J-J-L--J--7LFLJLJ-LFFJ-L diff --git a/Day10/Day10/main.swift b/Day10/Day10/main.swift new file mode 100644 index 0000000..823dab7 --- /dev/null +++ b/Day10/Day10/main.swift @@ -0,0 +1,109 @@ +import Foundation + +let day = "10" +print("AoC 2023, Day \(day)\n") + +let path = "/Users/david/Library/CloudStorage/OneDrive-Personal/20-29 Projects/21 Code/21.24 AdventOfCode/AdventOfCode2023-Swift/" +let content = try String(contentsOfFile: path + "/Day\(day)/Day\(day)/input.txt", encoding: String.Encoding.utf8) +let lines = content.components(separatedBy: "\n").filter { !$0.isEmpty } + +var grid: [[Character]] = lines.map { Array($0) } +//printGrid(arrayOfArrays: grid) + +// part 1 + +let start = findChar(grid: grid, char: "S") +print("Start: ", start!) + +var gridValues: [[Int?]] = Array(repeating: Array(repeating: nil, count: grid.count), count: grid[0].count) +gridValues[start!.0][start!.1] = 0 + +let result1 = GetNext(position: start!, step: 0, grid: grid, values: gridValues) / 2 + +//printGrid(arrayOfArrays: gridValues) + +print("Part 1: \(result1)") + +// part 2 + +var result2 = lines.count +//... + +print("Part 2: \(result2)") + +func GetNext(position: (Int, Int), step: Int, grid: [[Character]], values: [[Int?]]) -> Int { + + let connections = findConnection(grid: grid, location: position) +// print("Connections: ", connections) + var len = 0 + for c in connections { + if (gridValues[c.0][c.1] == nil) { + gridValues[c.0][c.1] = step + 1 + if (c != position) { +// print("NNext: \(c) = \(findConnection(grid: grid, location: c))") + len = GetNext(position: c, step: step + 1, grid: grid, values: values) + } + } + } + return len + 1 +} + +func printGrid(arrayOfArrays: [[T]]) { + for array in arrayOfArrays { + print(array) + } +} + +func findChar(grid: [[Character]], char: Character) -> (Int, Int)? { + if let rowIndex = grid.firstIndex(where: { $0.contains(char) }), + let colIndex = grid[rowIndex].firstIndex(of: char) { + return (rowIndex, colIndex) + } + return nil +} + +func findConnection(grid: [[Character]], location: (Int, Int)) -> [(Int, Int)] { + var connections: [(Int, Int)] = [] + let current = grid[location.0][location.1] + if (location.0 > 0) { + // top + let y = location.0 - 1 + let x = location.1 + let p = "S|JL".contains(current) ? "|7F" : "" + // check + if p.contains(grid[y][x]) { + connections.append((y, x)) + } + } + if (location.0 < grid.count - 1) { + // bottom + let y = location.0 + 1 + let x = location.1 + let p = "S|F7".contains(current) ? "|JL" : "" + // check + if p.contains(grid[y][x]) { + connections.append((y, x)) + } + } + if (location.1 > 0) { + // left + let y = location.0 + let x = location.1 - 1 + let p = "S-J7".contains(current) ? "-FL" : "" + // check + if p.contains(grid[y][x]) { + connections.append((y, x)) + } + } + if (location.1 < grid[location.0].count - 1) { + // right + let y = location.0 + let x = location.1 + 1 + let p = "S-FL".contains(current) ? "-J7" : "" + // check + if p.contains(grid[y][x]) { + connections.append((y, x)) + } + } + return connections +}