Compare commits
No commits in common. "be0ed3e377fdd0c4f8421e812dea3ec59f01a5d2" and "9ab450d258227a59219c5e6bb61d005e9cb296bd" have entirely different histories.
be0ed3e377
...
9ab450d258
201
8/Cargo.lock
generated
201
8/Cargo.lock
generated
@ -1,201 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "day8"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"lazy-regex",
|
||||
"num",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy-regex"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c"
|
||||
dependencies = [
|
||||
"lazy-regex-proc_macros",
|
||||
"once_cell",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy-regex-proc_macros"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
@ -1,8 +0,0 @@
|
||||
[package]
|
||||
name = "day8"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
lazy-regex = "3.1.0"
|
||||
num = "0.4.1"
|
740
8/input
740
8/input
@ -1,740 +0,0 @@
|
||||
LLRLLRRLRLRRRLRRLLRRRLRLRLRRLRRRLRRLRLRLLRLLLRRRLRRLRRRLRRRLRRRLRLRRLLRRLRRLRRLRRRLRLRRRLLRLRRLRRRLRLRRRLRRRLRLRRRLLRRRLRRRLRLRRLRLRRRLLRRLRRLRRLRRLRLRLRRRLLRRRLRRLRRRLRLRLRRRLLRLRRLLRLRRLRLRRRLRLRRLLRRRLLRRLRLRLLRLLRRLRRLLRRLRLRRLRLRLRRRLRRLRLLLLRRLRLRLRRRLLLRRRLRRLRRLRLLRLRRRLLLRRRLRRRLRRRR
|
||||
|
||||
NQT = (TXC, RVJ)
|
||||
FPT = (PNS, KJL)
|
||||
BNQ = (THG, LCV)
|
||||
SPL = (VBH, NNV)
|
||||
TLM = (LVQ, PGT)
|
||||
GHC = (XKN, SPR)
|
||||
PHT = (HMF, DST)
|
||||
FSF = (JCM, SMT)
|
||||
GDD = (FHJ, RBS)
|
||||
GVR = (FVD, FVD)
|
||||
SST = (PMF, MGC)
|
||||
ZZZ = (VLV, SQV)
|
||||
SDV = (DBL, GTL)
|
||||
XSP = (GRV, RFM)
|
||||
SKG = (NGH, VDX)
|
||||
BPK = (RMK, LCQ)
|
||||
VSC = (DRN, SFR)
|
||||
BFR = (BJR, GMD)
|
||||
HTM = (PFM, LVD)
|
||||
XVP = (LDP, LDP)
|
||||
DRD = (SCH, LKD)
|
||||
DSJ = (GSQ, JTN)
|
||||
VTS = (BNQ, VFX)
|
||||
KVF = (HTP, MQK)
|
||||
GPS = (FXQ, TPF)
|
||||
VRC = (RTK, RTK)
|
||||
HRD = (PMQ, JCR)
|
||||
DJK = (FTC, KXH)
|
||||
VGJ = (PCJ, TVH)
|
||||
QMN = (TLC, HNG)
|
||||
DMH = (QSD, PDP)
|
||||
CRL = (VFR, MDR)
|
||||
XGV = (CMV, FTV)
|
||||
XJX = (HTM, HHG)
|
||||
SQP = (XKK, KJF)
|
||||
PXZ = (JCK, PTH)
|
||||
BDV = (JMH, CND)
|
||||
FBD = (CQS, QCN)
|
||||
TRS = (FGM, NKF)
|
||||
TLC = (HBC, FRC)
|
||||
DKR = (LCP, VLD)
|
||||
GTF = (QHD, PBB)
|
||||
NCC = (HJF, LNR)
|
||||
KGS = (KPF, GTB)
|
||||
CPQ = (SLR, DRD)
|
||||
RJQ = (KXK, BFR)
|
||||
XSQ = (PNN, NMG)
|
||||
DVP = (MBH, QLV)
|
||||
CQL = (DVP, VHQ)
|
||||
CPV = (MDL, VFB)
|
||||
VHV = (CQS, QCN)
|
||||
NRD = (KSC, HKX)
|
||||
STX = (CGJ, PGK)
|
||||
CNP = (FVB, MCN)
|
||||
JXT = (DXT, LHK)
|
||||
GHG = (MCL, MPB)
|
||||
PGK = (RMS, SBC)
|
||||
DNH = (FSV, RNS)
|
||||
TFZ = (NQT, PBD)
|
||||
MBQ = (DPH, FDK)
|
||||
SJQ = (JLB, LJJ)
|
||||
MBN = (FTD, CDB)
|
||||
TDJ = (FJB, PQX)
|
||||
DXT = (FJP, HGQ)
|
||||
MSG = (MSM, CXN)
|
||||
RTK = (GVR, GVR)
|
||||
SDX = (VTS, MRG)
|
||||
VCX = (QTL, NVV)
|
||||
XCS = (KLR, THD)
|
||||
RDD = (QDS, JST)
|
||||
FVB = (BLD, NPF)
|
||||
LVD = (JXC, FQR)
|
||||
TMR = (SNJ, DML)
|
||||
RCH = (JST, QDS)
|
||||
RVJ = (XMN, SDT)
|
||||
SQV = (MVP, MKC)
|
||||
HDB = (LTL, JJP)
|
||||
LVC = (CLL, CLL)
|
||||
FGM = (TPG, PHK)
|
||||
SCS = (MLK, TKF)
|
||||
PRF = (TLB, KTT)
|
||||
MPM = (NMN, KGS)
|
||||
MGC = (NLT, MGS)
|
||||
CNK = (BFR, KXK)
|
||||
FXQ = (JMX, LLL)
|
||||
GTB = (MFM, PMV)
|
||||
VXS = (DPN, FPN)
|
||||
NRB = (SCS, SGH)
|
||||
QLJ = (NLL, VMM)
|
||||
PNN = (SFJ, HSR)
|
||||
BRJ = (RMQ, XLJ)
|
||||
SNF = (FMH, MNR)
|
||||
VLD = (SHN, FBG)
|
||||
FSM = (GKF, DBC)
|
||||
MHP = (LBX, KQH)
|
||||
NSQ = (QKK, KND)
|
||||
RRT = (RMK, LCQ)
|
||||
BCX = (GTM, MVV)
|
||||
XSX = (XFK, XNF)
|
||||
TKF = (MFF, VCV)
|
||||
HPD = (GHC, RKN)
|
||||
MRG = (BNQ, VFX)
|
||||
QTK = (QRT, RRB)
|
||||
HFF = (NKD, SXP)
|
||||
MFM = (BRB, DDN)
|
||||
VVL = (GPC, BRJ)
|
||||
CST = (GQT, NLG)
|
||||
THD = (MVK, DRJ)
|
||||
XFN = (JNC, MNF)
|
||||
NKH = (PMD, BDV)
|
||||
NLT = (HKK, KCD)
|
||||
VXR = (XCS, GRX)
|
||||
SDS = (JBV, JFM)
|
||||
BFM = (XXG, CHQ)
|
||||
PMD = (JMH, CND)
|
||||
VVF = (GQT, NLG)
|
||||
FGG = (NRD, SNP)
|
||||
LKD = (NGK, SQP)
|
||||
RSV = (TXL, GPD)
|
||||
LNR = (RDB, NTD)
|
||||
RPL = (SNB, MHK)
|
||||
CCG = (JDT, PJD)
|
||||
TKR = (TMD, VCL)
|
||||
DRJ = (CQL, XFH)
|
||||
JFM = (MMV, GPS)
|
||||
FJP = (BDM, QXN)
|
||||
QJS = (BFM, RHM)
|
||||
KTT = (PXV, VJV)
|
||||
XXB = (VKG, HXL)
|
||||
RMK = (DBR, HFQ)
|
||||
NGK = (KJF, XKK)
|
||||
NPF = (SMK, BTJ)
|
||||
RBS = (PGN, GNH)
|
||||
PNS = (VTJ, KSM)
|
||||
BCK = (SDX, NRF)
|
||||
RNS = (XVS, KFX)
|
||||
PDB = (BHH, BHH)
|
||||
GMQ = (MRD, JRG)
|
||||
DGM = (HDV, GSD)
|
||||
TLB = (PXV, VJV)
|
||||
QRT = (FRS, FFT)
|
||||
VSX = (NLL, VMM)
|
||||
GSQ = (JRJ, LGV)
|
||||
TXC = (XMN, SDT)
|
||||
HGQ = (QXN, BDM)
|
||||
PMQ = (KBB, NRH)
|
||||
KRC = (DGM, XCR)
|
||||
QLZ = (TKM, HTF)
|
||||
NJM = (GPC, BRJ)
|
||||
FRG = (QLS, GXP)
|
||||
NMG = (SFJ, HSR)
|
||||
JDT = (TDF, QHT)
|
||||
LFC = (RFM, GRV)
|
||||
TXL = (XSX, FTP)
|
||||
DKG = (JNL, XBR)
|
||||
VKF = (GTM, MVV)
|
||||
VQV = (RHT, SDS)
|
||||
SJH = (LPV, TRQ)
|
||||
KSM = (LHX, CPQ)
|
||||
QMH = (MMD, GPB)
|
||||
VNP = (TRQ, LPV)
|
||||
NBM = (JPF, KRM)
|
||||
RGQ = (TMH, KQR)
|
||||
RSM = (SMP, KSG)
|
||||
HDV = (VXS, VQG)
|
||||
TTD = (CDB, FTD)
|
||||
GXF = (SLN, SCF)
|
||||
QHT = (TMR, QTH)
|
||||
MNR = (VXR, GDS)
|
||||
GSA = (THS, NKH)
|
||||
XKN = (GNB, VLQ)
|
||||
HHQ = (RRB, QRT)
|
||||
CLC = (THS, NKH)
|
||||
BSN = (QKN, QKN)
|
||||
QRB = (KDT, JSL)
|
||||
JCX = (VCX, DXP)
|
||||
BDM = (SQN, TBH)
|
||||
GQT = (DNB, NTS)
|
||||
QSF = (KXH, FTC)
|
||||
HFQ = (NNQ, LLM)
|
||||
VFB = (NGF, NXB)
|
||||
JMX = (HFB, DNR)
|
||||
VKS = (NBM, NQF)
|
||||
PGN = (FBD, VHV)
|
||||
PNQ = (KQR, TMH)
|
||||
QLM = (VVL, NJM)
|
||||
PRB = (KQD, QRB)
|
||||
GTL = (VQJ, DJR)
|
||||
KNL = (JRN, KVF)
|
||||
VMT = (LTL, JJP)
|
||||
QKN = (PHM, VQS)
|
||||
QBL = (LXK, PRF)
|
||||
PCT = (VNP, SJH)
|
||||
QLV = (HXF, DXH)
|
||||
HNN = (DSJ, XDN)
|
||||
LGV = (VVD, XXB)
|
||||
XCB = (XXQ, CHX)
|
||||
GXC = (FGG, MSX)
|
||||
SLN = (VLP, SST)
|
||||
NQQ = (SXP, NKD)
|
||||
DRN = (DPC, TCV)
|
||||
JHF = (QTK, HHQ)
|
||||
GPM = (GTF, NCX)
|
||||
PFM = (JXC, JXC)
|
||||
KBT = (KQH, LBX)
|
||||
XFH = (VHQ, DVP)
|
||||
CPT = (VSD, TKR)
|
||||
GSX = (CTF, XXX)
|
||||
SPR = (GNB, VLQ)
|
||||
XBP = (MXH, TBJ)
|
||||
VKG = (PKS, CPT)
|
||||
THG = (FRP, FRP)
|
||||
SHN = (FRG, TCF)
|
||||
BFS = (RPL, JRV)
|
||||
PHK = (BQG, BMH)
|
||||
SMK = (VRV, FDG)
|
||||
PBF = (MSG, XGT)
|
||||
NKF = (TPG, PHK)
|
||||
VDQ = (MHP, KBT)
|
||||
JRG = (DXJ, JCX)
|
||||
MHK = (QTS, CRL)
|
||||
CXN = (FBR, FCT)
|
||||
DHT = (XXQ, CHX)
|
||||
DML = (SPL, TBX)
|
||||
BTJ = (FDG, VRV)
|
||||
KVG = (TJJ, TRS)
|
||||
JPH = (CLC, DXZ)
|
||||
HXL = (PKS, CPT)
|
||||
RDB = (PKM, FLG)
|
||||
CTF = (NLX, SJQ)
|
||||
BMH = (GVP, NSQ)
|
||||
GTP = (NMG, PNN)
|
||||
KJL = (KSM, VTJ)
|
||||
SLR = (LKD, SCH)
|
||||
TJJ = (NKF, FGM)
|
||||
DPH = (HHT, NRB)
|
||||
PBN = (CLC, CLC)
|
||||
FFT = (DJK, QSF)
|
||||
RTL = (TBJ, MXH)
|
||||
PJD = (TDF, QHT)
|
||||
HTP = (BGK, NCC)
|
||||
MDL = (NXB, NGF)
|
||||
CGJ = (SBC, RMS)
|
||||
RTR = (LHK, DXT)
|
||||
MLR = (JNC, MNF)
|
||||
DXL = (RKN, GHC)
|
||||
QTS = (VFR, MDR)
|
||||
LLM = (KSK, BHN)
|
||||
FFJ = (HGD, HGD)
|
||||
PQX = (VRC, KXG)
|
||||
XFK = (QNM, TMC)
|
||||
FVD = (HTF, TKM)
|
||||
CSR = (XDN, DSJ)
|
||||
VPN = (DPH, FDK)
|
||||
TJN = (HGC, HJH)
|
||||
KSC = (SVX, SVX)
|
||||
TLH = (FSV, RNS)
|
||||
QTH = (DML, SNJ)
|
||||
VQJ = (SMR, KCL)
|
||||
GNP = (JRQ, GBR)
|
||||
TKB = (TLC, HNG)
|
||||
FBV = (BFM, RHM)
|
||||
DMS = (BTG, NXV)
|
||||
VDX = (BCM, RNG)
|
||||
MSN = (QTK, HHQ)
|
||||
TKM = (LSM, PBF)
|
||||
FSS = (MCN, FVB)
|
||||
DLA = (PHM, VQS)
|
||||
LXK = (KTT, TLB)
|
||||
JBV = (MMV, GPS)
|
||||
FFQ = (QJS, FBV)
|
||||
MXH = (RPP, LKF)
|
||||
RKN = (SPR, XKN)
|
||||
FDG = (RSC, QMH)
|
||||
NLL = (VKS, FPF)
|
||||
XDN = (JTN, GSQ)
|
||||
FLS = (JNL, XBR)
|
||||
MLA = (PTH, JCK)
|
||||
GTM = (FSS, CNP)
|
||||
NVV = (LLR, NLV)
|
||||
TBX = (VBH, NNV)
|
||||
HTG = (VDQ, GFH)
|
||||
VLQ = (HXR, QNQ)
|
||||
JSL = (MVC, DJM)
|
||||
BPX = (VVL, NJM)
|
||||
FBG = (FRG, TCF)
|
||||
PFS = (HMH, KFF)
|
||||
GPB = (DDH, RSM)
|
||||
JFB = (FXX, GXC)
|
||||
XJZ = (VQS, PHM)
|
||||
FRS = (QSF, DJK)
|
||||
NKP = (PDB, SGT)
|
||||
KSB = (CTF, XXX)
|
||||
DTL = (FMH, MNR)
|
||||
HSN = (PBN, JPH)
|
||||
JCQ = (XCB, DHT)
|
||||
GBR = (NKP, GHV)
|
||||
BKL = (CKM, XJX)
|
||||
JLH = (XGV, MXR)
|
||||
TBJ = (LKF, RPP)
|
||||
RSJ = (HVN, KKH)
|
||||
SVX = (BSN, BSN)
|
||||
GRV = (CHT, NMV)
|
||||
TKX = (RHT, SDS)
|
||||
MQK = (BGK, NCC)
|
||||
KLR = (DRJ, MVK)
|
||||
NCH = (BCX, VKF)
|
||||
NLX = (JLB, LJJ)
|
||||
VHQ = (MBH, QLV)
|
||||
QXR = (NCH, FRT)
|
||||
FQS = (VGJ, HFG)
|
||||
LCP = (SHN, FBG)
|
||||
NCX = (QHD, PBB)
|
||||
SXK = (HGD, ZZZ)
|
||||
RNR = (RTR, JXT)
|
||||
VQG = (FPN, DPN)
|
||||
RMJ = (HNN, CSR)
|
||||
KSL = (BCK, QQJ)
|
||||
HCK = (QMN, TKB)
|
||||
LBX = (HFD, XQH)
|
||||
MTL = (NCH, FRT)
|
||||
XHR = (KFL, TLM)
|
||||
LLH = (LFC, XSP)
|
||||
JRJ = (XXB, VVD)
|
||||
KGM = (FQS, KGC)
|
||||
SDT = (MNQ, GTN)
|
||||
GJQ = (KLG, DMS)
|
||||
RNG = (RNR, GHB)
|
||||
DCK = (TXL, GPD)
|
||||
DXJ = (DXP, VCX)
|
||||
SNP = (KSC, HKX)
|
||||
KRS = (BMQ, GBP)
|
||||
GPC = (RMQ, XLJ)
|
||||
CDB = (MXQ, XLM)
|
||||
NLV = (FGS, KNL)
|
||||
GNB = (HXR, QNQ)
|
||||
KFL = (PGT, LVQ)
|
||||
HQL = (QXR, MTL)
|
||||
BJR = (PBH, PHT)
|
||||
QTL = (LLR, NLV)
|
||||
SNB = (CRL, QTS)
|
||||
LDP = (PBN, PBN)
|
||||
DFJ = (FHJ, RBS)
|
||||
JJP = (XMJ, VVQ)
|
||||
GQC = (QRB, KQD)
|
||||
SFR = (DPC, TCV)
|
||||
MPB = (FSM, GGL)
|
||||
SXP = (QFP, GFQ)
|
||||
MNF = (DKG, FLS)
|
||||
KLG = (NXV, BTG)
|
||||
TVH = (JFB, PJJ)
|
||||
SHJ = (SFX, TMT)
|
||||
RHF = (SRD, KBV)
|
||||
XBR = (NQQ, HFF)
|
||||
PBD = (RVJ, TXC)
|
||||
XXQ = (KSL, DDL)
|
||||
FTP = (XNF, XFK)
|
||||
HBC = (JTF, LLH)
|
||||
BTG = (HDB, VMT)
|
||||
KFX = (DMH, GBM)
|
||||
SGH = (MLK, TKF)
|
||||
CVS = (GBP, BMQ)
|
||||
DDL = (BCK, QQJ)
|
||||
PKM = (QNV, DPJ)
|
||||
QSR = (KJL, PNS)
|
||||
KPD = (PCT, MCP)
|
||||
BHH = (LVC, LVC)
|
||||
MDR = (HTG, SFD)
|
||||
HKK = (DXL, HPD)
|
||||
SMD = (RCQ, NJD)
|
||||
XMJ = (MKM, NTN)
|
||||
CQS = (DNH, TLH)
|
||||
PBH = (HMF, DST)
|
||||
MKC = (CJH, JDQ)
|
||||
KLL = (FJB, PQX)
|
||||
CXP = (VGS, HFX)
|
||||
JPF = (STX, BXV)
|
||||
CRV = (RCQ, NJD)
|
||||
FDK = (NRB, HHT)
|
||||
BTT = (CRV, SMD)
|
||||
RHT = (JBV, JFM)
|
||||
MXR = (FTV, CMV)
|
||||
DBL = (DJR, VQJ)
|
||||
CHX = (DDL, KSL)
|
||||
JKX = (VDX, NGH)
|
||||
MQA = (HTF, TKM)
|
||||
DJQ = (DLT, SBS)
|
||||
VFR = (SFD, HTG)
|
||||
NMN = (KPF, GTB)
|
||||
JNK = (VNQ, TPT)
|
||||
KJH = (GTF, NCX)
|
||||
QLS = (GXF, SCK)
|
||||
NHR = (PNQ, RGQ)
|
||||
FPF = (NBM, NQF)
|
||||
BKP = (KLL, TDJ)
|
||||
SBC = (TTF, SSS)
|
||||
XMN = (GTN, MNQ)
|
||||
PBB = (RRT, BPK)
|
||||
XVS = (GBM, DMH)
|
||||
HFX = (MPN, JLH)
|
||||
KDS = (TXG, DBT)
|
||||
DDN = (GDD, DFJ)
|
||||
SSS = (CST, VVF)
|
||||
NGH = (RNG, BCM)
|
||||
HNG = (HBC, FRC)
|
||||
CND = (RCH, RDD)
|
||||
HFD = (NHR, RDV)
|
||||
FRC = (JTF, LLH)
|
||||
TBH = (KDS, CNQ)
|
||||
QNQ = (TFB, KGM)
|
||||
SMT = (MBK, TJN)
|
||||
NGF = (BPV, JNR)
|
||||
XLM = (XVP, QCK)
|
||||
JLB = (SNF, DTL)
|
||||
NXV = (HDB, VMT)
|
||||
VSD = (TMD, VCL)
|
||||
TMT = (GHG, PVG)
|
||||
NNV = (JKX, SKG)
|
||||
HFB = (QQK, BKP)
|
||||
BLD = (SMK, BTJ)
|
||||
JGH = (TKB, QMN)
|
||||
XXX = (NLX, SJQ)
|
||||
LQH = (VLD, LCP)
|
||||
KRM = (BXV, STX)
|
||||
HVN = (FTH, QBL)
|
||||
QXM = (KLG, DMS)
|
||||
DBR = (LLM, NNQ)
|
||||
MVP = (CJH, JDQ)
|
||||
FBR = (MBQ, VPN)
|
||||
SFP = (HRD, SGC)
|
||||
HGD = (SQV, VLV)
|
||||
CJH = (JNK, DXR)
|
||||
DJM = (XSQ, GTP)
|
||||
KXG = (RTK, RKV)
|
||||
HTF = (LSM, PBF)
|
||||
FXX = (MSX, FGG)
|
||||
MFF = (VSC, QCP)
|
||||
TMH = (HQL, GSJ)
|
||||
KBB = (CHN, FSF)
|
||||
XTV = (SBH, SGR)
|
||||
MFH = (JGH, HCK)
|
||||
SGC = (JCR, PMQ)
|
||||
TRQ = (LVM, FFQ)
|
||||
VCL = (DXK, RBD)
|
||||
QSD = (VQF, JCQ)
|
||||
FQR = (FFJ, SXK)
|
||||
KQD = (KDT, JSL)
|
||||
XLJ = (DCG, MPM)
|
||||
FXL = (TFF, SSP)
|
||||
RRN = (DBL, GTL)
|
||||
CKM = (HTM, HHG)
|
||||
VLP = (MGC, PMF)
|
||||
KPQ = (MDL, VFB)
|
||||
XQH = (RDV, NHR)
|
||||
JRN = (MQK, HTP)
|
||||
JMH = (RCH, RDD)
|
||||
JRV = (SNB, MHK)
|
||||
QCP = (DRN, SFR)
|
||||
LLR = (KNL, FGS)
|
||||
NMV = (DLJ, DJQ)
|
||||
KBV = (GQC, PRB)
|
||||
JXC = (FFJ, FFJ)
|
||||
LFS = (MHB, VXT)
|
||||
DST = (XHR, PCS)
|
||||
SNJ = (TBX, SPL)
|
||||
KND = (FDH, CCG)
|
||||
CMT = (KPK, RMJ)
|
||||
HHG = (PFM, LVD)
|
||||
RPP = (MBN, TTD)
|
||||
MBK = (HJH, HGC)
|
||||
NQF = (JPF, KRM)
|
||||
FPN = (BFS, RVB)
|
||||
GFQ = (RTL, XBP)
|
||||
SCH = (NGK, SQP)
|
||||
VFX = (THG, LCV)
|
||||
CTG = (TMT, SFX)
|
||||
PGT = (CMT, RFB)
|
||||
RLB = (TFF, SSP)
|
||||
STD = (SJT, TFZ)
|
||||
VMM = (FPF, VKS)
|
||||
SFX = (GHG, PVG)
|
||||
BXV = (CGJ, PGK)
|
||||
FBT = (TBM, RHF)
|
||||
LJJ = (SNF, DTL)
|
||||
LKF = (MBN, TTD)
|
||||
QNV = (KRC, VMF)
|
||||
VGS = (MPN, JLH)
|
||||
MKM = (JJD, BKL)
|
||||
HKX = (SVX, RKF)
|
||||
MSL = (CRV, SMD)
|
||||
RHM = (CHQ, XXG)
|
||||
FRP = (MSF, MSF)
|
||||
VCV = (VSC, QCP)
|
||||
FMH = (VXR, GDS)
|
||||
FLR = (VGS, HFX)
|
||||
GHV = (PDB, SGT)
|
||||
FHQ = (MRD, JRG)
|
||||
HJF = (RDB, NTD)
|
||||
MSM = (FBR, FCT)
|
||||
GHB = (JXT, RTR)
|
||||
BMQ = (MFH, GTR)
|
||||
MCP = (VNP, SJH)
|
||||
SRD = (PRB, GQC)
|
||||
DXR = (TPT, VNQ)
|
||||
RFB = (KPK, RMJ)
|
||||
GSJ = (MTL, QXR)
|
||||
FHJ = (PGN, GNH)
|
||||
LCQ = (DBR, HFQ)
|
||||
GBM = (PDP, QSD)
|
||||
TPT = (JHF, MSN)
|
||||
MVV = (CNP, FSS)
|
||||
KXD = (LQH, DKR)
|
||||
PXV = (QXM, GJQ)
|
||||
BHN = (KPQ, CPV)
|
||||
SBS = (RRN, SDV)
|
||||
LHX = (SLR, DRD)
|
||||
TBM = (KBV, SRD)
|
||||
DXK = (PLP, FGX)
|
||||
NKD = (QFP, GFQ)
|
||||
PVG = (MCL, MPB)
|
||||
TTF = (VVF, CST)
|
||||
PDP = (VQF, JCQ)
|
||||
MSX = (NRD, SNP)
|
||||
CMV = (RSV, DCK)
|
||||
PMF = (NLT, MGS)
|
||||
MSF = (SJT, SJT)
|
||||
NTC = (DKR, LQH)
|
||||
GNH = (VHV, FBD)
|
||||
GSD = (VQG, VXS)
|
||||
VBH = (JKX, SKG)
|
||||
GTR = (JGH, HCK)
|
||||
SSL = (MHB, VXT)
|
||||
NLG = (NTS, DNB)
|
||||
JRQ = (NKP, GHV)
|
||||
MLK = (MFF, VCV)
|
||||
BLF = (HRD, SGC)
|
||||
BGK = (HJF, LNR)
|
||||
VQF = (XCB, DHT)
|
||||
GVP = (QKK, KND)
|
||||
FTD = (MXQ, XLM)
|
||||
JST = (JFC, KVG)
|
||||
JFC = (TJJ, TRS)
|
||||
MMD = (DDH, RSM)
|
||||
SBH = (TKX, VQV)
|
||||
PDH = (CVS, KRS)
|
||||
NRH = (CHN, FSF)
|
||||
MRD = (JCX, DXJ)
|
||||
KGC = (VGJ, HFG)
|
||||
RRB = (FFT, FRS)
|
||||
KQR = (GSJ, HQL)
|
||||
FSV = (XVS, KFX)
|
||||
DBC = (PSR, QXX)
|
||||
GMR = (KKH, HVN)
|
||||
CLG = (CLL, PXZ)
|
||||
JNL = (HFF, NQQ)
|
||||
JCR = (KBB, NRH)
|
||||
FTV = (DCK, RSV)
|
||||
DPC = (FHQ, GMQ)
|
||||
MVC = (XSQ, GTP)
|
||||
KXK = (GMD, BJR)
|
||||
DPJ = (KRC, VMF)
|
||||
FTC = (GSX, KSB)
|
||||
TBK = (QKN, XJZ)
|
||||
VFG = (SHJ, CTG)
|
||||
VXT = (QLJ, VSX)
|
||||
MHB = (VSX, QLJ)
|
||||
MMV = (TPF, FXQ)
|
||||
QCN = (DNH, TLH)
|
||||
KPK = (CSR, HNN)
|
||||
RDV = (PNQ, RGQ)
|
||||
DCG = (KGS, NMN)
|
||||
FJB = (VRC, KXG)
|
||||
NTD = (PKM, FLG)
|
||||
DBT = (GPM, KJH)
|
||||
LLL = (HFB, DNR)
|
||||
SMR = (BPX, QLM)
|
||||
MGS = (HKK, KCD)
|
||||
HHT = (SCS, SGH)
|
||||
MVK = (CQL, XFH)
|
||||
GFH = (KBT, MHP)
|
||||
JNC = (FLS, DKG)
|
||||
QHD = (RRT, BPK)
|
||||
NTN = (BKL, JJD)
|
||||
VQS = (CNK, RJQ)
|
||||
KQH = (XQH, HFD)
|
||||
GGL = (DBC, GKF)
|
||||
QQK = (KLL, TDJ)
|
||||
LHK = (HGQ, FJP)
|
||||
RKV = (GVR, PLT)
|
||||
VKV = (TBM, RHF)
|
||||
MPN = (XGV, MXR)
|
||||
PHM = (RJQ, CNK)
|
||||
TPG = (BQG, BMH)
|
||||
CLL = (PTH, JCK)
|
||||
MXQ = (XVP, QCK)
|
||||
NXB = (BPV, JNR)
|
||||
GTN = (PFS, HGV)
|
||||
FRT = (VKF, BCX)
|
||||
GRX = (THD, KLR)
|
||||
VLV = (MVP, MKC)
|
||||
NJD = (QBX, XTV)
|
||||
VJV = (QXM, GJQ)
|
||||
KPF = (MFM, PMV)
|
||||
JCM = (TJN, MBK)
|
||||
HFG = (TVH, PCJ)
|
||||
HJH = (QNB, PDH)
|
||||
JTN = (JRJ, LGV)
|
||||
CHQ = (XFN, MLR)
|
||||
JNR = (TXN, KPD)
|
||||
BCM = (RNR, GHB)
|
||||
PCS = (TLM, KFL)
|
||||
DXP = (QTL, NVV)
|
||||
KJF = (NTC, KXD)
|
||||
DLT = (RRN, SDV)
|
||||
QXN = (TBH, SQN)
|
||||
TMC = (FBT, VKV)
|
||||
PJJ = (GXC, FXX)
|
||||
KXH = (KSB, GSX)
|
||||
GDS = (XCS, GRX)
|
||||
BQG = (GVP, NSQ)
|
||||
XNF = (TMC, QNM)
|
||||
RFM = (CHT, NMV)
|
||||
JDQ = (JNK, DXR)
|
||||
LKP = (MSF, STD)
|
||||
TFB = (FQS, KGC)
|
||||
DNR = (BKP, QQK)
|
||||
FGX = (FPT, QSR)
|
||||
HXR = (KGM, TFB)
|
||||
XKK = (NTC, KXD)
|
||||
FDH = (JDT, PJD)
|
||||
FTH = (PRF, LXK)
|
||||
TCF = (GXP, QLS)
|
||||
TXN = (PCT, MCP)
|
||||
TPF = (LLL, JMX)
|
||||
LPV = (LVM, FFQ)
|
||||
HXF = (FXL, RLB)
|
||||
HGV = (KFF, HMH)
|
||||
MCN = (BLD, NPF)
|
||||
SMP = (BTT, MSL)
|
||||
LVM = (FBV, QJS)
|
||||
TCV = (GMQ, FHQ)
|
||||
FLG = (DPJ, QNV)
|
||||
PTH = (LFS, SSL)
|
||||
SQS = (SHJ, CTG)
|
||||
GBP = (MFH, GTR)
|
||||
QCK = (LDP, HSN)
|
||||
JCK = (LFS, SSL)
|
||||
TNL = (LVC, CLG)
|
||||
GKF = (QXX, PSR)
|
||||
PCJ = (PJJ, JFB)
|
||||
MBH = (DXH, HXF)
|
||||
PLP = (FPT, QSR)
|
||||
VXQ = (JRQ, GBR)
|
||||
DDH = (KSG, SMP)
|
||||
PKS = (TKR, VSD)
|
||||
JRT = (CXP, FLR)
|
||||
HMH = (SQS, VFG)
|
||||
DNB = (JRT, BRM)
|
||||
BRB = (DFJ, GDD)
|
||||
PSR = (SFP, BLF)
|
||||
KSK = (KPQ, CPV)
|
||||
QXX = (BLF, SFP)
|
||||
SSP = (GMR, RSJ)
|
||||
VMF = (DGM, XCR)
|
||||
MNQ = (PFS, HGV)
|
||||
HSR = (VXQ, GNP)
|
||||
KSG = (MSL, BTT)
|
||||
VRV = (RSC, QMH)
|
||||
XXG = (MLR, XFN)
|
||||
RVB = (JRV, RPL)
|
||||
KDT = (MVC, DJM)
|
||||
SQN = (CNQ, KDS)
|
||||
BPV = (TXN, KPD)
|
||||
SJT = (PBD, NQT)
|
||||
LCV = (FRP, LKP)
|
||||
CNQ = (TXG, DBT)
|
||||
GPD = (FTP, XSX)
|
||||
CHN = (SMT, JCM)
|
||||
XGT = (MSM, CXN)
|
||||
TFF = (GMR, RSJ)
|
||||
QKK = (FDH, CCG)
|
||||
CHT = (DLJ, DJQ)
|
||||
BRM = (CXP, FLR)
|
||||
KFF = (VFG, SQS)
|
||||
FGS = (KVF, JRN)
|
||||
SFD = (GFH, VDQ)
|
||||
RMQ = (MPM, DCG)
|
||||
AAA = (SQV, VLV)
|
||||
JJD = (XJX, CKM)
|
||||
VVD = (HXL, VKG)
|
||||
SCF = (VLP, SST)
|
||||
RKF = (BSN, TBK)
|
||||
LVQ = (CMT, RFB)
|
||||
SCK = (SCF, SLN)
|
||||
TXG = (GPM, KJH)
|
||||
DXZ = (NKH, THS)
|
||||
HMF = (PCS, XHR)
|
||||
KKH = (QBL, FTH)
|
||||
THS = (PMD, BDV)
|
||||
FCT = (MBQ, VPN)
|
||||
VVQ = (MKM, NTN)
|
||||
QNM = (VKV, FBT)
|
||||
LTL = (XMJ, VVQ)
|
||||
TDF = (QTH, TMR)
|
||||
VNQ = (JHF, MSN)
|
||||
KCL = (QLM, BPX)
|
||||
RMS = (TTF, SSS)
|
||||
HGC = (QNB, PDH)
|
||||
JTF = (LFC, XSP)
|
||||
PMV = (DDN, BRB)
|
||||
VTJ = (CPQ, LHX)
|
||||
NNQ = (BHN, KSK)
|
||||
NRF = (VTS, MRG)
|
||||
QNB = (KRS, CVS)
|
||||
RCQ = (QBX, XTV)
|
||||
MCL = (FSM, GGL)
|
||||
NTS = (JRT, BRM)
|
||||
QQJ = (NRF, SDX)
|
||||
QFP = (XBP, RTL)
|
||||
DPN = (BFS, RVB)
|
||||
XCR = (HDV, GSD)
|
||||
SGT = (BHH, TNL)
|
||||
JGA = (PBD, NQT)
|
||||
LSM = (XGT, MSG)
|
||||
PLT = (FVD, QLZ)
|
||||
RSC = (MMD, GPB)
|
||||
DXH = (RLB, FXL)
|
||||
TMD = (DXK, RBD)
|
||||
QDS = (JFC, KVG)
|
||||
KCD = (DXL, HPD)
|
||||
GMD = (PHT, PBH)
|
||||
DLJ = (DLT, SBS)
|
||||
DJR = (SMR, KCL)
|
||||
SGR = (VQV, TKX)
|
||||
RBD = (FGX, PLP)
|
||||
SFJ = (GNP, VXQ)
|
||||
GXP = (SCK, GXF)
|
||||
QBX = (SBH, SGR)
|
171
8/src/main.rs
171
8/src/main.rs
@ -1,171 +0,0 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Lines};
|
||||
|
||||
use lazy_regex::{lazy_regex, Lazy, Regex};
|
||||
|
||||
// BOILERPLATE
|
||||
type InputIter = Lines<BufReader<File>>;
|
||||
|
||||
fn get_input() -> InputIter {
|
||||
let f = File::open("input").unwrap();
|
||||
let br = BufReader::new(f);
|
||||
br.lines()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Problem 1 solution: {}", problem1(get_input()));
|
||||
println!("Problem 2 solution: {}", problem2(get_input()));
|
||||
}
|
||||
|
||||
// PARSE
|
||||
|
||||
const LINE_REGEX: Lazy<Regex> = lazy_regex!(r"([A-Z0-9]{3}) = \(([A-Z0-9]{3}), ([A-Z0-9]{3})\)");
|
||||
|
||||
enum Instruction {
|
||||
LEFT,
|
||||
RIGHT,
|
||||
}
|
||||
|
||||
impl From<char> for Instruction {
|
||||
fn from(c: char) -> Self {
|
||||
match c {
|
||||
'L' => Self::LEFT,
|
||||
'R' => Self::RIGHT,
|
||||
_ => panic!("Invalid instruction"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Element {
|
||||
left: String,
|
||||
right: String,
|
||||
}
|
||||
|
||||
type Nodes = HashMap<String, Element>;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Map {
|
||||
instructions: Vec<char>,
|
||||
nodes: Nodes,
|
||||
}
|
||||
|
||||
fn parse_node(nodes: &mut Nodes, node: &str) {
|
||||
let matches = LINE_REGEX.captures(node).unwrap();
|
||||
|
||||
let node_id = matches.get(1).unwrap().as_str();
|
||||
let left = matches.get(2).unwrap().as_str();
|
||||
let right = matches.get(3).unwrap().as_str();
|
||||
|
||||
nodes.insert(
|
||||
node_id.to_string(),
|
||||
Element {
|
||||
left: left.to_string(),
|
||||
right: right.to_string(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
impl<T: BufRead> From<Lines<T>> for Map {
|
||||
fn from(mut lines: Lines<T>) -> Self {
|
||||
let instructions = lines.next().unwrap().unwrap().chars().collect();
|
||||
let mut nodes = HashMap::new();
|
||||
lines.next();
|
||||
for line in lines {
|
||||
parse_node(&mut nodes, line.unwrap().as_str());
|
||||
}
|
||||
|
||||
Self {
|
||||
instructions,
|
||||
nodes,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PROBLEM 1 solution
|
||||
|
||||
fn problem1<T: BufRead>(input: Lines<T>) -> u64 {
|
||||
let map = Map::from(input);
|
||||
|
||||
let mut count = 0;
|
||||
let mut cur_node = "AAA";
|
||||
for side in map.instructions.iter().cycle() {
|
||||
count += 1;
|
||||
cur_node = match side {
|
||||
'L' => &map.nodes[cur_node].left,
|
||||
'R' => &map.nodes[cur_node].right,
|
||||
_ => panic!("invalid instruction"),
|
||||
};
|
||||
if cur_node == "ZZZ" {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
0
|
||||
}
|
||||
|
||||
fn node_cycle_length(map: &Map, node: &str) -> u64 {
|
||||
let mut count = 0;
|
||||
let mut cur_node = node;
|
||||
for side in map.instructions.iter().cycle() {
|
||||
count += 1;
|
||||
cur_node = match side {
|
||||
'L' => &map.nodes[cur_node].left,
|
||||
'R' => &map.nodes[cur_node].right,
|
||||
_ => panic!("invalid instruction"),
|
||||
};
|
||||
if cur_node.ends_with('Z') {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
// PROBLEM 2 solution
|
||||
fn problem2<T: BufRead>(input: Lines<T>) -> u64 {
|
||||
let map = Map::from(input);
|
||||
|
||||
let starting_nodes: Vec<_> = map.nodes.keys().filter(|s| s.ends_with('A')).collect();
|
||||
|
||||
starting_nodes.iter().map(|n| node_cycle_length(&map, *n)).fold(1, |accum, elem| num::integer::lcm(accum, elem))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::*;
|
||||
use std::io::Cursor;
|
||||
|
||||
const EXAMPLE: &str = &"RL
|
||||
|
||||
AAA = (BBB, CCC)
|
||||
BBB = (DDD, EEE)
|
||||
CCC = (ZZZ, GGG)
|
||||
DDD = (DDD, DDD)
|
||||
EEE = (EEE, EEE)
|
||||
GGG = (GGG, GGG)
|
||||
ZZZ = (ZZZ, ZZZ)";
|
||||
|
||||
const EXAMPLE2: &str = &"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)";
|
||||
|
||||
#[test]
|
||||
fn problem1_example() {
|
||||
let c = Cursor::new(EXAMPLE);
|
||||
assert_eq!(problem1(c.lines()), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn problem2_example() {
|
||||
let c = Cursor::new(EXAMPLE2);
|
||||
assert_eq!(problem2(c.lines()), 6);
|
||||
}
|
||||
}
|
@ -24,24 +24,4 @@ fn problem1<T: BufRead>(input: Lines<T>) -> u64 {
|
||||
// PROBLEM 2 solution
|
||||
fn problem2<T: BufRead>(input: Lines<T>) -> u64 {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::*;
|
||||
use std::io::Cursor;
|
||||
|
||||
const EXAMPLE: &str = &"";
|
||||
|
||||
#[test]
|
||||
fn problem1_example() {
|
||||
let c = Cursor::new(EXAMPLE);
|
||||
assert_eq!(problem1(c.lines()), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn problem2_example() {
|
||||
let c = Cursor::new(EXAMPLE);
|
||||
assert_eq!(problem2(c.lines()), 0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user