Help with recursive function?

closed account (oN3h0pDG)
...
Last edited on
In your original code there is no return value on the else condition.
Also, the else if (weight > 0.1) condition is unnecessary, as it is a tautology.


> I have no idea how to determine the break off parts of the cookies.
Because each part may break different later, you'll need to to call the function for each part and the add it together.
1
2
3
4
5
6
int parts = random();
int total = 0;
for(int K=0; K<parts; ++K)
   total += eatCookie( weight/parts );

return total;
Topic archived. No new replies allowed.