swinging pendulum algorithm | ScratchStats