This is a physics simulation of the chaotic 3-body problem. I used the formula for Newton's Law of Gravitation and the 3rd law of Motion for the calculations. I also show the 2D gravitational field by drawing the force vectors created by the bodies at each point in space. The length and brightness of the force vectors show the strength of the gravitation experienced at that point.
This coding exercise is inspired by the Netflix series '3 body problem' I saw my parents watching. The Trisolaran's home planet, Trisolaris, has unpredictable and extreme weathers due to its constantly changing distance to its 3 suns, leading to them searching for another home planet that is more stable.