This is a simple 2D gravitational attraction simulation. Collisions are presumed to be happening on the centers of the bodies and result in merging. If a body reaches a certain radius, it collapses into a black hole.
Also included is a p5.js version. See it working here.
Feel free to let me know about any issue or idea.
Two planets orbiting a black hole