project-p project is a simulation in which particles interact with each other based on a simple rule.
Version: 2.0project-p project is a simulation in which particles interact with each other based on a simple rule.
Operating System: Linux
In p, a bunch of particles interact with each other according to this simple rule: every particle must move towards, away or watch another particle. When the program starts, each particle chooses a random color, position and the particle it will move towards, away or watch.
As the program runs, some particles join together to form a train and continue their journey together thereafter. There are many such trains too, but how do they form? Imagine 2 particles A and B. If A moves away from B as B moves towards A we get a self propelling train. The rules dont predict when and where these trains will form but they emerge everytime the program runs.
A particle in p moves towards or away from another particle by a definite amount D along the straight line joining the particles. Consequently, a particle cant move towards or away from itself. A particle that watches another particle doesnt move too. It either waits for the watched particle to come close to it or move far away before it decides to move towards, away or watch another particle. But if the watched particle recedes while it hopes it would come closer, it would watch forever.
Now, what happens if there is only 1 particle in the system? Well, it cant move towards or away from itself thats for sure. It could watch itself but what can it do when it stopped watching? Move towards, away or watch itself some more! Therefore, if there is only 1 particle in the system, we can conclude that it will stay put in its initial position.
Now consider a 2 (or more) particle system. Let the particles be A and B. Let A stand still (as if it were a 1-particle system) and let B move towards A. If B is seperated by a multiple M of D ie separated distance = M x D, it will collapse into A in M steps. If B is instead separated by a multiple M of D and by some more distance N ie the separated distance = M x D + N, B will orbit A in M steps.
Apogee and perigee will be N units or N - D units. The same thing happens if A is also moving towards B as B is moving towards A but sooner - in approximately M / 2 steps. Once again, the rules dont predict these phenomena but they always emerge when the program runs.
· SDL (libsdl.org)
· freeglut (freeglut.sourceforge.net)