r/adventofcode • u/Pretend-Fee-2323 • 2h ago
Help/Question [2026 Day 3 (Part 2)] rust help
https://pastebin.com/7ECYkJpcTrying to figure out what went wrong... I've tried all of the examples and they work, but its giving me a low answer when I input my puzzle input
I don't care about the crash with an extra new line at end of the input file, if I really wanted to i could fix that easily
also here is the graph I used to prototype, don't know if it will help. https://www.desmos.com/calculator/shdsyvumvf
2
Upvotes
2
u/AllanTaylor314 2h ago
Haven't had a chance to try the whole thing, but I find the use of floats risky. All of the points are integers
For the one you've got in Desmos, if we take 1,3 as the starting point and I guess 5,1 as the second point, the difference is 4,-2. The differences for the other points are 2,4 and 6,2
Thats dx=4, dy=-2
p3 offset is -dy,dx
p4 offset is dx-dy,-dy
I'll be back later (after today's puzzle) with some example cases
1
u/AutoModerator 2h ago
Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to
Help/Question - RESOLVED. Good luck!I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.