How about the following idea...
Examine each 1 that you have and calculate the number of adjacent 1's there are.
Find the 1 with the smallest number of adjacent 1's, you want to make that an X, and you want to make it an X by finding the 1 adjacent to this with the greatest number of adjacent 1s a -
A simple greedy algorithm that might be optimal?
To run it through your example:
Code:
0 0 0 0 1 0
0 0 0 1 1 1
0 0 1 1 1 0
1 1 1 1 1 0
0 0 0 1 1 1
Calculate the number of adjacent 1s
Code:
0 0 0 0 3 0
0 0 0 5 5 3
0 0 5 7 6 0
1 3 5 7 6 0
0 0 0 4 4 2
So the point with 1 neighbour needs to be an X and the adjacent square becomes a -
Code:
0 0 0 0 1 0
0 0 0 1 1 1
0 0 X 1 1 0
X - X 1 1 0
0 0 0 1 1 1
Now repeat the process, counting the neighbouring 1s
Code:
0 0 0 0 3 0
0 0 0 5 5 3
0 0 X 5 6 0
X - X 5 6 0
0 0 0 3 4 2
Now it is the 2 that becomes an X with the 6 becoming the -, hence:
Code:
0 0 0 0 1 0
0 0 0 1 1 1
0 0 X X X 0
X - X X - 0
0 0 0 X X X
Doesn't take much to work out that it will resolve in one more iteration with the final result being:
Code:
0 0 0 0 3 0
0 0 0 2 3 2
0 0 X X X 0
X - X X - 0
0 0 0 X X X
Code:
0 0 0 0 X 0
0 0 0 X - X
0 0 X X X 0
X - X X - 0
0 0 0 X X X
or
Code:
0 0 0 0 - 0
0 0 0 X X X
0 0 X X X 0
X - X X - 0
0 0 0 X X X
Resolving ties would be an issue, I'm not certain if it would matter...?