Page 2 of 2

Re: Programming Light-weight Interactive Graphics (prob 202)

Posted: Thu Nov 13, 2008 2:28 pm
by Napoleon9th
quilan wrote:Actually experimenting & trying to find an angle that did those reflections didn't do a lick of help for me.
I'm thinking that checking all the 29 angles of the form of "n degrees" (61 - 89) for overlaps, disregarding any "target" (number of reflections), might be a better strategy to follow. Although i haven't yet got to doing it myself. :oops:

Re: Problem 202

Posted: Sun Mar 27, 2011 10:17 am
by thundre
I am close, but my number for 1000001 is off by 4. I'm getting 80844 instead of 80840.

Can someone verify my answer for 227 bounces, 28 paths? That is, 19 paths per side but 5 of them exit before the required number of bounces.

121198 paths with 1000007 bounces?

Edit: Rewrote my code using a slightly different approach, now it gets 121200 and the correct final answer.

Re: Problem 202

Posted: Mon Mar 28, 2011 10:37 pm
by davidFashion
thundre wrote:I am close, but my number for 1000001 is off by 4. I'm getting 80844 instead of 80840.

Can someone verify my answer for 227 bounces, 28 paths? That is, 19 paths per side but 5 of them exit before the required number of bounces.

121198 paths with 1000007 bounces?
For 227, I also get 28 paths.

For 1000007, I get 121200 paths.

Re: Programming Light-weight Interactive Graphics (prob 202)

Posted: Fri Nov 18, 2011 1:44 am
by sivakd
Very deceptive clue as well :). After a long long time, I finally managed to solve the problem and I posted how I solved it in the private forum along with an image of the various solutions for a specific value of bounces. I would say trying to find an angle that did those reflections is going to make it tough due to precision issues but experimenting and observing the pattern certainly helps. This problem made me also realize the obvious that spotting patterns out of integers is a lot easier than those that are (seemingly) out of real numbers. Looking back, may be one of the very few Project Euler problems for which I had to write so many different pieces of code to study the problem.
quilan wrote:Does it count as a clue to say I had to draw it on paper before it finally clicked? I hope not. Very very deceptive problem. Actually experimenting & trying to find an angle that did those reflections didn't do a lick of help for me.