EDIT: Started writing this yesterday and saw there were a couple of answers today. My answer is basically the same, but uses squares instead of rows. Meh. Leaving it here for people to look at if they are interested, but give your votes to others who answered first, and in some cases, more completely.
Yes, the puzzle is always solvable for an 8x8 board with 3 colours.
Lets assign numbers to all the colours. Then the moves become:
- $0+1 \implies 2\times 2$
- $1+2 \implies 2\times 0$
- $2+0 \implies 2\times 1$
Now, lets create a value $S$ which is the score of the board. This value is simply the sum of all the squares modulo 3.
Notice that each move will never affect the score. For example, if your score is $S$ and you make the first move, then you replace a $0$ and a $1$ with two $2$s. The new score is $$\left(S-(1+0)+(2+2)\right) \text{ mod } 3 =S+3 \text{ mod } 3 = S$$
Thus, none of the moves will ever change the score.
So, to solve, simply calculate the score $S$ of the board. Notice that
- $(64 \times 0) \text{ mod } 3 = 0$
- $(64 \times 1) \text{ mod } 3 = 1$
- $(64 \times 2) \text{ mod } 3 = 2$
Thus, the score $S$ tells you which colour can be used to achieve the result.
How to Solve
To solve, you don't even need to know the final colour - it will be made for you. However, this isn't terribly efficient in that it converts regions to colours and then converts the entire region to a different colour. In any event, it works.
This solution only works for boards of size $2^n$. It works by creating larger and larger squares which are homogeneous. At the end, you have an 8x8 square. It can probably be generalized to larger boards.
Phase 1
At the end of this phase, you will have 16 2x2 squares arranged in a 4x4 pattern.
Phase 1.1
First, lets partition the board into 32 2x1 horizontal rectangles starting at the upper left. If the two squares within this rectangle are different, then make a move involving both. You will now have 32 coloured 2x1 dominoes arranged 4x8.
For example:
1200... 0000...
0111... --> 2211...
... ...
Phase 1.2
Now repeat the phase 1.1 vertically.
1200... 0000... 1122...
0111... --> 2211... 1122...
... ... ...
Phase 2
At the end, you will have four 4x4 squares arranged 2x2.
Phase 2.1
Consider two adjacent 2x2 squares made in the previous phase. We will now make 1 horizontal move at their boundary. We will then make 2 vertical moves on either side of the boundary.
Then, repeat phase 1.1 on the region.
Like so:
horizontal move Repeat phase 1
| |
0011 --> 0221 --> 0101 --> 2222
0011 0011 | 0101 2222
|
Two vertical
moves
Phase 2.2
Now rotate the board 90 degrees and repeat phase 2.2.
Phase 3 - Final phase
Phase 3.1
Lets look at a single 1x8 row. Start by making a move in the middle (the only valid move, 4th and 5th colums). Now repeat phase 1.1 on the row. This will only have the effect on the 3rd and 4th columns and on the 5th and 6th columns. At the end, we will have effectively reversed the middle section.
.... .... ...
00001111 --> 00022111 --> 00110011
.... .... ...
So, now run through phase 2.1 on the entire board. This will recombine 2x2 squares back into 4x4 squares.
Phase 3.2
Rotate the board 90 degrees and repeat phase 3.1.
Example
Lets start with a random board. Phase 1 is easy.
Phase 1.1 Phase 1.2
12001020 00002211 11002211
01122202 22002211 11002211
01002010 22001122 00111100
20102020 --> 11221111 --> 00111100
11111010 11112222 11002200
02010102 11222211 11002200
10201020 22112211 11221100
12211201 00000022 11221100
For phase 2, we need to break it into steps. First, we will make all the horizontal moves. These occur in the 2nd and 3rd column, and the 6th and 7th column. We will do them in the odd numbered rows.
Then, we will make the vertical moves in the 2nd, 3rd, 6th, and 7th columns. Lastly, we run Phase 1.1 on the lot.
Horizontal Vertical Phase 1.1
Moves Moves
11002211 12202001 10102121 22220000
11002211 11002211 10102121 22220000
00111100 02211220 01011010 22222222
00111100 --> 00111100 --> 01011010 --> 22222222
11002200 12202110 10102020 22221111
11002200 11002200 10102020 22221111
11221100 10021220 12121010 00002222
11221100 11221100 12121010 00002222
Then we rotate and repeat.
Vertical Horizontal Phase 1.2
Moves Moves (since board is rotated)
22220000 22220000 22220000 22221111
22220000 22221010 22222222 22221111
22222222 22221212 22220000 22221111
22222222 --> 22222222 --> 22222222 22221111
22221111 22221111 22221111 11110000
22221111 21210101 00002222 11110000
00002222 01010202 22221111 11110000
00002222 00002222 00002222 11110000
Phase 3 starts by making horizontal moves down the middle and then on either side. Then we run Phase 2.1.
Phase 2.1
Horizontal Vertical
Middle Side Moves Moves Phase 1.1
22221111 22200111 22112211 20012001 21212121 00000000
22221111 22200111 22112211 22112211 21212121 00000000
22221111 22200111 22112211 20012001 21212121 00000000
22221111 -> 22200111 -> 22112211 -> 22112211 21212121 00000000
11110000 11122000 11001100 12201220 10101010 22222222
11110000 11122000 11001100 11001100 10101010 22222222
11110000 11122000 11001100 12201220 10101010 22222222
11110000 11122000 11001100 11001100 10101010 22222222
Now rotate and repeat.
Phase 2.2 (due to rotation)
Horizontal Vertical
Middle Side Moves Moves Phase 1.2
00000000 00000000 00000000 00000000 00000000 22222222
00000000 00000000 00000000 20202020 11111111 22222222
00000000 00000000 11111111 21212121 00000000 22222222
00000000 -> 22222222 -> 11111111 -> 11111111 -> 11111111 -> 22222222
11111111 22222222 00000000 00000000 00000000 22222222
11111111 11111111 00000000 20202020 11111111 22222222
11111111 11111111 11111111 21212121 00000000 22222222
11111111 11111111 11111111 11111111 11111111 22222222
General Solution
Note that if the number of squares is a multiple of 3 (e.g. in a 6x8 board, or in a 9x9 board), then only boards with scores $S=0$ would be solvable, in any colour. All other boards would be intractable. The method above would not work as it is since it is only for boards of size $2^n$.