On Beta
  global gbeta1, gbetaV, epsilon, t, P, r, A, alpha
  set gbeta1 = 2*pi()*t/P
  set gbetaV = gbeta1
  repeat while abs(gbetaV - (gbeta1 + epsilon*sin(gbetaV)))>=.0000001
    set gbetaV = gbeta1 + epsilon*sin(gbetaV)
  end repeat
  put (A*(1 - epsilon*cos(gbetaV))) into r
  put 2*atan(sqrt((1+epsilon)/(1-epsilon))*tan(gbetaV/2)) into alpha
end

on coord
  global alpha, r, dY, dX
  if alpha <= pi()/2 and alpha > 0 then
    put - sin(alpha)*r into dY
    put sqrt((r*r)-(dY*dY)) into dX
  else
    if alpha > pi()/2 and alpha <= pi() then
      put - sin(pi() - alpha)*r into dY
      put -sqrt((r*r)-(dY*dY)) into dX
    else
      if - alpha > pi()/2 and - alpha <= pi() then
        put sin(pi() + alpha)*r into dY
        put - sqrt((r*r)-(dY*dY)) into dX
      else
        if - alpha <= pi()/2 and - alpha > 0 then
          put sin(- alpha)*r into dY
          put sqrt((r*r)-(dY*dY)) into dX
        end if
      end if
    end if
  end if
end


On mercury
  puppetsprite 3, true
  trails 3
  global t, P, A, alpha, epsilon, r, dX, dy, me
  set me=1
  set P = power(.3871,1.5)*365.25
  set A = 38.71
  set epsilon = .2056
  beta
  coord
  puppetsprite 3, true
  trails 3
  set the locH of sprite 3 to (320 + dX)
  set the locV of sprite 3 to (240 + dY)
end