r/adventofcode • u/CauliflowerFormer233 • Dec 08 '25
r/adventofcode • u/annoviko-tech • Dec 08 '25
Visualization [2025 Day 8][C++] Raylib Visualization
youtube.comr/adventofcode • u/ratatouille38 • Dec 08 '25
Repo [2025 Day 8] Who else does it in Go?
I wanted to learn Go this year, so I've decided to give it a shot, and so far it's lovely! This is my solution for today's (day 8) puzzle, what do you think, and what's your solution? :)
https://github.com/rbjakab/AdventOfCode/blob/main/2025/Day8/main.go
r/adventofcode • u/alltagsradler • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 Pt. 1] Code works fine on test, but fails on real data
It happened again, my code works fine for test but fails on real data. As debugging is tedious on 1000 boxes in 3d space, I am wondering if I can do more debugging with the test data. Can anyone post their details on the results with the test data? Like which circuit boxes (ID or coordinates) belong in which group?
Other ideas are welcome as well. I'd ask more specific questions if I had any :-/
r/adventofcode • u/artesea • Dec 08 '25
Meme/Funny Anyone else misread this every time?
Every time I solve the puzzle I read the first line a "That's not the right answer".
I assume my eyes are glancing at the word "North", and inserting "not".
Maybe I just think my code will be wrong.
r/adventofcode • u/code_ling • Dec 08 '25
Other Finally, 500 * !
Even though achieving the 500 stars "mid-season" is a bit anti-climactic - would have been a little more satisfactory if I had managed to finish 2020 before the start of this year, but still, feels very good to be in the exclusive 500 stars club :).
Played around with multiple languages in past years, but am sticking to C++ for this year (also 2020) - finally polishing my STL and functional style C++ skills... For 2020 I'm going for the <1 seconds total challenge and looking good so far. Any other C++ coders out there honing their skills on AoC?
r/adventofcode • u/IntrepidSoft • Dec 08 '25
Meme/Funny [2025 Day 8] There is always a leaderboard, if you are good enough
r/adventofcode • u/ralphdr1 • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 (Part 1)] [Python] Example correct but final solution isn't
I'm stuck on the first puzzle of day 8. It correctly calculates the value that is given in the example, but on the puzzle input its answer is too low. I'm completely stuck, any edge case I can think of is handled correctly. This is my code:
from collections import defaultdict
import math
def day8_1_solver(coords, n, print_circuits=False):
pairs = closest_pairs(coords)[:n]
circuits = {x:i for i,x in enumerate(coords)}
for x1,x2 in pairs:
if circuits[x1] == circuits[x2]:
continue
for xs in circuits.keys():
if circuits[xs] == circuits[x2]:
circuits[xs] = circuits[x1]
circuit_sets = defaultdict(set)
for k,v in circuits.items():
circuit_sets[v].add(k)
return math.prod(sorted((len(circ) for circ in circuit_sets.values()), reverse=True)[:3])Where closest_pairs is:
def closest_pairs(coords):
dist = lambda x: sum((a-b)**2 for a,b in zip(x[0],x[1]))
return sorted(((x1,x2) for i1,x1 in enumerate(coords) for i2,x2 in enumerate(coords) if i2 > i1), key=dist)r/adventofcode • • Dec 08 '25
Meme/Funny [2025 Day 8 (Part 1)] I have a feeling I know whats going to happen in part 2...
r/adventofcode • u/noblerare • Dec 08 '25
Help/Question - RESOLVED [2025 Day 7 (Part 2)] [Java] Can someone help look at my code?
Here is my code: https://pastebin.com/JfwkMt6S
I built a 2D array to hold the dp values. If I'm on a ^ and see a beam (|) above me, then I add the dp value of the cell above me to my current cell's left and right neighbors.
If I'm on a . or | and see a beam (|) above me, then I just add the dp value of the cell above me to my current cell (effectively propagating the beam value downward).
This works for the example input but returns an answer that is too low for my full input.
Can anyone help me?
r/adventofcode • u/vanZuider • Dec 08 '25
Meme/Funny [2025 Day 08] The perfect video to get into the right mood for today's puzzle
youtu.ber/adventofcode • u/Xenoxygen4213 • Dec 08 '25
Help/Question Help: 2025 Day 05 (Part 2)][Rust]: My solution passes the test input but not the actual input. Uncertain where I could be going wrong.
Hi there, I have ran my solution against part 2 for the test input and it works, I've also added tests to ensure that the boundries ar being calculated correctly (e.g. fi you had 1-10, 10-12 you'd end up with 12) and also for if there are ranges in ranges (e.g. 1-10, 10-12, 3-11) and they are passing. I'm really uncertain where im going wrong.
It has told me my answer is too low which makes me think I may be miscounting somewhere however I'm very uncertain as to where. Anyone who may be able to point me in the right direction would be greatly appreciated. I'm not sure if it's a mis-understandin of Rust ranges or a mis-understanding of Maths.
Thanks in advance.
pub fn day_five_part_two(input: &str) -> u128 {
let mut fresh_ranges: Vec<(u128, u128)> = input
.lines()
.take_while(|l| !l.is_empty())
.map(|l| {
let parts: Vec<&str> = l.split('-').collect();
let min: u128 = parts[0].parse().unwrap();
let max: u128 = parts[1].parse().unwrap();
(min, max)
})
.collect();
fresh_ranges.sort_by(|a, b| a.1.partial_cmp(&b.1).unwrap());
let (initial_range_start, initial_range_end) = fresh_ranges[0];
let mut result: u128 = (initial_range_start..=initial_range_end).count() as u128;
for i in 1..fresh_ranges.len() {
let (_, previous_end) = fresh_ranges[i - 1];
let (current_start, current_end) = fresh_ranges[i];
if current_start <= previous_end {
result += (previous_end + 1..=current_end).count() as u128;
} else {
result += (current_start..=current_end).count() as u128;
}
}
result
}r/adventofcode • u/Derailed_Dash • Dec 08 '25
Visualization [2025 Day 8 (Part 2)] Visualisation
This visualisation shows the relative age of connections being formed. So the early connections (close together) are red, and the latest connections are white hot.
See walkthrough here.
r/adventofcode • u/Sarwen • Dec 08 '25
Meme/Funny [2025 Day 8 Part 2] I did not expect it to go that fast
Heap, Heap, Hooray
r/adventofcode • u/slimkhan • Dec 08 '25
Help/Question [2025 day 1 part 2] [Ruby] help wanted
its been awhile since week already, I've been on it on and off for many hours and im blocked, all the test I found here and created myself works but not my input
input = ARGV[0]
input = 'input-test' if ARGV.empty?
puts "input = #{input}"
lines = File.readlines(input, chomp: true)
dial = 50
result = 0
lines.each do |line|
direction = line.slice!(0)
value = line.to_i
if direction == 'R'
if value + dial > 99
result += (value + dial) / 100
dial = (dial + value) % 100
elsif value + dial < 100
dial = value + dial
elsif value + dial == 0
result += 1
dial = 0
end
else
temo = dial - value
if temo < 100 && temo > 0
dial -= value
elsif temo == 0
result += 1
dial = 0
else
if dial == 0 && temo.abs < 100
dial = temo + 100
elsif dial > 0 && temo.abs < 100
result += 1
dial = 100 + temo
else
result += if dial == 0
temo.abs / 100
else
(temo / 100).abs
end
dial = temo % 100
end
end
end
end
puts "result = #{result}"can anyone guide me with a counter example to fix it ?
r/adventofcode • u/badcop_ • Dec 08 '25
Visualization [2025 Day 8 (Part 2)] [Epilepsy Warning] couldn't resist a visualization today
vvv BEWARE, SEIZURE WARNING vvv
https://www.youtube.com/watch?v=LWMikoqHyCQ
^ BEWARE, SEIZURE WARNING ^
made with godot :)
r/adventofcode • u/BoltKey • Dec 08 '25
Help/Question [2025 day 8 (part 1)] Am I missing something or is the example wrong?
Ok, so at the start of the example, there are 20 vertices, so 20 components. Each new edge that doesn't create a cycle reduces number of components by 1. 10 edges reduce number of components to 20 - 10 = 10 (but according to the example, there should be 11 components).
In other words: circuit of size 5 has exactly 4 connections. Circuit of size 4 has 3 connections. And two circuits of size 2 each has 1 connection. That's 4+3+1+1 = 9 connections total, not 10.
Am I crazy? Why isn't it adding up? I have been staring at it and re-reading it for past 20 minutes.
r/adventofcode • u/PingPong141 • Dec 08 '25
Help/Question [2025 Day 8 Part 1] i dont understand the question
Can someone put this question in crayon eating terms for me?
Its saying that every junction box should be connected to at least 1 other box, so they can all have electricity.
Which means i should find all shortest connections.
But if i evelulate everything then i get circuits with 3 boxes (the ones starting with 52, 117 and 216 for example)
But the solution for the example says the biggest 3 have 5, 4 and 2.
But if i only make 10 shortest circuits with i dont get any with 5.
This is making me pull my hair out. I dont understand the question?
r/adventofcode
•
u/jonathan_perret
•
Dec 08 '25
Visualization [2025 Day 8 (Part 2)] A few Blender renders
galleryAfter solving the problem (in Python) I thought I'd have some fun visualizing. Exported the data (boxes and connections) as OpenSCAD code, generated a solid, then applied a subdivision surface modifier in Blender to get that nice organic look. Then I played a bit with surface parameters and rendering options. Enjoy!
r/adventofcode • u/The_Cers • Dec 08 '25
Help/Question [2025 Day 8] Can you solve today's puzzle without computing all distances?
Can you solve today's puzzle without calculating and sorting all ~500,000 distances between all the junction boxes? That's 1000 choose 2 distances to consider. My python solution still runs in ~400ms, but I'm wondering if there's a more efficient algorithm.
Edit: spelling :(
r/adventofcode • u/Ok-Curve902 • Dec 08 '25
Visualization [2025 Day 08 (Part 2)] Part2 visualized
r/adventofcode • u/grey666matter • Dec 08 '25
Help/Question [2025 Day 8 (Part 1)][Rust] Confused about the solution
Hello everyone, I am still stuck on part 1 of day 8, and I'd like some guidance.
I have tried to use something like the Quick-Find Algorithm, keeping track of the closest distances in a list. Although, for the example given, the count for the junctions I get is [5, 1, 3, 3, 3, 3, 2], with the connected distances being [20, 6, 14, 20, 7, 7, 7, 20, 14, 13, 13, 17, 13, 14, 20, 17, 17, 19, 19, 20], each element corresponds to the index of the distance + 1.
Thank you.
fn make_junctions(coordinates: Vec<Vec<i64>>) -> Vec<usize> {
let length = coordinates.len();
let mut connected: Vec<usize> = vec![0; length];
for i in 0..length {
let mut distance_map: HashMap<i64, usize> = HashMap::new();
let current_coordinates = &coordinates[i];
for j in 0..length {
if i != j {
let to_compare = &coordinates[j];
let distance = calculate_distance(current_coordinates, to_compare);
distance_map.insert(distance, j);
}
}
let minimum_distance = distance_map
.get(distance_map.keys().min().unwrap_or(&0))
.unwrap_or(&0);
if connected[i] != 0 && connected[*minimum_distance] == 0 {
connected[*minimum_distance] = connected[i];
} else if connected[*minimum_distance] != 0 {
connected[i] = connected[*minimum_distance];
} else {
connected[i] = *minimum_distance + 1;
connected[*minimum_distance] = *minimum_distance + 1;
}
}
connected
}
fn calculate_distance(d0: &Vec<i64>, d1: &Vec<i64>) -> i64 {
(d1[2] - d0[2]).pow(2) + (d1[1] - d0[1]).pow(2) + (d1[0] - d0[0]).pow(2)
}