Can you swap black and white knights in this 4x4 grid? There is one important constraint: at no point can a knight be under attack by an opponent knight. Knights move using standard chess moves (L shapes) and can be moved in any order (no need to alternate colours). Knights cannot exit the grid.
possible. We can even alternate black and white. The following uses 11 moves (22 semi moves):
Not an answer, but I would like to share my initial approach, before I figured that it's as helpful as I thought it was going to be.
The idea for this kind of problem usually is to convert it into a graph, then usually its easier to visualize the solution. But not for this case, apparently.
In the graph below, each node represents a square, and the edges represent the possible knight moves between squares. Red nodes represent black, green nodes represent white. Following loopy walt's notation, I use the a5-d8 part of the chessboard. The problem is then to switch the red and green nodes by moving the color along the edges, with the requirement that at any time, no two different colors should be adjacent.
Here we can see that only b6 and b7 are free for the first move, which can come from a8/c8 and a5/c5. I thought there could be a single Hamiltonian cycle on this graph on which we can simply move the colors. But there is none that would preserve the requirement of no two different colors should ever be adjacent.
At first I was thinking of a8-b6-d7-c5-a6-b8-c6-a5-b7-d6-c8-a7-b5-c7-a8. But the d7-c5-a6-b8 part won't be tenable to moving two different colors, due to the edge between d7-b8.