nature-of-code / noc-examples-processing

Repository for example code from The Nature of Code book
MIT License
2.56k stars 951 forks source link

Fixed Rocket.pde of EvolveFlowField: ArrayIndexOutOfBoundsException #22

Closed mattiloh closed 11 years ago

mattiloh commented 11 years ago

When I ran this example and some rockets came to the bottom right corner of the window, it threw an ArrayIndexOutOfBoundsException at that line.

Actually y*(width/gridscale)should be the same as y*width/gridscale.

But as y is of type Integer, it behaves differently and causes an ArrayIndexOutOfBoundsException.

With the brackets around width/gridscale it is the same term as for the instantiation of the array dnasize = (width / gridscale) * (height / gridscale);

So I think it should be save that way.

shiffman commented 11 years ago

Thank you!!!