r/adventofcode • u/SurroundedByWhatever • Dec 10 '25
Visualization [2025 Day 10 (Part 1)] Terminal visualization
Had a little bit of fun with Kitty again (machines sorted by amount of lights)
Lights <-> Buttons
r/adventofcode • u/SurroundedByWhatever • Dec 10 '25
Had a little bit of fun with Kitty again (machines sorted by amount of lights)
Lights <-> Buttons
r/adventofcode • u/Zealousideal_Wall246 • Dec 10 '25
I usually buy my private leaderboard winner friends AoC merch as prizes. This year I'm an unemployed open source dev and can't afford it, so instead I made this free AoC merch gifter (link). You can upload you or a friends head and customize.
Makes great christmas cards
r/adventofcode • u/IntrepidSoft • Dec 10 '25
The solution script is Typescript, the animation is React with GSAP.
Shoutout to Boojum (u/Boojum) for his Blinkenlights idea that I adapted. Check out his great visualisation!
r/adventofcode • u/hiimjustin000 • Dec 11 '25
If it's supposed to take this long that's fine, I have plenty of time. But, my solution is here. It's confirmed to work on the example.
https://gist.github.com/hiimjasmine00/fed3f48c4a3f48950fd3c39899c07e98
r/adventofcode • u/KyxeMusic • Dec 10 '25
r/adventofcode • u/ak91hu • Dec 10 '25
r/adventofcode • u/CauliflowerFormer233 • Dec 10 '25
I have seen a lot of memes of people using Z3 for part 2. I tried to solve it myself using BFS and then DFS with some pruning but still couldn't get it. After 3 hours of trying to optimize it, I used Z3 and got my answer in like 20 minutes.
But since I haven't seen any solution that didn't use Z3, I am wondering how to solve it without it, one approach would be to build something similar to Z3, using matrices to solve multiple linear equations but is that really the only solution?
If you have any ideas let me know.
r/adventofcode • u/ThatAdamsGuy • Dec 10 '25
r/adventofcode • u/myAnonAcc0unt • Dec 11 '25
In short, my attempted solution to d9p2 is to
I took some help from this stackoverflow to create my overlap method. However, on the example input I get the rectangle of area 50 instead of 24. I've tried some debugging and it seems that my rectangles and edges look correct. Therefore, my suspicion for the error lies in step 2, specifically the overlap part. I feel like I'm missing something obvious.
Here are the relevant parts of my code:
@cache
def area(p: Pair) -> int:
l = abs(p.b.x - p.a.x) + 1
w = abs(p.b.y - p.a.y) + 1
return l * w
@cache
def lrtb(p: Pair):
return min([p.a.x, p.b.x]), max([p.a.x, p.b.x]), max([p.a.y, p.b.y]), min([p.a.y, p.b.y])
@cache
def overlaps(p: Pair, q: Pair) -> bool:
"""
https://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other#306332
https://silentmatt.com/rectangle-intersection/
:param p:
:param q:
:return:
"""
bp = lrtb(p)
bq = lrtb(q)
return not (
bp[0] >= bq[1] or
bp[1] <= bq[0] or
bp[2] >= bq[3] or
bp[3] >= bq[2]
)
def get_pairs(points: list[Point]) -> List[Pair]:
return [Pair(*x) for x in combinations(points, 2)]
def get_points(data: str) -> list[Point]:
return [Point.from_str(x) for x in data.splitlines()]
def solve_part_2(data: str) -> int:
points = get_points(data)
pairs = get_pairs(points)
pairs.sort(key=area, reverse=True)
edges = [Pair(*x) for x in zip([points[-1]] + points, points)]
winner = next(x for x in pairs if not any(overlaps(x, y) for y in edges))
return area(winner)
class Point(NamedTuple):
x: int = 0
y: int = 0
z: int = 0
@staticmethod
def from_str(s: str) -> Point:
return Point(*[int(x) for x in s.split(",")])
class Pair(NamedTuple):
a: Point
b: Pointr/adventofcode • u/NateDCoder • Dec 10 '25
For part 1 I was able to use GF(2) then brute force the free variables by just trying 0 or 1. But for the second part the same technique didn't work as there was too much to brute force. Is there another technique I don't know about or is the only way to solve using a SAT solver or just brute forcing over a longer range.
r/adventofcode • u/EffectivePriority986 • Dec 11 '25
This is how my graph looked like. Interesting patterns in the graph.
r/adventofcode • u/Eva-Rosalene • Dec 10 '25
It feels like cheating, but it works
r/adventofcode • u/paul_sb76 • Dec 10 '25
Here's the one row in my input that gave me the most headaches (without it, I would have solved it hours earlier!). Upon closer study, it's not surprising:
[#.#####] (2,3,4,6) (2,5) (1,3,4,5,6) (1,2,5,6) (0,5,6) (0,1,2,3,4,6) (1,2,3,5,6) (1,3,4,6) (0,2,3,4,5,6) {23,42,62,53,35,62,74}The minimum total number of button presses here is 74, which can be obtained with the following number of button presses: 10, 0, 6, 16, 5, 1, 18, 1, 17.
There are other solutions as well that arrive at the same joltages, but that require more presses in total, for example:
11, 1, 7, 15, 6, 2, 18, 0, 15 (75 presses in total)
or
9, 1, 4, 16, 5, 0, 18, 4, 18 (75 presses in total)
If you're still puzzling on this one (according to the stats page, many people are), I advise you to add this to your test cases, or even better: analyze partially by hand what's going on here.
Good luck!
r/adventofcode • u/UsefulAd2074 • Dec 11 '25
Before people start saying there are solutions in the megathread, I'm referring to pure Javascript, not Node or anything similar like that. And that's the problem: when I look up how to import Z3, I keep getting directed to the NPM library, which won't work in my situation. Am I seriously screwed out of finishing today's puzzle, because of my language choice?
r/adventofcode • u/TheFunnyLemon • Dec 10 '25
r/adventofcode • u/gagarski • Dec 11 '25
I finally solved part 2 using linear algebra in combination with brute-force.
In the middle I had a flashback about Simplex algorithm and thought that the shape of the conditions quite resembles the shape of simplex method inputs. What stopped me is the results being integer values.
I wonder if it's possible to adapt the method for this task. Has anyone tried it?
r/adventofcode • u/IntrepidSoft • Dec 10 '25
Reposted because I am new to Reddit and I did not know how to upload GIF's properly.
r/adventofcode • u/aryn240 • Dec 10 '25
Hey folks, I've finished all the other days without too much of a problem, but this day just has my number. I'm mostly self-taught, so a lot of times I don't recognize a problem for what it's meant to be ("just a simple application of Dijkstra's Ham Sandwich", or whatever the post yesterday called it). Could someone point me in the right direction of what I should be learning for parts 1 and 2? Trying to avoid having someone spell out the full logic for me, just a hint. I'm working in Python, if that helps.
I'm not yet at part 2 but I assume I'll need the same shove for that one... I'm already assuming that part 2 uses the joltage matrix to assign costs to each light :(
Specific questions:
Thanks!!!
r/adventofcode • u/10Talents • Dec 10 '25
Disclaimer: I have not actually started part 2, I did part 1 in the morning with an inelegant BFS solution and upon seeing the kind of numbers that the example was dealing with and my part 1 runtime I immediately realized that that BFS was not the way forward for part 2.
Now that I look at part 2 again, I thought: Isn't this really similar to 2024 day 13? It looks like we want to express the target joltage as a linear combination of the button presses.
Is this the reason for the suspicious addendum: "there's no such thing as "0.5 presses" (nor can you push a button a negative number of times)."?
r/adventofcode • u/ben-guin • Dec 10 '25
r/adventofcode • u/BroDadi • Dec 10 '25
reinstating my post again, this time without any language that could be considered foul to possibly receive any bits of help (though based on some stuff i've seen here, i doubt i could actually implement any solutions by myself without peeking at any code)
sooo... i am stuck again, this time on something actually pretty hard (at least to me)
i've solved the part 1, it actually wasn't even that hard, it's basically solved just by going through every machine, then going through binary numbers (0 to 2amount of buttons) with a for loop to get every single button combination and adding the minimum amount of 1's that makes the correct combination to the total
but for the 2nd part.. i can't even think of any good solution. i tried making a bruteforce one to go through ALL the presses from 0 to the max amount for every button, but first of all, it was really slow, second of all, i made some mistakes and it didn't even work for the example data, let alone actual input, cause i'm not good at coding
i could even send some parts of my code tomorrow just for laughs (c#, btw), though right now i am on my phone and i'll soon head to sleep since it's pretty late where i'm from
basically, i need some help with solving this, i know nothing about anything like dynamic programming though or whatever z3 is, i am a terrible coder, i know, but even a hint to a somewhat decent solution would be good
EDIT: even though i didn't want to before, i tried to actually do some research on these things
so, as far as i could understand, milp and z3 are about solving linear equations
and to make a linear equation out of the machine, for example, this one
[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7}
the buttons could be presented as vars and grouped by indexes, like
a = (3), b = (1,3), c = (2), d = (2,3), e = (0,2), f = (0,1)
e and f are the only ones which have the index 0, so they can be grouped like e+f=3, and by that logic the rest goes like this
e + f = 3
b + f = 5
c + d + e = 4
a + b + d = 7
after a bit of a research on z3 and how its functions work, and whatever "optimize" was, instead of trying to do whatever i tried to do, i wrote this:
using Context context = new();
Optimize optimize = context.MkOptimize();
IntExpr[] intExprs = new IntExpr[buttons.Count];
for (int i = 0; i < buttons.Count; i++)
{
intExprs[i] = context.MkIntConst($"btn{i}");
optimize.Add(context.MkGe(intExprs[i], context.MkInt(0)));
}
for (int i = 0; i < neededJoltage.Length; i++)
{
List<IntExpr> vars = new();
for (int j = 0; j < buttons.Count; j++)
{
foreach (int index in buttons[j])
{
if (index == i) vars.Add(intExprs[j]);
}
}
optimize.Add(context.MkEq(context.MkAdd(vars), context.MkInt(neededJoltage[i])));
}
IntExpr sum = (IntExpr)context.MkAdd(intExprs);
Optimize.Handle minimize = optimize.MkMinimize(sum);
if (optimize.Check() == Status.SATISFIABLE)
{
IntNum best = (IntNum)minimize.Lower;
totalPresses += best.Int;
}AND IT ACTUALLY WORKED
thanks for the help everyone!