N-Body Simulation

Coded in C++

For one of my school assignments, I developed an N-body simulation that animates a system of particles inspired by the planets in the solar system, all interacting through mutual gravitational forces. The project had two stages: the first displayed a static scene generated from an input file containing details like the system's size, the planets' initial positions and velocities, and the images used to represent each planet. The second stage added realistic physics and animation.

In the completed version, the simulation tracks each planet's position and velocity over time, adjusting their on-screen movement to account for the coordinate system of the graphics library. At every time step, the program calculates the gravitational forces between each pair of planets, updates their trajectories accordingly, and redraws the system to show the evolving motion. As an extra feature, an elapsed time counter appears in the corner of the screen.