LOADING: An error occurred. Update Chrome, try Firefox, or visit this post for more details.

⚠️Reddit changed how removals work, which breaks Reveddit's website. Install the extension to track removed content:Add to chromeAdd to firefoxWhat changed?
✖︎
about reveddit
⚙F.A.Q.add-ons
r/
status
copy sharelink
[+] show filters
103
SOLUTION MEGATHREAD-🎄- 2022 Day 2 Solutions -🎄-(self.adventofcode)
submitted 3 years, 1 month ago* (edited 4 days, 4 hours after) by daggerdragon to /r/adventofcode (134.8k)
1501 commentsredditother-discussionssubreddit-indexmessage modsop-focus

NEW AND NOTEWORTHY

  • All of our rules, FAQs, resources, etc. are in our [community wiki](/r/adve...

... view full text

since 3 years, 1 month ago
6 of 6

Tip Reveddit Real-Time can notify you when your content is removed.

your account history
(check your username's removed content. why?)
Tip Check if your account has any removed comments.
view my removed comments
you are viewing a single comment's thread.
view all comments
[–][deleted]9 points3 years, 1 month ago
[deleted] by user
(check your username's removed content. why?)
hide replies (2)as-of
[–]lxrsg3 points3 years, 1 month ago

nice and short! you could save one line by doing
game = [x.strip() for x in open("day02.txt").readlines()]

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]justjudifer2 points3 years, 1 month ago

Oh thank you!! That was bugging me because that first line feels like such a waste. I’m gonna try that for the next few puzzles.

permalinkparentcontextauthor-focusas-ofpreserve
[–]AstronautNew84521 point3 years, 1 month ago* (edited 8 minutes after)

This approach would have saved me some effort. Just manually score each of the 9 possible games, and then map the inputs. Very nice. Copying your approach for Excel I get:

=LET(input,A1:A2500,
    part1,SWITCH(input,"A X",4,"A Y",8,"A Z",3,"B X",1,"B Y",5,"B Z",9,"C X",7,"C Y",2,"C Z",6),
    part2,SWITCH(input,"A X",3,"A Y",4,"A Z",8,"B X",1,"B Y",5,"B Z",9,"C X",2,"C Y",6,"C Z",7),
    VSTACK(SUM(part1),SUM(part2)))
permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]justjudifer1 point3 years, 1 month ago

Thank you! I caught myself despairing at the thought of writing a bazillion if/else statements and luckily remembered that this requires a lot less writing. Although I did need two tries and so many comments in my code to get the second table correct

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]AstronautNew84521 point3 years, 1 month ago

It took me more than 20 minutes and several tries to get the logic right for part 2. And the end result wasn’t pretty.

permalinkparentcontextauthor-focusas-ofpreserve
r/revedditremoved.substack.com
🚨 NEWS 🚨
✖︎

Important: Reddit Changed How Removals Work

A recent Reddit update makes mod-removed content disappear from profile pages, which breaks Reveddit's website.

Install the browser extension to receive removal alerts.

Add to chromeAdd to firefox

What changed?

r/revedditremoved.substack.com