From 13722dcd8f2f652cc6a039f882f8f17263cbd623 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 5 Dec 2022 01:45:41 -0600 Subject: [PATCH] day 3 --- 03-ex.txt | 6 ++ 03.txt | 300 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 03.yab | 62 +++++++++++ 3 files changed, 368 insertions(+) create mode 100644 03-ex.txt create mode 100644 03.txt create mode 100644 03.yab diff --git a/03-ex.txt b/03-ex.txt new file mode 100644 index 0000000..f17e726 --- /dev/null +++ b/03-ex.txt @@ -0,0 +1,6 @@ +vJrwpWtwJgWrhcsFMMfFFhFp +jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL +PmmdzqPrVvPwwTWBwg +wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn +ttgJtRGJQctTZtZT +CrZsJsPPZsGzwwsLwLmpwMDw diff --git a/03.txt b/03.txt new file mode 100644 index 0000000..53d6524 --- /dev/null +++ b/03.txt @@ -0,0 +1,300 @@ +lDDWVvlVVQfDMlWjGJTRjQCgTGLCLj +ZLZpwzLBhwZhSLBsjntGCtgJRjbnJgSG +qppdZzzsdsmZphrNsNwZhllDHLcVVDWFPvFWcWdFlv +ztdhgJDBJghmQtPFQPpmbw +lVlLRcnfllcfVcccGnSQVLcsTPFbpwsPFspTSqmbpswpbF +cCHRGcGcCRGlGrGcVGnrdWHWBDzBNhhQZWWNBhJz +NfnSSQpdnRSSpvWdSsjZDGNDjGDwTGTjHG +wlPzPqzPFbMmqPCFCJmbsjbHLDDHDZjDjbGHsT +gwMlgmtmPcqVVvhVnvcRnn +cBNBBCHhbhNhblBcCCvcBHSwTwDQSqRwDQpDRsjHST +dPmzMVWdmmMnnZJtZVdqjTSrjTjrpQrsTTVwQRSj +qzmZMmdZPtnGqclblGlbGvgBFc +ZfpmNDfRhzbbqDnD +SFtFjTTZVTFvVTjHrsVvqGBJqhnSSnbJznLGJwJq +TjdPPtdMPPWCcZgW +qsbmGCsjHNhmhmhzTDznpnl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PZbPBbWvTRnLRWntD +MNGQNsQwfzsdGfgTGfzQwwffmnCRDVmJLRLCvnvLDvJCDgRL +wTTdFldNHzTMljjFqphrBqhrZb +wDcMCbZbzPDcZDWQdrJLrQrZBLRBQr +FFSHStjtHgllgFdSNmlfFStBqRRssRsRJrLrjrrJBRVhLJ +fGggtfHtgWMwbCGdCT +RQrQDDbVGrRSfbVbGtmGtwHFWsCCzsJSJJHsJPJvWC +hphQnhZQNjlBBcMMpCsHwFjvvHWHWsFvjC +ppcnnBZqllTQfmrffbtGTDGt +dsDFsBZBhCFhshFrpBFnmLQmHmRgRbLqmmmRQDLm +PPBBNNNtGTwJNfTJffNttfLQgqLgHvHbqRwlgmblRvll +NSNTGTJTWPjGWMPSJJzrBSpzdFSddCFdncrs +bPzRlMPTzTMldJMnhswcjzfQVccQhc +HCCqNmNmQQmQssJn +pHptprtgRStTtMJt +nTmhrsPMsTfmHHGcSgtj +bJJwdlrJQLlvwlQDDwSbgffGVNjfgjNtVbcf +QlpDQFJdvdFqJdFpLvDFpLLnzZMnBMRRzMTqnrzqTRPznz +qRVRqBzgwqRpqRgVqQRPpQJJPrPhPGJnsGrCFdFJrZdG +ZvWDmMvmSvCndssrsJ +WcZcNWlcMjBQpzNTqVBp +DpLPZLDDlcgmDmhVgfgfWWRwhwwt +VrVMdbCrrBTjCMQQtMwQNSqMQW +VCBHdJHdvrrFsbsdrBJTdTzZcpmZGDGPlmzmlccFDZDn diff --git a/03.yab b/03.yab new file mode 100644 index 0000000..1b90243 --- /dev/null +++ b/03.yab @@ -0,0 +1,62 @@ +sub getPriority(ch$) + local a + a = asc(ch$) + if and(a>=asc("a"), a<=asc("z")) return a-asc("a")+1 + if and(a >= asc("A"), a<=asc("Z")) return a-asc("A")+27 +end sub + +open "03.txt" for reading as #1 + +sum = 0 +while not eof(1) + line input #1 line$ + lineLen = len(line$) + halfLen = lineLen/2 + + firstHalf$ = mid$(line$, 1, halfLen) + secondHalf$ = mid$(line$, halfLen + 1) + + for i=1 to halfLen + for j=1 to halfLen + if mid$(firstHalf$, i, 1) == mid$(secondHalf$, j, 1) then + dup$ = mid$(firstHalf$, i, 1) + break 2 + endif + next j + next i + + sum = sum + getPriority(dup$) +wend +close #1 + +print sum + +open "03.txt" for reading as #1 + +sum = 0 +while not eof(1) + line input #1 line1$ + line input #1 line2$ + line input #1 line3$ + + for i=1 to len(line1$) + c1$ = mid$(line1$, i, 1) + + for j=1 to len(line2$) + c2$ = mid$(line2$, j, 1) + if c1$ != c2$ continue + + for k=1 to len(line3$) + c3$ = mid$(line3$, k, 1) + if c2$ != c3$ continue + + badge$ = c3$ + next k + next j + next i + + sum = sum + getPriority(badge$) +wend +close #1 + +print sum