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
3 of 3

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]3 points3 years, 1 month ago* (edited 36 minutes after)

Python3 solution (). What a fun day 2!

with open("input.txt") as f:
    content = f.read().split("\n")[:~0]

score = 0
lose = {"X":"B","Y":"C","Z":"A"}
win = {"Y":"A","Z":"B","X":"C"}

lose_me = {"B":"X","C":"Y","A":"Z"}
win_me = {"A":"Y","B":"Z","C":"X"}
draw = {"A":"X","B":"Y","C":"Z"}

for item in content:
    if item[2] == "X":
        score += 1
    elif item[2] == "Y":
        score += 2
    elif item[2] == "Z":
        score += 3
    if win[item[2]] == item[0]:
        score += 6
    elif lose[item[2]] == item[0]:
        score += 0
    else:
        score += 3
new_score = 0
for item in content:
    if item[2] == "X":
        my_item = lose_me[item[0]]
        if my_item == "X":
            new_score += 1
        elif my_item == "Y":
            new_score += 2
        elif my_item == "Z":
            new_score += 3
    elif item[2] == "Y":
        my_item = draw[item[0]]
        if my_item == "X":
            new_score += 1
        elif my_item == "Y":
            new_score += 2
        elif my_item == "Z":
            new_score += 3
        new_score += 3
    elif item[2] == "Z":
        my_item = win_me[item[0]]
        if my_item == "X":
            new_score += 1
        elif my_item == "Y":
            new_score += 2
        elif my_item == "Z":
            new_score += 3
        new_score += 6
answer_one = score
answer_two = new_score
print("p1:", answer_one)
print("p2:", answer_two)

Edit: Here is some optimized code I made after the fact!

permalinkhide replies (1)as-of
[–]daggerdragon2 points3 years, 1 month ago* (edited 12 minutes after)

Please edit your post to format your code with the right Markdown syntax so your code is easier to read. Thank you!

edit: Thank you for fixing it <3

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

Should be fixed!

permalinkparentcontextas-of
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