42
While the problem text said "Now, it is only possible to win a prize on the second and fourth claw m...
9 months, 4 weeks ago
—
1 year, 1 month ago4 of 4
Tip Reveddit Real-Time can notify you when your content is removed.
your account history
Tip Check if your account has any removed comments.
view my removed comments you are viewing a single comment's thread.
view all comments


Well this is upsetting. I get the same answer as you on the example, but on my puzzle input the answer is too low. Literally no changes between part1 and part2 except adding the extra amount to the prize position.
I assume I'm missing some valid solutions but no idea how. Will see if I can write a test for solvability I guess?
I had the same problem. What helped me was adding validation for the answer. Sometimes, the solution wasn't correct with higher numbers in part two. I just did not count these invalid solutions.
bool isValid = clicksA * aX + clicksB * bX == prizeX && clicksA * aY + clicksB * bY == prizeY;
I had an issue with part two where I was pushing some buttons a negative amount of times to hit certain targets that shouldn't have been hittable...may or may not help you.
I think that doesn't happen on the sample input but did happen on my actual input.
All unique solutions, even for part 2. Check that number of times A and B were pressed are not fractional, and lastly check if you correctly put braces in the equation for calculating presses.