NOTE! This answer was written before the rotation requirement. Proceed at your own caution 🙂
Here’s my initial look at the problem.
The first thing to do is calculate the parity of the exterior – +1 if it would fit ‘stripes in corners’, -1 if it would fit ‘solids in corners’, +0 if it’s the 8 ball. This gives us a range from +12 to -12, and we aim for the extreme we are closer to. (If +0, pick +12 or randomly)
For example, this is +1 +1 +1 -1 -1 +1 -1 -1 -1 +1 +0 -1 and thus it’s -1 leaning solids in corners:
x o x x o
x o x o
8 x o
o x
o
The next thing to do is move the 8 ball into the center. If you can do two adjacent swaps with it that moves two balls into position, rather than a single adjacent swap that moves just one ball into position (or a single non-adjacent if it’s in a corner), do so.
x o x x o
x 8 x o
o x o
o x
o
After we move the 8 ball, all combinations of two adjacent swaps sharing a ball can be produced by a non adjacent swap identically, so we have to consider far less complexity at once.
Order all remaining moves by this priority:
-A swap between two adjacent balls on the outside is ‘worth 4’ (2 if it’s our last)
-A swap between two adjacent balls, one on the outside, is ‘worth 2’ (1 if it’s our last)
-A swap between two balls on the outside is ‘worth 2’
-A swap between two balls, one on the outside, is ‘worth 1’
And perform them from top to bottom.
So we move the o on the top, left (4), the o on the right side in (2), the o on the bottom left in (2) and then swap the x top with the o in the middle (2). We ended up doing five swaps in a 2-2-1 series, so three moves.
o x o x o
x 8 x x
o o o
x x
o
(Notably, this one would have been solved just as fast if we aimed for stripes in corners.)
x x o o x
o 8 o x
o x o
x o
x
I think it’s impossible to require 4 turns, but I haven’t proven it to myself yet.
Another worked example:
This has a parity of +1 so we aim for stripes in corners:
8 o o o x
o o o x
o x x
x x
x
swap 8 ball with center x
(1-)
x o o o x
o o o x
o 8 x
x x
x
swap two adjacent on outer, 4 points
(1-1)
x o o o x
o o o x
x 8 x
o x
x
swap adjacent edge into center, 2 points
(1-2-)
x o o o x
o o x o
x 8 x
o x
x
swap edge to edge, 2 points
(1-2-1-)
x o x o x
o o x o
x 8 x
o o
x
3 moves.
EDIT: This works quite well for the example in the opening post, solving it in two moves:
This has a parity of +1 so we aim for stripes in corners:
x x o o x
o o x o
o o 8
x x
x
Swap 8 with x on edge then with o in center (solving two edges)
(2-)
x x o o x
o o x o
o 8 x
x o
x
swap adjacent o and x on top and bottom left (solving four edges)
(2-2-)
x o x o x
o o x o
x 8 x
o o
x
2 moves.