Do diagonal moves only as a last resort to avoid bypassing sensors.

Fixes a bug introduced by eb14e7e while solving #39.