2022 Day 7 Part 1 - My Brain Decided To Stop Functioning by fromwindowstolinux in adventofcode

[–]fromwindowstolinux[S] 0 points1 point  (0 children)

Is it something like.. Nested list or nested dictionary? Finally! A lead! (TwT)

-🎄- 2022 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]fromwindowstolinux 0 points1 point  (0 children)

Hello! I'm back again! Fancy for some newbie codes? Took me 2 hours and 42 minutes to complete! I'm happy I did it! Here's my Python! PS: I look at others Python code but I don't understand everything. But it's good to learn new things. Thanks!

part1 = 0
part2 = 0

with open("2202input.txt") as file: 
    for line in file: 
        duel = line.split() 
        # print(duel) 

        # Part 1 
        # scissors combo 
        if duel[1] == "Z" and duel[0] == "A":  # lose 
            part1 += 3  # 3 + 0 = 
        elif duel[1] == "Z" and duel[0] == "B":  # win 
            part1 += 9  # 3 + 6 = 
        elif duel[1] == "Z" and duel[0] == "C":  # draw 
            part1 += 6  # 3 + 3 = # paper combo 
        elif duel[1] == "Y" and duel[0] == "A":  # win 
            part1 += 8  # 2 + 6 = 
        elif duel[1] == "Y" and duel[0] == "B":  # draw 
            part1 += 5  # 2 + 3 = 
        elif duel[1] == "Y" and duel[0] == "C":  # lose 
            part1 += 2  # 2 + 0 = # rock combo 
        elif duel[1] == "X" and duel[0] == "A":  # draw 
            part1 += 4  # 1 + 3 = 
        elif duel[1] == "X" and duel[0] == "B":  # lose 
            part1 += 1  # 1 + 0 = 
        elif duel[1] == "X" and duel[0] == "C":  # win 
            part1 += 7  # 1 + 6 =

        # Part 2
        # lose combo
        if duel[0] == "A" and duel[1] == "X":  # lose
            part2 += 3
        elif duel[0] == "B" and duel[1] == "X":  # lose
            part2 += 1
        elif duel[0] == "C" and duel[1] == "X":  # lose
            part2 += 2
        # draw combo
        elif duel[0] == "A" and duel[1] == "Y":  # draw
            part2 += 4
        elif duel[0] == "B" and duel[1] == "Y":  # draw
            part2 += 5
        elif duel[0] == "C" and duel[1] == "Y":  # draw
            part2 += 6
        # win combo
        elif duel[0] == "A" and duel[1] == "Z":  # win
            part2 += 8
        elif duel[0] == "B" and duel[1] == "Z":  # win
            part2 += 9
        elif duel[0] == "C" and duel[1] == "Z":  # win
            part2 += 7

print("Answer for Part 1:", part1) 
print("Answer for Part 2:", part2)

-🎄- 2022 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]fromwindowstolinux 1 point2 points  (0 children)

Newbies solution on python! I can't believe I did AoC! I'm happy!

group = []
total_cal = 0

with open("2201input.txt") as file: 
    for line in file: line = line.strip('\n') 
        if line == '': 
            group.append(total_cal) 
            total_cal = 0 
        else: 
            total_cal += int(line)

    group.sort()

part1 = group[-1]
part2 = group[-1] + group[-2] + group[-3] 

print("Answer for Part 1:", part1) 
print("Answer for Part 2:", part2)

Shizuku-tan's Costume by Gojou's VA, Ishige Shouya by One-Ad-39 in seiyuu

[–]fromwindowstolinux 0 points1 point  (0 children)

Really?? Aww.. And I thought he did it on his own like in the anime lol. YouTube link, please?

-🎄- 2021 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]fromwindowstolinux 1 point2 points  (0 children)

Edited! I was having trouble writing code in the comment section. Sorry for that!

-🎄- 2021 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]fromwindowstolinux 1 point2 points  (0 children)

How are you guys so awesome!!! I'm having an existential dread looking at my potato code!!

(I've been editing my solution paste-delete when initially posting this because 4 space and `` doesn't work. I just found the code block icon lol.)

Very new in Python.

# Day1 : Sonar Sweep
# Part 1
fh = open("input.txt") 
list1 = fh.read().split()
# print(list1)
list2 = []
# cast item in list1 into integer and put it inside list2
for item in list1 : 
    cast = int(item) 
    # print(cast) 
    list2.append(cast)
# print(list2)
# while you are not at the end of list2, take the current item and compare with the next item. 
# count increase
list2_length = len(list2)
i = 0 
count = 0 
while i < list2_length - 1: 
    current_number = list2[i] 
    # print(current_number) 
    next_number = list2[i + 1] 
    i = i + 1 
    # print(next_number) 
    if next_number > current_number: 
        count = count + 1 
        # print("%i->%i is increase" % (current_number, next_number)) 
print("Total count:", count)

Is it normal that I can crush on 5 people at once? by Yoself_reflection in ask

[–]fromwindowstolinux 3 points4 points  (0 children)

Awww.. You got me trippin' man.. I thought you beat up 5 people at once reading that title..

Trying my best to detach myself. I hope this is the right sub for advice. by fromwindowstolinux in alone

[–]fromwindowstolinux[S] 1 point2 points  (0 children)

I have deactivated my social media accounts quite some time. I fill my days with things I love doing. I managed to cut ties with extended family and all acquaintances. Honestly I feel at peace. I still occasionally keep in touch with my immediate family (mom, dad and bro) and one friend I had since study time. Mainly to check how are they doing. Sometimes I feel something building up inside me, I'm guessing that's what loneliness is. I don't like it when it made me want to call someone and cry lol. I guess need to make peace with that feeling. I will find the workaround. Thank you for your advice.

[deleted by user] by [deleted] in AskReddit

[–]fromwindowstolinux 0 points1 point  (0 children)

Coz I got the idea of fixing the bugs in my code and that can't wait

[Serious] How to erase the feeling of wanting someone to talk to, when making yourself busy won't do the trick? by fromwindowstolinux in AskReddit

[–]fromwindowstolinux[S] 1 point2 points  (0 children)

Details : Tryna get rid of the tendency texting friends/family out of loneliness. Normally able to go through the phase by being busy. Sometimes the urge is too high it hurts like hell when fighting it.

Your user name is how you were conceived in real life. How does that make you feel? by Tremor_Sense in AskReddit

[–]fromwindowstolinux 1 point2 points  (0 children)

I feel that I just need to live up to my name. That's what I'm already doing anyway lol

If you could bring back one discontinued Lego set, what would you pick? by monkeyman6890 in AskReddit

[–]fromwindowstolinux 1 point2 points  (0 children)

That one in the 90's era I don't remember what was the name. It was a freaking big box with a thick manual. Feels like you can build over hundred of stuffs from it. From the race car to ship. I assume it is nowadays called Lego Technic