The code updates the particle positions only when the fflush in the particle_loop function is included. If this is removed the else part of the left-right function doesn't kick in at all.