Simulating gravity between two objects is, computationally, REALLY easy because it only involves one force.
This means it can basically be done by hand by making an equation that you plug initial parameters into and go with.
Like all good things in life it gets very hard adding a third object (which sort of has been solved), and near impossible to do by hand when adding a fourth.
Cue computers, things that are designed to do lots of menial calculations very quickly. This makes the problem managable. Sure we can't write an equation to model where the particles will be at any time, but we can do pretty good. What we can do is simulate it, and as the size of the timestep (∆T) approaches 0 (that should look familiar if you were paying attention in calc...) the approximation approaches what actually happens.
The pseudocode for this looks pretty easy. Its something like this
Array.ofallobjects(object1, object2, ... objectn)
for each object in the array of all objects
calculate the force relative to each other particle
apply that force for a timestep ∆T
apply the new velocity for the timestep
plot the new position
increment the timestep
So it kind of makes sense that as the timestep gets smaller, that approximation is going to get better and better. Thankfully, for the scope of this project right now a decently sized timestep has a pretty small effect on how things turn out and you can still get pretty realistic.