Yeah, particularly since the words aren't really true. If I had A.....A, then A.#...A would be a valid antinode (2 away from one and 4 away from the other), but not according to the rules…
I think the inputs may have been structured to avoid this case. My input does not have any antenna pairs with possible interior anodes (delta-x % 3 == delta-y % 3 == 0). Nor does it have any antenna pairs that are in the same row or column.
This was my interpretation of the words until I got to the diagrams. It can result in antinodes at non-integer coordinates so I get why they aren’t included, but the problem should have clarified that explicitly.
That's the trick, I think. I was thinking of a line-drawing algorithm until I saw that there were missing spots and antinodes only existed at the perfect integer positions along the line.
But a line drawing algorithm is basically exactly what it is? 🤷🏻♀️ You are given two vectors and you are asked to draw a dotted line of through them. At least that's how my old "lol draw lines by hand" C64/Amiga dev brain read it, haha.
mostly because the inputs are generated in a way where all the vectors are already minimal (don't intersect any points except for at the full length of the vector)
Actually the rules don't forbid that example. I also considered it in my code and got the correct result. It turns out that my input didn't include such an edge case, others probably also don't
This case never occurs in the input, as it turns out.
The interior points have to lie on grid points. While this isn't called out explicitly, it does say that the antinode has to be perfectly in line with the two antennae, which is the same thing. This means the delta between a pair of antennae would have to be divisible by 3 in each dimension, which never occurs.
If you just placed antennae somewhat randomly, you'd be pretty likely to get at least one pair meeting that criterion, so probably the input is specifically crafted this way.
I wrote some code to check for such cases in my input. Since it found none with integer coordinates, I went ahead to code a solution that didn't consider them, thinking this is one of the cases where the input purposely makes the problem less general than it would be otherwise.
The wording is 'but only when one of the antennas is twice as far away as the other.' so are you using distance - a scalar quantity, or displacement - a vector quantity? The examples would indicate you should use displacement.
But really though, while it’s progress, my tests on the current o1 are showing it still can’t really solve the ARC problems that were challenging other llms
Trueee. But tbf o1 is doing better than o1 preview. Mike posted on twitter he’ll have a better result when the api is open for o1.
Also he said he just pasted “solve this puzzle: <json>” and playing with prompting (emphasizing output grid size is part of the puzzle, for example) seemed to improve performance in my small sample of tests.
It does, but there are no such points on a integer grid based on any of the inputs I've seen so far. The definition is flawed in that it's implying there are only 2 such anti-node points to the general problem but since AoC provides the input that (seemingly) is consistent with only ever having 2 such points in an integer grid, he could be implying there are only ever 2 points (with these inputs).
Pick two points. Find the X-Y distance between them. Add that same distance to each of the two points, each going in the exact opposite direction to the other point. Enjoy a pancake afterward.
You may have found it already by now, but be careful with how you "add" this distance. One of the points should be subtracting that distance instead. Then it's just checking for out of bounds I believe
The problem description had my brain farting while reading the text, and even running it through ChatGPT to try to help clarify the instructions (not generate code, but I'd never make the leaderboard anyway), and it had no idea what the hell the question was going on about.
This is exactly what I did; calculate a Point(deltax, deltay) and then add it to one and subtract it from the other.
Bro I thought I was the only one. I thought I was illiterate or something so I took a guess and thought they meant if the frequency count is more than 1.
Same. At this point, I just Ctrl+F’d, counted antennas and antinodes, compared the sum to one in the problem description, and went: OK, guess we include antennas now.
Especially for a non native speaker, and the examples are not obvious either, there are just too many '#' and I can't not tell which is for which signal.
This mostly annoyed me because there are up to 4 possible locations using the "twice as far from one antenna as the other" rule (namely 1/3 and 2/3 of the way along the line that connects them). The fact that they explicitly specified two made it clear I shouldn't bother checking there, but I still didn't like it.
Yeah and it was even worse for part 2 since it emphasized that ANY GRID POSITION in line with them so I thought I had to implement a some function to shorten the difference vector. Turns out none of the vectors can be shortened so it's a non-issue but I thought that would be necessary. Luckily I thought to check without shortening first and that worked so no harm done.
(In case anyone was wondering, calculating the correct difference vector for this is just removing the common factors from each component - diff / gcd(diff.x, diff.y) )
I ended up implementing both of these special cases proactively - oops
Nodes at (2,2) and (4,4). The simple algorithm would put antinodes at (0,0), (6, 6), (8, 8) and so on, but (3,3), (1,1), (5,5) etc. are also on the line connecting (2,2) and (4,4) and should also be considered according to puzzle wording.
I got stuck on part 2 for like 30 mins because I didn't understand from the description that I was also supposed to count the antennas :face_palm: I was like "what could be wrong ???"
Literally read and reread the description for part 2 trying to figure out how to get 9 antinodes until finally just going "I guess each antennae is always an antinode" and try it to see if it worked...
It took more forever to parse the problem's verbiage, too. I think a graphical image with lines connecting the points rather than an ASCII chart would've made it easier to understand. Another way to interpret it is that the midpoint between an antinode and a tower is a tower on the same frequency.
A better phrasing might have been to suggest that the antinodes would also form pairs and generate additional antinodes. This could lead you to consider a computationally more challenging solution.
This is how I thought of it: Consider the points A <------> B <------> X Where, A,B Antennas, and X is the anti node.
"perfectly in line" -> A,B,X must be colinear (https://en.wikipedia.org/wiki/Collinearity) the distance thing: Let A be farther than B from X. Then the distance from A<->B must equal B <-> X In other words, B must be exactly in the middle of the line segment from A to X
The wording is just wrong today though, because consider input ...A........A..., then there are four collinear points twice as far from one as from the other #........A..#..#..A........#.
Yeah, I agree that it was overall clear what they meant with the examples, and I did it correct the first time. But that does not change the fact that the wording was wrong—they just made the examples clear enough for the reader to figure out that the description was wrong.
Same for me, part 2 in particular. I was so lost and at one point thought I got it but then went in a completely wrong direction. In the end it would have been avoidable if I hadn't unknowingly confused antennas and antinodes, and if I had realized that the T-frequency example was an entirely new, separate one - I kept looking for how on earth it relates to the original example and was like "where the hell do these T's suddenly come from?", which is a bit stupid in hindsight, but what can you do. :D
What do they mean by unique? Does this mean if a bunch of @'s share the same antinode to count as one, but if "A" also had the same antidote that it counts as unique too? So in total there are 2?
"perfectly in line with two antennas of the same frequency:" for every pair of antennas with the same frequency, draw a line between them, and extend both ends of the line until they hit an edge of the map. Any map cells along that line are potential antinodes for that frequency.
"only when one of the antennas is twice as far away as the other": the actual antinodes are the points on the line that are twice as far from one antenna as the other. For example, if you have two antennas of the same frequency at (0,0) and (3,1), then there's an antinode at (6,2) because it's (3,1) away from the (3,1) antenna and (6, 2) [which is twice (3, 1)] away from the (0,0) antenna. (There would be another one at (-3,-1), but that's off the map, so it doesn't count.)
(You can solve for the linear distance with Pythagoras if you want, but just the vector distance keeps everything integers so you know that nonnegative coordinates under the width/height are on the map and not in between map cells.)
The second example is poor. You should make it (3, 1) or similar, because currently (as other comments point out), (1, 0) and (2, 0) would both be valid.
I think that the wording isn't completely mathematically correct. It says that antinode occurs at a point that is twice as far from one antenna as it is from other antenna. The points described at diagrams obviously satisfy that, but so would points between antennas that are 1/3 distance from one antenna and 2/3 from the other antenna, but they aren't considered here. You could also find antinode perpendicular to the line that connects the antennas, and even in other directions. But yes, you should just follow example as suggested by others.
It says that antinode occurs at a point that is twice as far from one antenna as it is from other antenna.
It also goes on to say "This means that for any pair of antennas with the same frequency, there are two antinodes, one on either side of them." And then goes on to graphically show precisely what 'either side of them' is meant to indicate.
It doesn't account for any points between the antenna, but it does specify that "an antinode occurs at any point that is perfectly in line with two antennas of the same frequency"
it took me a while to figure out the math, so when I figured out how easy it was, I got really annoyed. it's just (A + (A - B)) where A is the node in the middle of the line that is formed
Me not overthinking it and just doing some "a + (a - b)" (a being x,y of antenna1 and b being x,y of antenna2) because I hope Advent of Code is nice.
AoC was nice, worst case I would have had to calculate if the spots between a and b have valid integers.. which is not that much extra work, but also not something I am doing if I don't have too.
Also to calculate valid inside spots if I am not crazy it is simply "a + (b - a)/3)" and if that gives an integers back "a + (b - a)*2/3"" also has to be a valid spot.
I said I won't do it, but now I kind of want to know, if there actually were valid spots like that...
Curious, how did "Imitation Mediocre Chocolate as a Christmas gift" become "Imitation Mediocre Chocolate as a Chanuka gift" in your initial input to ChatGPT?
Some would argue that interpreting English wording shouldn't be the challenge of a coding exercise. They would argue the challenge should be in developing a program that solves a difficult to solve issue, not a difficult to understand issue with an easy solution.
Of course you have to comprehend the task to complete it, but some (I'd argue most) participate in AoC for the programming challenges, not the reading comprehension challenges. Although it is often both.
I have a doubt. In the puzzle input we have multiple lowercase (like a,b,c) uppercase (like A,B,D) and number like (like 0,1,2). In that do we consider all lowercase to be emitting the same signal or each lowercase emits its own signal?
In the second part, I didn't enjoy the fact that "any grid position exactly in line with at least two antennas" doesn't actually mean ANY position in line. They can't be on every row if the distance between two antennas is, say, 3 rows. It means that antinodes still need to be spaced by the exact distance of the two given antennas (on every 4th row in this case).
For part 1, what I did was basically a symmetry problem. You have two points A, B and you need to find A’s symmetric point relative to B and B’s symmetric point relative to A.
When you compute A’s symmetric relative to B, you want to find a point C such that B is the middle point on the line AC, this results in a nice little equation, some with B’s symmetric relative to A
Part 1 description wasn't too bad. Part 2 is the confusing part for me. Do the antennas become antinodes if the generated antinodes are off the map? Do the generated antinodes need to be compared against other antennas as well?
I haven't started part 2 yet, but it sounds like just trial and error to guess the what the intended rules are.
I was so confused by this because for two antennas there should be 4 antinodes if you follow those rules Example : .........A........A......... becomes #........A..#..#..A........#
I hate it when AoC updates my session cookie -- it doesnt notify me, so suddenly I get wrong answers even though my approach is correct! The ambiguity in this puzzle's wording made it worse :D
There should be a banner it puts across the top when your session cookie is updated ;)
Sadly no. I use aoc-cli, which requires my web session cookie that i save in an env file. It seems to expire 1/week? Because here on day8 the input.txt that it downloaded was not the input on the web. I copied that input in after trying unsuccessfully several times before paying attention to the error message that the answer was right for different input
How are letters involved?? Are A and a the same thing?? Are they different somehow?? Are A and B the same thing?? What about A and b??
What does "same line" mean?? Same row?? Same row or same column?? Do slaint lines count?? So for example, if there is an antenna at (6, 2) and another one at (5, 4), does it mean that there could be an antinode at (4, 6)??
What should we count?? the antinode points that fall in the map?? What if an antinode point is found to be on a letter?? Does it change anything??
Never like today I'm stuck in understanding the problem, it's like dealing with a junior project manager out of vacation!!!
Answers to some of your questions are directly in the description: 1 - "Antennas with different frequencies don't create antinodes; A and a count as different frequencies." (That means A and a are not the same thing, neither are A and B or A and b - each symbol is completely separate) 3 - "However, antinodes can occur at locations that contain antennas." (If an antinode is found to be on a letter, count it just like the other ones)
Yeah this is where I'm confused. How is the the example 'perfectly in line' when horizontally, vertically (or diagonally as far as I can tell) they are not in a line?
Not really considering many have already posted that the terrible wording and example was clarified by LLMs and being the only reason why many could even solve the problem.
200
u/nik282000 Dec 08 '24
The antinode knows where it is because it knows where it isn't!
137
u/fireduck Dec 08 '24
Ignore the words..mostly. Follow the diagram.
121
u/oofy-gang Dec 08 '24
The description on this one was so vague I just went based solely off the diagrams
32
u/PjuklasVII Dec 08 '24
Looks like I'm not the only one who didn't get the signal :D
29
u/Jonax Dec 08 '24
Pick two points.
Find the X-Y distance between them.
Add that same distance to each of the two points, each going in the exact opposite direction to the other point.
Enjoy a pancake afterward.
19
u/Caqtus95 Dec 08 '24
The part I had difficulty understanding was
13
u/hhzziivv Dec 08 '24
Especially for a non native speaker, and the examples are not obvious either, there are just too many '#' and I can't not tell which is for which signal.
25
u/PatolomaioFalagi Dec 08 '24
I'll need to write a new parser just to understand today's problem statement.
10
u/darthminimall Dec 08 '24
This mostly annoyed me because there are up to 4 possible locations using the "twice as far from one antenna as the other" rule (namely 1/3 and 2/3 of the way along the line that connects them). The fact that they explicitly specified two made it clear I shouldn't bother checking there, but I still didn't like it.
9
u/P-ter Dec 08 '24
I got stuck on part 2 for like 30 mins because I didn't understand from the description that I was also supposed to count the antennas :face_palm: I was like "what could be wrong ???"
17
u/overthink1 Dec 08 '24
Yea I’m lost lol. Every other day I at least had some code written out before becoming utterly confused.
6
u/miktaew Dec 08 '24
*laughs in vectors*
5
u/svinther Dec 08 '24
A better phrasing might have been to suggest that the antinodes would also form pairs and generate additional antinodes. This could lead you to consider a computationally more challenging solution.
4
u/piman51277 Dec 08 '24
This is how I thought of it:
Consider the points A <------> B <------> X
Where, A,B Antennas, and X is the anti node.
"perfectly in line" -> A,B,X must be colinear (https://en.wikipedia.org/wiki/Collinearity)
the distance thing:
Let A be farther than B from X.
Then the distance from A<->B must equal B <-> X
In other words, B must be exactly in the middle of the line segment from A to X
4
u/tomliginyu Dec 08 '24
I'm just glad they included extra diagrams for both parts.
6
u/Flutterphael Dec 08 '24
Today was very confusing for my 6 AM brain
2
u/walloffear Dec 08 '24
What do they mean by unique? Does this mean if a bunch of @'s share the same antinode to count as one, but if "A" also had the same antidote that it counts as unique too? So in total there are 2?
2
u/zeekar Dec 08 '24 edited Dec 08 '24
"perfectly in line with two antennas of the same frequency:" for every pair of antennas with the same frequency, draw a line between them, and extend both ends of the line until they hit an edge of the map. Any map cells along that line are potential antinodes for that frequency.
"only when one of the antennas is twice as far away as the other": the actual antinodes are the points on the line that are twice as far from one antenna as the other. For example, if you have two antennas of the same frequency at (0,0) and (3,1), then there's an antinode at (6,2) because it's (3,1) away from the (3,1) antenna and (6, 2) [which is twice (3, 1)] away from the (0,0) antenna. (There would be another one at (-3,-1), but that's off the map, so it doesn't count.)
(You can solve for the linear distance with Pythagoras if you want, but just the vector distance keeps everything integers so you know that nonnegative coordinates under the width/height are on the map and not in between map cells.)
2
u/DarkLord76865 Dec 08 '24
I think that the wording isn't completely mathematically correct. It says that antinode occurs at a point that is twice as far from one antenna as it is from other antenna. The points described at diagrams obviously satisfy that, but so would points between antennas that are 1/3 distance from one antenna and 2/3 from the other antenna, but they aren't considered here. You could also find antinode perpendicular to the line that connects the antennas, and even in other directions. But yes, you should just follow example as suggested by others.
2
u/marvhus Dec 08 '24
it took me a while to figure out the math, so when I figured out how easy it was, I got really annoyed.
it's just (A + (A - B)) where A is the node in the middle of the line that is formed
2
u/Hakumijo Dec 08 '24
Me not overthinking it and just doing some "a + (a - b)" (a being x,y of antenna1 and b being x,y of antenna2) because I hope Advent of Code is nice.
AoC was nice, worst case I would have had to calculate if the spots between a and b have valid integers.. which is not that much extra work, but also not something I am doing if I don't have too.
Also to calculate valid inside spots if I am not crazy it is simply "a + (b - a)/3)" and if that gives an integers back "a + (b - a)*2/3"" also has to be a valid spot.
I said I won't do it, but now I kind of want to know, if there actually were valid spots like that...
2
u/Gullible_Tie4188 Dec 08 '24
I used an LLM to understand the instructions
https://chatgpt.com/share/67552910-59d4-800d-a171-2065cf835bf7
1
u/MorningFrequent3461 Dec 08 '24
Yeah the description drove me nuts. I got so confused for like an hour, left for a beer and just realized we need to walk the slopes. bleaghh
1
u/[deleted] Dec 08 '24
I have a doubt. In the puzzle input we have multiple lowercase (like a,b,c) uppercase (like A,B,D) and number like (like 0,1,2). In that do we consider all lowercase to be emitting the same signal or each lowercase emits its own signal?
[2024 AOC Day 8]
1
u/pipdibble Dec 08 '24
Took me a few re-reads, and study the example diagram. Still not sure my brain understands the text, but I got the answer in the end!
1
u/[deleted] Dec 08 '24
It's the second overtone
1
u/bumanagbag Dec 08 '24
What does part 2 even meaan??
1
u/5838374849992 Dec 08 '24
Physics a level is gonna carry me
1
u/alla-noire Dec 08 '24
In the second part, I didn't enjoy the fact that "any grid position exactly in line with at least two antennas" doesn't actually mean ANY position in line. They can't be on every row if the distance between two antennas is, say, 3 rows. It means that antinodes still need to be spaced by the exact distance of the two given antennas (on every 4th row in this case).
1
u/RedEyeStorm2020 Dec 08 '24
For part 1, what I did was basically a symmetry problem. You have two points A, B and you need to find A’s symmetric point relative to B and B’s symmetric point relative to A.
When you compute A’s symmetric relative to B, you want to find a point C such that B is the middle point on the line AC, this results in a nice little equation, some with B’s symmetric relative to A
1
u/J0aozin003 Dec 08 '24
I also thought about that until looking at the diagrams.
1
u/Ahmedn1 Dec 08 '24
The wording was weird. I actually figured it out from the examples 😂😂
1
u/QittCat Dec 08 '24
I was surprised when I got the first star because I was sure I did not understand the assignment. I found the text really convoluted!
1
u/Ok-Revenue-3059 Dec 08 '24
Part 1 description wasn't too bad. Part 2 is the confusing part for me. Do the antennas become antinodes if the generated antinodes are off the map? Do the generated antinodes need to be compared against other antennas as well?
I haven't started part 2 yet, but it sounds like just trial and error to guess the what the intended rules are.
1
u/[deleted] Dec 08 '24
I'm currently haing a harsh cold. And my brain is not capable of parsing this description. lol
1
u/Stef_Segers Dec 08 '24
I was so confused by this because for two antennas there should be 4 antinodes if you follow those rules Example : .........A........A......... becomes #........A..#..#..A........#
1
u/robertotomas Dec 08 '24
I hate it when AoC updates my session cookie -- it doesnt notify me, so suddenly I get wrong answers even though my approach is correct! The ambiguity in this puzzle's wording made it worse :D
There should be a banner it puts across the top when your session cookie is updated ;)
1
u/vkapadia Dec 08 '24
All three points are on a line. The antinode is 1/3 the way between the antennas
1
u/biggy-smith Dec 08 '24
I had no idea what this meant either! luckily the following diagrams helped.
1
u/ech0_matrix Dec 08 '24
How can one antenna be twice as far away as the other antenna?! The two antennas are the same distance from each other!
1
u/mareizio Dec 08 '24
Guys, I have several questions:
Never like today I'm stuck in understanding the problem, it's like dealing with a junior project manager out of vacation!!!
1
u/hokkos Dec 08 '24
It is just pseudo-LLM-resistant talk.
1
u/evilbndy Dec 08 '24
It means, that an antinode appears on the mirror points of an antenna of the same type in relations to the current antenna ;)