*/
@Override
public TantrixPath mutate(TilePlacement pivotTile, TantrixPath subPath) {
TilePlacementList tiles = new TilePlacementList();
TilePlacementList subPathTiles = subPath.getTilePlacements();
TilePlacement firstTile = subPathTiles.get(0);
Location firstTileLocation = firstTile.getLocation();
int numRotations = findRotationsToSwapLocation(firstTileLocation, pivotTile);
int directionToPivot = findOutgoingDirection(firstTile, pivotTile.getLocation());
Location newLocation = HexUtil.getNeighborLocation(pivotTile.getLocation(), numRotations);
Location origLocation = pivotTile.getLocation();
numRotations = numRotations + 3 - directionToPivot;
Rotation tileRotation = firstTile.getRotation().rotateBy(numRotations);
TilePlacement previousTilePlacement = new TilePlacement(firstTile.getTile(), newLocation, tileRotation);
tiles.add(previousTilePlacement);
// this part almost the same as reverser
for (int i=1; i<subPathTiles.size(); i++) {
TilePlacement currentTile = subPathTiles.get(i);
newLocation = findOtherOutgoingLocation(previousTilePlacement, origLocation);
Rotation tileRotation1 = currentTile.getRotation().rotateBy(numRotations);
TilePlacement currentTilePlacement = new TilePlacement(currentTile.getTile(), newLocation, tileRotation1);
assert fits(currentTilePlacement, previousTilePlacement) :
" current=" + currentTilePlacement +" (" + i +") did not fit with " + previousTilePlacement
+ " when swapping " + subPath + " at pivot = "+ pivotTile + " with primColor = " + primaryColor
+ " The outgoing locations from curent are " + currentTilePlacement.getOutgoingPathLocations(primaryColor);
tiles.add(currentTilePlacement);
origLocation = previousTilePlacement.getLocation(); //currentTilePlacement.getLocation();
previousTilePlacement = currentTilePlacement;
}