The following image shows a solution. This is a solution based on the ‘XOR’ function. In this case, the value of a tile is not dependent on its own state; it is only dependent on the state of both the neighbours. If exactly one neighbour is black the cell will be black.