home.social

#adventofcode2024 — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #adventofcode2024, aggregated by home.social.

fetched live
  1. It took me until the end of August 2025, but I finally got done with a massive #AdventOfCode project: a SINGLE LINE of #Python that solves EVERY DAY of #AdventOfCode2024!

    I call it "The Drakaina", after the Python of Greek mythology. Look, if you dare...

    github.com/WinslowJosiah/adven

  2. It took me until the end of August 2025, but I finally got done with a massive #AdventOfCode project: a SINGLE LINE of #Python that solves EVERY DAY of #AdventOfCode2024!

    I call it "The Drakaina", after the Python of Greek mythology. Look, if you dare...

    github.com/WinslowJosiah/adven

  3. 需要用到一點點數學,問題是不難的,今次Qwen3沒有跳步了,可以正常地用它將文字描述的邏輯寫成代碼,但是 #Rust 在這裏變得不太好用了,例如那些usize的運算需要手動關注和修一修

    github.com/cosmoswafer/advent-

    #AdventOfCode #AdventOfCode2024

  4. Finally got to doing 25th day of #AdventOfCode today and thus collected all 50 stars of this year. 🎉

    Now I just need to get back to day 24 and write a proper solution (as I only did it partly in code, partly eye-balling and manually composing the answer; I used not-so-AI, I guess).

    My Rusty solutions: gitlab.com/silmeth/advent-of-c

    #AdventOfCode2024 #AOC2024 #RustLang #Rust

  5. Wrapping up the 2024 Advent of Code with Juan Vazquez and Cameron Cunning

    With video! Software engineers Juan Vazquez and Cameron Cunning rejoin the show to discuss the 2024 Advent of Code, an annual programming competition.

    straypointers.com/e/s2e20.htm

  6. Wrapping up the 2024 Advent of Code with Juan Vazquez and Cameron Cunning

    With video! Software engineers Juan Vazquez and Cameron Cunning rejoin the show to discuss the 2024 Advent of Code, an annual programming competition.

    #elixir #prolog #go #golang #podcast #AdventOfCode #AdventOfCode2024

    straypointers.com/e/s2e20.htm

  7. CW: Spoiler for AdventOfCode 2024 / 24

    I had a little time today to revisit part 2, which I had previously only solved by hand by visually analyzing the graph of gates.

    I can now solve this in code by classifying the gates into layers:

    Layer 1: XOR and AND gates connected to the inputs
    Layer 2: AND gates not in Layer 1
    Layer 3: OR gates
    Layer 4: XOR gates not in Layer 1

    Each gate in the layers must be followed by a defined set of gates:

    Layer 1 XOR: needs to be followed by a Layer 2 AND and a Layer 4 XOR
    Layer 1 AND: needs to be followed by a Layer 3 OR
    Layer 2 AND: needs to be followed by a Layer 3 OR
    Layer 3 OR: needs to be followed by a Layer 2 AND and a Layer 4 XOR
    Layer 4 XOR: must output z

    Considering edge cases in the first and last rows, if any of these rules are violated, the gate's output is incorrect.

    I even went as far as trying to swap all the combinations of bad gates to fix the circuit completely (although this is not required for the solution, where we only need to identify the bad gate, not how to swap the outputs to fix the circuit).

    github.com/nharrer/AdventOfCod

    #AdventOfCode
    #AdventOfCode2024
    #AoC

  8. CW: Spoiler for AdventOfCode 2024 / 24

    I had a little time today to revisit part 2, which I had previously only solved by hand by visually analyzing the graph of gates.

    I can now solve this in code by classifying the gates into layers:

    Layer 1: XOR and AND gates connected to the inputs
    Layer 2: AND gates not in Layer 1
    Layer 3: OR gates
    Layer 4: XOR gates not in Layer 1

    Each gate in the layers must be followed by a defined set of gates:

    Layer 1 XOR: needs to be followed by a Layer 2 AND and a Layer 4 XOR
    Layer 1 AND: needs to be followed by a Layer 3 OR
    Layer 2 AND: needs to be followed by a Layer 3 OR
    Layer 3 OR: needs to be followed by a Layer 2 AND and a Layer 4 XOR
    Layer 4 XOR: must output z

    Considering edge cases in the first and last rows, if any of these rules are violated, the gate's output is incorrect.

    I even went as far as trying to swap all the combinations of bad gates to fix the circuit completely (although this is not required for the solution, where we only need to identify the bad gate, not how to swap the outputs to fix the circuit).

    github.com/nharrer/AdventOfCod

    #AdventOfCode
    #AdventOfCode2024
    #AoC

  9. I'm late today because of some Christmas travel but it was super easy (save for a dumb parsing bug that sent me in circles for a while) so I was able to get it done before the end of the day. Between that and yesterday going back and doing the Part 2s I'd skipped, I’ve completed my #AdventOfCode2024 calendar.

    This year had some really gnarly puzzles. :-D I’m looking forward to next year.

    #AdventOfCode

  10. I'm late today because of some Christmas travel but it was super easy (save for a dumb parsing bug that sent me in circles for a while) so I was able to get it done before the end of the day. Between that and yesterday going back and doing the Part 2s I'd skipped, I’ve completed my #AdventOfCode2024 calendar.

    This year had some really gnarly puzzles. :-D I’m looking forward to next year.

    #AdventOfCode

  11. In honor of the last day of #AdventOfCode this year, I want to share something I've been working on since Day 12: The Drakaina!

    It's a single line of #Python that solves the challenges of #AdventOfCode2024. I've gotten up to Day 11. Read at your own risk.

    github.com/WinslowJosiah/adven

    #coding #programming

  12. In honor of the last day of #AdventOfCode this year, I want to share something I've been working on since Day 12: The Drakaina!

    It's a single line of #Python that solves the challenges of #AdventOfCode2024. I've gotten up to Day 11. Read at your own risk.

    github.com/WinslowJosiah/adven

    #coding #programming

  13. I'll revisit this later to figure out how to solve part 2 with code, but not right now. Now, it's time to enjoy Christmas with the family.

    #AdventOfCode #AdventOfCode2024 #AoC

  14. I'll revisit this later to figure out how to solve part 2 with code, but not right now. Now, it's time to enjoy Christmas with the family.

    #AdventOfCode #AdventOfCode2024 #AoC

  15. I am enjoying the final #AdventOfCode ASCII animation. How beautiful! Have to check out the Easter eggs now...

    #AdventOfCode2024
    #AoC

  16. I am enjoying the final #AdventOfCode ASCII animation. How beautiful! Have to check out the Easter eggs now...

    #AdventOfCode2024
    #AoC

  17. #AdventOfCode Day 25: Code Chronicle

    It’s finally done! I’m so happy!!!

    This is the first year I’ve been able to finish all the stars without needing hints or extra help - and actually made it in time!

    I’m still pretty slow, though. Some puzzles took me the entire day (or night, like yesterday and Day 17!). But it’s such a rewarding feeling to have made it all the way through.

    A high five to all my fellow Mastodonians
    @jeff @andrewhoyer
    @movq @whereistanya @winslowjosiah
    @oloturia
    @papajohn
    @sol_hsa
    @kewliomzx
    @jochie @mina and many more, who played (and sometimes suffered) along with me. You all made this so much more fun! ✨

    And, of course, an enormous thank you to @ericwastl and all the wonderful helpers who made this event possible. I can’t wait for next year! 🤩💫

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/25

    #AdventOfCode2024 #AoC

  18. #AdventOfCode Day 25: Code Chronicle

    It’s finally done! I’m so happy!!!

    This is the first year I’ve been able to finish all the stars without needing hints or extra help - and actually made it in time!

    I’m still pretty slow, though. Some puzzles took me the entire day (or night, like yesterday and Day 17!). But it’s such a rewarding feeling to have made it all the way through.

    A high five to all my fellow Mastodonians
    @jeff @andrewhoyer
    @movq @whereistanya @winslowjosiah
    @oloturia
    @papajohn
    @sol_hsa
    @kewliomzx
    @jochie @mina and many more, who played (and sometimes suffered) along with me. You all made this so much more fun! ✨

    And, of course, an enormous thank you to @ericwastl and all the wonderful helpers who made this event possible. I can’t wait for next year! 🤩💫

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/25

    #AdventOfCode2024 #AoC

  19. #AdventOfCode Day 24: Crossed Wires

    Oh boy. I did part 2 by hand. Exported the graph as a GraphML file, and imported it into Cytoscape. Arranging the gates was quite some work. Then it was obvious which gate outputs needed to be switched. Still, it took me all night. It's 5:30 in the morning. Time to go to bed.

    I could stay up. The last puzzle is already released in half an hour, but I am exhausted. Nah, I’ll get a couple of hours of sleep first. 😴

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/24

    #AdventOfCode2024 #AoC

  20. #AdventOfCode Day 24: Crossed Wires

    Oh boy. I did part 2 by hand. Exported the graph as a GraphML file, and imported it into Cytoscape. Arranging the gates was quite some work. Then it was obvious which gate outputs needed to be switched. Still, it took me all night. It's 5:30 in the morning. Time to go to bed.

    I could stay up. The last puzzle is already released in half an hour, but I am exhausted. Nah, I’ll get a couple of hours of sleep first. 😴

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/24

    #AdventOfCode2024 #AoC

  21. Like many people, I solved #AdventOfCode 2024 Day 24 Part 2 not with code, but by hand. It'd actually be pretty difficult to write code for...but I'll eventually get it done.

    In the meantime, here's my code for Part 1, before cleanup and comments.

    #python #programming #coding #AdventOfCode2024

  22. Like many people, I solved #AdventOfCode 2024 Day 24 Part 2 not with code, but by hand. It'd actually be pretty difficult to write code for...but I'll eventually get it done.

    In the meantime, here's my code for Part 1, before cleanup and comments.

    #python #programming #coding #AdventOfCode2024

  23. CW: Advent of Code 2024 Day 24 Spoilers

    Part 2 took me an embarrassingly long time to figure out. At first I thought I could randomly try a bunch of additions, see which wires outputs were wrong, get all of their inputs, and then take the intersection of all the wrong inputs and that would be the answer. But that didn't work.

    Finally, I attacked it by figuring out what a binary adder should look like, as a circuit, and then finding where the circuit we had was malformed. It took a lot of trial and error before I got a reasonable looking solution, and the first time I did it was right, so I don't know if I am lucky or actually have a principled approach, but I'm sticking with it.

    Total runtime for both about 40ms.

    #AdventOfCode2024 #AdventOfCode #Python

  24. CW: Advent of Code 2024 Day 24 Spoilers

    Part 2 took me an embarrassingly long time to figure out. At first I thought I could randomly try a bunch of additions, see which wires outputs were wrong, get all of their inputs, and then take the intersection of all the wrong inputs and that would be the answer. But that didn't work.

    Finally, I attacked it by figuring out what a binary adder should look like, as a circuit, and then finding where the circuit we had was malformed. It took a lot of trial and error before I got a reasonable looking solution, and the first time I did it was right, so I don't know if I am lucky or actually have a principled approach, but I'm sticking with it.

    Total runtime for both about 40ms.

    #AdventOfCode2024 #AdventOfCode #Python

  25. CW: Advent of Code 2024 Day 24 Spoilers

    Ah, the last full day of #AdventOfCode2024, Day 24, wasn't too bad. The first part was very similar to 2015 Day 7, which is is one of my all-time favorite AoC puzzles, but the second part was ... not.

    Part 1 can be solved recursively with memoization. Since ultimately each output ("z") value must depend on a known input value ("x" or “y”), you can recursively resolve the operands, using memoization to make sure you only calculate each operand once.

    #AdventOfCode #Python

  26. CW: Advent of Code 2024 Day 24 Spoilers

    Ah, the last full day of #AdventOfCode2024, Day 24, wasn't too bad. The first part was very similar to 2015 Day 7, which is is one of my all-time favorite AoC puzzles, but the second part was ... not.

    Part 1 can be solved recursively with memoization. Since ultimately each output ("z") value must depend on a known input value ("x" or “y”), you can recursively resolve the operands, using memoization to make sure you only calculate each operand once.

    #AdventOfCode #Python

  27. CW: Advent of Code 2024 Day 23 Spoilers

    And I just realized that all of the duplicates in Part 1 were being caused by 3-node cliques that contain multiple nodes that start with “t”, so just filtering those out directly would save a lot of effort. The code (in the screenshot, and updated in Github) runs even faster now.

    #AdventOfCode2024 #AdventOfCode #Python

  28. CW: Advent of Code 2024 Day 23 Spoilers

    And I just realized that all of the duplicates in Part 1 were being caused by 3-node cliques that contain multiple nodes that start with “t”, so just filtering those out directly would save a lot of effort. The code (in the screenshot, and updated in Github) runs even faster now.

    #AdventOfCode2024 #AdventOfCode #Python

  29. CW: Advent of Code 2024 Day 23 Spoilers

    For Part 2, I knew enough about graphs to know that what we were looking for was called a clique, so it was a quick Google search to find the Bron-Kerbosch algorithm for finding cliques in a graph (en.wikipedia.org/wiki/Bron%E2%), and then it was just a matter of taking the largest and formatting it the way that the answer required it to be.

    All-in-all a fun day, and I learned a new algorithm!

    #AdventOfCode2024 #AdventOfCode #Python

  30. CW: Advent of Code 2024 Day 23 Spoilers

    For Part 2, I knew enough about graphs to know that what we were looking for was called a clique, so it was a quick Google search to find the Bron-Kerbosch algorithm for finding cliques in a graph (en.wikipedia.org/wiki/Bron%E2%), and then it was just a matter of taking the largest and formatting it the way that the answer required it to be.

    All-in-all a fun day, and I learned a new algorithm!

    #AdventOfCode2024 #AdventOfCode #Python

  31. CW: Advent of Code 2024 Day 23 Spoilers

    Phew! After a couple of rough days that I mostly skipped as I had a busy weekend, #AdventOfCode2024 Day 23 was pretty fun (though ymmv, but I like graph problems a lot).

    Initially I was going to brute force Part 1, just using itertools.combinations to examine all three-node combinations to find interconnected ones that had at least one member that started with ’t’, but that ended up being too many, so instead I started with all of the ’t’ nodes, then searched through all the two-node combinations of its neighbors, storing every unique three-node combination I found, which was quite fast to complete.

    github.com/biesnecker/aoc-anyh

    #AdventOfCode #Python

  32. CW: Advent of Code 2024 Day 23 Spoilers

    Phew! After a couple of rough days that I mostly skipped as I had a busy weekend, #AdventOfCode2024 Day 23 was pretty fun (though ymmv, but I like graph problems a lot).

    Initially I was going to brute force Part 1, just using itertools.combinations to examine all three-node combinations to find interconnected ones that had at least one member that started with ’t’, but that ended up being too many, so instead I started with all of the ’t’ nodes, then searched through all the two-node combinations of its neighbors, storing every unique three-node combination I found, which was quite fast to complete.

    github.com/biesnecker/aoc-anyh

    #AdventOfCode #Python

  33. I just completed "Mull It Over" - Day 3 - Advent of Code 2024

    I'll try to do my best in order to complete all puzzles before next year... Wish me luck 🍀

    See my :ruby: solution at github.com/cdalvaro/advent-of-

  34. I just completed "Mull It Over" - Day 3 - Advent of Code 2024 #AdventOfCode

    I'll try to do my best in order to complete all puzzles before next year... Wish me luck 🍀

    See my :ruby: #Ruby solution at github.com/cdalvaro/advent-of-

    #AdventOfCode2024 #Programming #Coding #LiveCoding

  35. #AdventOfCode Day 23: LAN Party

    I love LAN parties (do kids still do that nowadays?). I used the petgraph crate in Rust to build the data structure, but didn't use any of its algorithms. I got by using some sets.

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/23

    #AdventOfCode2024 #AoC

  36. #AdventOfCode Day 23: LAN Party

    I love LAN parties (do kids still do that nowadays?). I used the petgraph crate in Rust to build the data structure, but didn't use any of its algorithms. I got by using some sets.

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/23

    #AdventOfCode2024 #AoC

  37. CW: Advent of code

    I wonder whether anyone of my followers has solved the second star of day 14 of #AdventOfCode2024. It's formulated in such an indefinite way, it's not my cup of tea.
    Anyways, I took this year's problems as an opportunity to improve my Kotlin skills (apart from async programming, and with a bonus linear algebra recap), and I'm glad I did, but now it's taking too much of my time (my ToDo list is just too long). Thanks #AdventOfCode, see you next year.

  38. CW: Advent of code

    I wonder whether anyone of my followers has solved the second star of day 14 of #AdventOfCode2024. It's formulated in such an indefinite way, it's not my cup of tea.
    Anyways, I took this year's problems as an opportunity to improve my Kotlin skills (apart from async programming, and with a bonus linear algebra recap), and I'm glad I did, but now it's taking too much of my time (my ToDo list is just too long). Thanks #AdventOfCode, see you next year.

  39. Tag drei und vier sind auch vollständig gelöst, aber mit dem pünktlichen Fertigwerden bis zum 24.12 wird es wohl eher nichts 🤣.

    #AdventOfCode #AdventofCode2024

  40. A bit disappointed that people don't seem to widely recognise the xorshift prng nowadays...
    #AdventOfCode2024

  41. #AdventOfCode Day 22: Monkey Market

    Today was one of those times when I had no idea at first how to approach part 2, so I just started coding. The solution gradually emerged along the way.
    It was also one of those situations again where you initially think, 'That's impossible,' but when you're done, it feels like it couldn't be easier. 😉

    I’m not sure if I did the second part a bit too brute-forceish, but it finishes in 250ms in Rust, so that's fine for me.

    BTW: none of the special cases in mix and prune ever happened. I wonder what that was all about.

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/22

    #AdventOfCode2024 #AoC

  42. #AdventOfCode Day 22: Monkey Market

    Today was one of those times when I had no idea at first how to approach part 2, so I just started coding. The solution gradually emerged along the way.
    It was also one of those situations again where you initially think, 'That's impossible,' but when you're done, it feels like it couldn't be easier. 😉

    I’m not sure if I did the second part a bit too brute-forceish, but it finishes in 250ms in Rust, so that's fine for me.

    BTW: none of the special cases in mix and prune ever happened. I wonder what that was all about.

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/22

    #AdventOfCode2024 #AoC

  43. CW: Spoiler Day 21 / 2024

    As with other puzzles we had already this year, we only need the length of shortest key sequence and not the sequence itself.

    #AdventOfCode
    #AdventOfCode2024
    #AoC

  44. CW: Spoiler Day 21 / 2024

    As with other puzzles we had already this year, we only need the length of shortest key sequence and not the sequence itself.

    #AdventOfCode
    #AdventOfCode2024
    #AoC

  45. #AdventOfCode Day 21: Keypad Conundrum

    I went to a Christkindlmarkt market with the family today, and later we enjoyed a movie night together.

    So I didn’t get to AoC until late; it's already past 1 in the morning as I’m writing this.

    It went well overall. Both parts finish in under 1ms. Memoization saved the day. There were a couple small details that slowed me down a bit. Used recursions a lot.

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/21

    #AdventOfCode2024 #AoC

  46. #AdventOfCode Day 21: Keypad Conundrum

    I went to a Christkindlmarkt market with the family today, and later we enjoyed a movie night together.

    So I didn’t get to AoC until late; it's already past 1 in the morning as I’m writing this.

    It went well overall. Both parts finish in under 1ms. Memoization saved the day. There were a couple small details that slowed me down a bit. Used recursions a lot.

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/21

    #AdventOfCode2024 #AoC

  47. CW: Advent of Code 2024 Day 21

    I seem to have been the only person who just sat down, thought about what the easiest sequences must be (in terms of "left" being harder than "right" because it's further from the "A"), handwrote a lookup table and then got pt1 perfect, and pt2 off by just one logic error true/false conditions (ironically, in the bit of the lookup table I wrote some code to generate because I was bored of typing).
    Sometimes you don't need to throw a DFS at everything!
    #AdventOfCode2024

  48. CW: Spoiler for AdventOfCode 2024 / 20

    If you look at the maze, you'll see there is only one path, so no pathfinding is needed. Just begin at the start, check which of the four neighbors is another part of the race track, and repeat.

    Imagine the path like a string of pearls, like an array (or list/vector) of positions on the race track. The index of the array serves as a metric for the distance. So, if you subtract the indices of two positions in the array, you get the distance between those two points along the race track.

    Now, determine for each position all other possible positions where the Manhattan distance is between 2 and 20. Calculate the distance by subtracting their indices in the array. Ignore all cheats where the distance is negative (jumps back) or where the distance of the cheat is not smaller than the distance along the race track.

    #AdventOfCode
    #AdventOfCode2024
    #AoC

  49. #AdventOfCode Day 20: Race Condition

    I had a busy day today and wasn’t able to work on the puzzle in the morning. However, I read the puzzle description during breakfast and thought about it throughout the day, and had a solid plan by the time I got home.

    It turned out to be quite practical and even adaptable for part 2. The first version took 25 seconds, but I was able to tweak it down to about 100ms.

    It was one of those puzzles I enjoy, where you don’t need to know fancy algorithms - just some thinking and coding skills. Since yesterday and today felt relatively easy, I’m worried a hard one might be coming up.

    #Rust code is here:
    github.com/nharrer/AdventOfCod

    Puzzle:
    adventofcode.com/2024/day/20

    #AdventOfCode2024 #AoC

  50. CW: Advent of Code 2024 Day 20 Spoilers

    Day 20 was definitely the hardest day of #AdventOfCode2024 I've done so far, but also one of the most enjoyable. Went through a couple of different approaches before I settled on one that worked.

    Both parts are basically the same. First, I calculate the shortest path from the destination square to every other square. This gives me the path for the "fair" race, without any cheats, and also the distance from every square to the destination (if there's a path).

    Then, for each step along the "fair" path, I search for any square in within 2 (for Part 1) or 20 (for Part 2) steps of the current square, and if the cost to get to the destination from that square is 100 or more steps less than the number of steps I've taken so far plus the number of steps to get to that square, then it's a valid shortcut and I count it.

    github.com/biesnecker/aoc-anyh

    #python #AdventOfCode

  51. I think I am officially not clever enough to come up with a solution for today's Part 2 that isn't essentially exponential in the length of the stripe pattern in question.

    #AdventOfCode #adventofcode2024

  52. CW: Advent of Code 2024 Day 19 Spoilers

    I realized after posting that looking through all of the possible towels was wasteful, and could be better by putting the towels into a dictionary indexed by the towels first letter, and then only looking through the towels that begin with the same first letter as the pattern fragment. This halved the runtime on my machine, from ~150ms to about ~75ms.

    This screenshot shows the input handling and the updated `possible` function.

    #AdventOfCode #AdventOfCode2024 #Python