It's because of the cart's velocity. An action would affect the cart's velocity instead of its position. Velocity, in turns, would decide the cart's position in the next state. The velocity needs to reverse its sign (neg/pos) first before the cart could move in that corresponding direction (neg -> go left, pos -> go right).
For example, your action is to "Go left" but your velocity is still positive, the cart would still "Go right" until velocity turns negative.