Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8374

Teaching and learning resources • Re: Advent of Code 2024

$
0
0

I'm done with advent 2024. Have 3.5 days left, but I cant force myslf to do them.
Due to the slow compile times, I delegated day 24 to Purr who seems content sleeping while the Chapel compiler churns away.
I searched online for information about ripple carry adders and found what I thought was a nicely explained solution to part 2 written in Go. The approach used was to identify crossed wires by their failure to adhere to some local connection rules. In particular
Thanks to this post, I landed on these 4 rules to find the eight faulty wires:
  1. If the output of a gate is z, then the operation has to be XOR unless it is the last bit.
    • If the output of a gate is not z and the inputs are not x, y then it has to be AND / OR gate, but not XOR gate.
      • If you have a XOR gate with inputs x, y, there must be another XOR gate with the output of this gate as an input. Search through all gates for an XOR-gate with this gate as an input; if it does not exist, your (original) XOR gate is faulty.
        • Similarly, if you have an AND gate, there must be an OR gate with this gate as an input. If that gate doesn’t exist, the original AND gate is faulty.
        This was long time ago, but I found (almost) the same rules, following this path: As the program is supposed to be adding binary numbers, I first wrote the binary+ function using only AND, OR, and XOR. These rules are then just devised by studying how the function behaves with different inputs. However, it did take me a long time to finally get the result.

        Statistics: Posted by hrvoje064 — Mon Apr 21, 2025 4:08 pm



        Viewing all articles
        Browse latest Browse all 8374

        Trending Articles