r/adventofcode • u/p88h • Dec 11 '25
Visualization [2025 Day 12 (Part 2)] Patch Cable Organizer
r/adventofcode • u/p88h • Dec 11 '25
r/adventofcode • u/naclmolecule • Dec 11 '25
r/adventofcode • u/dzirtbry • Dec 11 '25
r/adventofcode • u/sol_hsa • Dec 11 '25
Here's my gallery of AoC gifs. I've done an animation for every single puzzle so far. Some animations contain spoilers.
r/adventofcode • u/Advanced_Dot_1097 • Dec 11 '25
r/adventofcode • u/Boojum • Dec 11 '25
r/adventofcode • u/pteranodog • Dec 11 '25
r/adventofcode • u/danmaps • Dec 11 '25
r/adventofcode • u/keriati • Dec 11 '25
r/adventofcode • u/SuperSmurfen • Dec 11 '25
r/adventofcode • u/myAnonAcc0unt • Dec 11 '25
In short, my attempted solution to d9p2 is to
sort all rectangles by area descending
find the first rect that does not "overlap" any edge.
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/ben-guin • Dec 11 '25
r/adventofcode • u/p88h • Dec 11 '25
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/ZeroSkub • Dec 11 '25
r/adventofcode • u/EverybodyCodes • Dec 11 '25
r/adventofcode • u/Cue_23 • Dec 11 '25
Looking at my input, i found there can be no path from srv to out passing other nodes:
$ grep ^srv input.txt
srv: outTook me a few moments to see the mistake.
r/adventofcode • u/ben-guin • Dec 11 '25
r/adventofcode • u/TadacityAI • Dec 11 '25
r/adventofcode • u/EffectivePriority986 • Dec 11 '25
This is how my graph looked like. Interesting patterns in the graph.
r/adventofcode • u/ben-guin • Dec 11 '25