Posted by Andrew - Team 27297 on March 03, 19100 at 00:04:33:
In Reply to: Help......Anyone??? posted by kgbros on January 19, 19100 at 07:33:23:
I suggest you create an array of object or records to represent the particles. The particles would need to have an X and Y property, number-of-collisions, how-died, path and direction.
x,y - reals
no-collisions - integer
how-died - string/integer
path - 2 dimensional array of previous x,y
direction - integer
You should first create and place your particles (use random(n) to generate a random number).
Then in a loop:
Give each particles a direction to move, move them, and update path.
Calculate collisions
Update collisions property
Check for deaths/escapes and record which in how-died
Once all particles have died/escaped, you can now calculate percentages of various deaths and also path crossing.