Advent of Code: adventofcode.com/ Rust Adventure Discord advent of code channel: / discord The code from the video (and more): github.com/Chr...
Пікірлер: 7
@BenoîtBurnichonАй бұрын
I have an electronics degree and I knew right from the problem statement what the graph would look like and that you should walk your way from "adding" bits from the least significant to the most significant while checking carries were propagated as expected. Well done doing it via dotgraph visualization even though you did not know the pattern beforehand. Hopefully they did not implement a fast carry adder it would have been really a nightmare to debug.
@fyellinАй бұрын
Yeah. It was clear that they were implementing a half-adder followed by 42 full adders. Once I was able to reliably identify the carry-in at each step, finding the swaps became much easier.
@talideonАй бұрын
There's a hint in the input, or at least there was for mine: of dump each ordered by the z pin as an equation and look at it, the pattern of the initial half adder followed by a series of full adders with carry becomes super obvious: it's a ripple carry adder. Where I fell into a trap was that I attempted to write something to recognise the sequence of operations, which was fine until I got to the final bit and added some conditiona to recognise the carry base on an initial OR (XOR was my signal to recognise a half/full adder), as this tripped up on an earlier equation as the swap was being done between the adder and the carry logic, but at that point, I knew which pins to flag, so I shrugged and didn't spend any more time on it. In retrospect, it might've been better to just check if the Z corresponded to the expected X/Y inputs and kept track of the carries myself. 🤦 I was trying far to hard to detect _where_ the swaps were occurring in each equation rather than focusing on the relevant bit, which is identifying the bad outputs.
@aderakin5395Ай бұрын
today's problem was very interesting, different from all previous days for sure. First day I had to look up the answer lol. It seems that the majority of answers are fixing the gates manually so petgraph came in handy.
@flwiАй бұрын
Rofl. I got stuck and checked your approach to part 2. I'm curious how you're going to bench 100 photoshop sessions 45:15. maybe you'll get faster over time? 😂 Anyway. I like your approach of visualizing the whole graph and then debugging it. Actually makes me happy, because I often do that (or end up with a bunch of sheets of paper) when I try to understand/debug the problem. In the youtube videos the solves sometimes look quite streamlined, so it's nice the you also use those tools.
@chrisbiscardiАй бұрын
haha, there's gotta be a speedrun category for photoshop. and yeah, especially for advent of code I try to keep the debugging process in. I am not a competitive programmer in general so it gives me a chance to put myself in the shoes of people who are just learning Rust and show how to find functions in the docs, how to debug, etc.
@flwiАй бұрын
very valuable indeed. I have one year experience with rust now and often learned one or two things every day from your videos. Watched them after I solved it myself and then do some refectorings.