In a gravity puzzle the player pulls back a slingshot and planets bend the flight. One level that cannot be won, or a hint that points slightly wrong, and the player stops trusting the game. This is how I built a solver, a level generator and a hint audit for Slinglings, with the real numbers from the code and the tests.
One physics step, used everywhere
Everything rests on one rule: the game must never disagree with itself. Each step, the pull of every planet is added to the courier's velocity, then the courier moves by that velocity. The step is fixed at 1/120 of a second, so a flight is a list of identical small steps and the same input always draws the same path. A flight is cut off after 960 steps, which is 8 seconds.
Update: vx += ax * DT, then x += vx * DT, with DT = 1/120 s.
Pull: G * mass / (distance squared + 3 squared) to the power 1.5, times the offset to the planet.…