standupmaths / frog_problem

Here is the frog problem code I wrote in an Edinburgh pub.
17 stars 15 forks source link

< or <= #5

Open RedPython73 opened 5 years ago

RedPython73 commented 5 years ago

This is only something small but, I think line 17 should read while trials < cap: rather than while trials <= cap:

This can be seen by setting max to 0. There should only be 1 trial but there will be two 2

It is even less of an issue with larger values of max

pcholt commented 5 years ago

You should be able to test this, and see if there's a reasonable solution when the number of hops across the pond is restricted to 2. There should be half the crossings taking 2 hops, and half the crossings taking 1 hop.