t = 0; while (t < 1000) r = sqrt(x*x + y*y); a = - G*M*m / (r*r); ax = a*(x/r); ay = a*(y/r); vx = vx + ax*dt; vy = vy + ay*dt; x = x + vx*dt; y = y + vy*dt; t = t + dt; end