Friday Puzzler -- Train
Alex Y
Below is a diagram of a train setup. The locomotive, at the upper left, can fit through the tunnel on the right side, but both boxcars A and B have wide loads that prevent their passing through the tunnel.

Your task is to swap the places of A and B, returning the locomotive to its original spot, in as few operations as possible. An "operation" here is movement of the locomotive, up until it:
* reverses direction
* hooks up with a (or an additional) car to either push or pull
* unhooks from a car
*stops.
The boxcars can be hooked together (and that defines the end of an operation).
The picture is unclear on one point--the locomotive can pull to the right and reverse to go down to the bottom without hooking up with or pushing A. Similar room exists at the bottom.
No "flying switch" is possible. I.e, if you push one of the boxcars onto one of the spurs, you need to push it , then back up to clear the switch before going to the other side of the oval by that route.
