Just start the simulation, and sit back and relax! (Can possibly bore you) Click/Tap quickly to spawn more balls. For statistical data, press any key or long click/hold for showing or hiding the data values.
v.1.0: Simple project with ball bouncing on the wall and duplicates after touching the blue line at the bottom. v.2.0: More additions to this project, making it more interesting and random. The 'timer' has been added. So the main ball (ball that spawns at the start) goes around, and if it by chance hits the blue line, it goes back to the center and has a chance to duplicate/replicate, and so a replication occurs. These replicates have a small chance to die, or disappear completely, at random. But, they also do have the same properties of the main ball, which is bouncing and replicating. Note:If a replicate ball hits the blue line, it does not die. It just goes back to the center and resumes its life. These are the rules of the similation/experiment: 1. The main ball that spawns at the starting, spawns at 0,0, and moves at a constant rate in a random direction upon spawning. Also, the main ball does not die. 2. The red line moves horizontally across the screen at the bottom forever, and switches direction upon hitting the edge of the screen. When starting the simulation, it starts at the center of the x-axis, at y-level: -170. It also picks a random direction to move towards as it spawns. 3. Now, all balls have the capability to replicate when the touch the blue line, produce a "pop" sound, and spawn at the center. A replicate ball will spawn at the center along with its parent ball. A ball can produce either none or a single ball after spawning at the center (except for the main ball, when the simulation starts). Also, the spawning of a ball increases the 'replications' counter. Note: A ball points in a random direction after spawning at the center. 4. The main ball as well as the replicate balls can bounce on the wall, and follow the same rules as a ball in zero gravity (i.e., Angle of Incidence = Angle of Reflection), of course not accounting for energy loss, surface deformation, etc. Also, unlike the bouncing on the walls, if the balls hit the red line, it bounces in the same direction as it is moving in, i.e. left or right, but at a random angle. 5. To prevent the balls from spawning and bouncing forever (when it is moving parallel to the blue line), the balls change direction at random between 30-100 seconds to the right, anywhere from 10°-179°. 6. Unlike the main ball, the replicate balls do die, i.e., disappear. After continuous cycles of random time intervals from 1-3 seconds, the ball has a probability of 1/7 to die. Also, the death of a ball increases the 'death' counter. 7. The statistical data shows various data values like: i. Timer - The time that has passed after the simulation has been started. ii. Deaths - The total number of replicate balls that have died. iii. Replications - The total number of replicate balls that have spawned. iv. Population - The current number of balls alive . Also, since the main ball is always alive, the 'population' counter never goes below 1. Note: Population = (Replications-Deaths)+1 v. Average Popu. - The average number of balls present while the simulation has ran. Also, since the 'population' counter never goes below 1, the average population also never goes below 1 (except for some errors that I think Scratch causes) vi. Round Off Av. Popu. - A slider to show or hide the number of decimal places the 'Average Popu.' counter shows. vii. Popu. Record - The maximum number of balls that has been present in the simulation at once. v.2.1: You can now spawn replicates by clicking or tapping.