Newton's law of universal gravitation
This simulation uses the famous equation of Isaac Newton (https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation) which is based heavily on Kapler's previous work (https://en.wikipedia.org/wiki/Johannes_Kepler).
The maths itself is quite simple (but I think there could be a more efficient way to do the integration). The trick of bringing movement into the simulation is to put a small initial force vector for each generated planets.
This simulation is of course not 100% realistic since some assumptions were made. But I hope it is still a good fun to look at how celestial bodies move around :)