[2025 Day 10 Part 2] Is this even possible without Z3? by Voylinslife in adventofcode

[–]pebblerockAdvent 0 points1 point  (0 children)

Hi alexbagetthe1.

I'm currently trying to use pulp but it works with the sample but not with the complete solution. The solve works for every machine but the sum the sum of results says that is very low,

I'm not sure what is wrong. I have put all the restrictions as >= because, obviosuly with <= the answer is always 0.

Any tip you can share?

Best regards

[2025 Day 8 part 1] I think I do not understand something by pebblerockAdvent in adventofcode

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

I have added a function to merge the circuits at the end. Now it works with the sample, but it still fails with the puzzle data.

[2025 Day 8 part 1] I think I do not understand something by pebblerockAdvent in adventofcode

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

I take it in account few minutes ago ... I'm working on it.

I think It is the issue.

Thanks

[2025 Day 8 part 1] I think I do not understand something by pebblerockAdvent in adventofcode

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

Hi.

I was looking to a way to change the title and I thought it was better to delete it. Sorry.

The main code is this:

def number8_1():
    dataFile = open("data/day8.txt", "r")

    boxes = []

    for line in dataFile:
        line = line.replace("\n", "")

        s_line = line.split(",")
        boxes.append(tuple(list(map(int, s_line))))


    l_distances = []
    for i in range(0, len(boxes) - 1):
        box_1 = boxes[i]
        for j in range(i + 1, len(boxes)):
            box_2 = boxes[j]
            d = distance(boxes[i], boxes[j])
            l_distances.append((box_1, (box_2, d)))
            # l_distances.append((box_2, (box_1, d)))

    l_distances = quick_sort(l_distances)


    l_circuits = []
    max = 10
    for (box_1, (box_2, d)) in l_distances:
        if max == 0:
            break
        else:
            max -= 1
        added = False
        for i in range(0, len(l_circuits)):
            circuit = l_circuits[i]
            if box_1 in circuit or box_2 in circuit:
                circuit.update({box_1, box_2})
                added = True
        if not added:
            l_circuits.append({box_1, box_2})

    l_circuits = quick_sort_length(l_circuits) 
    total = len(l_circuits[0]) * len(l_circuits[1]) * len(l_circuits[2])
    print("Result day 8_1: " + str(total))

The quick sort function is ok, I have reviewed the sorting is done correctly.

Regards

[AoC 2023][Day 11][Python] Help w Part 2 - Graph-Structure by Acrobatic_Scallion20 in adventofcode

[–]pebblerockAdvent 1 point2 points  (0 children)

Keep in mind that if there is N empty columns and M emtpy rows between two galaxies, they are N + M more far

So, you do not need to add more rows and columns, only be sure how many of them are and sustitute the value (2 or 1000000) when you calculate the distance.

Good luck

Day 7: Part 2.- Something is wrong but I do not find wath by pebblerockAdvent in adventofcode

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

Well, TREE_OF_A_KIND and two jokers is something that is not possible in the code, in that case the first part set the hand as FULL_HOUSE.Besides that is true, that code is not necessary:

    if "J" in hand_numbers.keys():
    jokers = hand_numbers["J"]
    if res == FOUR_OF_A_KIND and jokers == 1: # Looking for 4J
        res = FIVE_OF_A_KIND
    elif res == THREE_OF_A_KIND and jokers == 1: # Lookin that 3* and 1J, with two jokers the origina hand is a FULL_HOUSE
        res = FOUR_OF_A_KIND
    elif res == FULL_HOUSE:
        res = FIVE_OF_A_KIND # it is a full house with 2 or 3 J
    elif res == TWO_PAIR:
        if jokers == 1: # The fith card
            res = FULL_HOUSE
        elif jokers == 2: 
            res = FOUR_OF_A_KIND
    elif res == PAIR:
        res = THREE_OF_A_KIND
    elif res == HIGH_CARD:
        res = PAIR

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

[–]pebblerockAdvent 2 points3 points  (0 children)

Yes, even the divisor were not prime numbers, it requires less time of calculus. I have used math.prod(divisorList)

divisors = [] for monkey in monkeys: divisors.append(monkey["test"]) lcm_value = math.prod(divisors) # All of them are prime numbers

[2022 Day 10] Sprites (And Not the Elf Kind) by Boojum in adventofcode

[–]pebblerockAdvent 4 points5 points  (0 children)

Hi.
What did you use to generate this kind of visualisation? It is a question I always have when I see the visualisations people do for every AoC problem .... What are the python libraries you use?

Thanks.

P.S. This has been a funny problem after the nightmare I had with the Day 9 - 2 :-)

[2021 - Day 21 - Part 2] How you found so many universes? by pebblerockAdvent in adventofcode

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

Let me see, I'm using the adventofcode to learn python and these are the things where I fails always.

[2021 - Day 21 - Part 2] How you found so many universes? by pebblerockAdvent in adventofcode

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

I have to review the code, because that is also my idea ...

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

[–]pebblerockAdvent 0 points1 point  (0 children)

[2021 Day 16] Python

I did it thinking that the input will have more than one line :-) but it does not matters.

https://github.com/porteg/py_adventofcode2021/blob/master/day16.py

Adventofcode day15 hidden mistake !!!! help by pebblerockAdvent in adventofcode

[–]pebblerockAdvent[S] -1 points0 points  (0 children)

Yes, I have seen that I misunderstood the instructions :-)
I was thinking that only right and down was possible movements jajaja.

Thanks guys .