• Number each row of the board 0,...,7, with 0 for the TOP row.
• Number each column of the board 0,...,7, with 0 for the LEFT column.
• Write down the numbers of ONLY those rows that contains an ODD number of pieces. (You can always skip row 0 if you like, as it won’t make any difference if you include it or not in the steps that follow).
• Convert all those row numbers to three binary digits:
0 = 000
1 = 001
2 = 010
3 = 011
4 = 100
5 = 101
6 = 110
7 = 111
• Write the number you get by “adding up” the binary row numbers [of the rows containing an ODD number of pieces], WITHOUT carrying. For example, if you add 1+1+1=11 in binary, throw away the 1 on the left and just write down the sum as 1, for that column, then move on to the next column with nothing extra added.
• For a complete calculation, you’d have something like this:
If rows 2,3,4,7 had an ODD number of pieces:
010
011
100
111
---
010So the final result is 010 binary, which is 2 in decimal.
• Do exactly the same thing with the columns (skipping column 0 if you like): write down the numbers for the columns that contain an ODD number of pieces; convert them to three binary digits; add those binary digits WITHOUT carrying; convert the result back to a decimal number.
• The two results you obtained, for the rows and columns, give you the row number and column number of the secret square.
• Once you’re familiar with the method, it’s not hard to perform the same computations mentally. One approach would be to scan the board keeping a running total of the “sum” of the row numbers / column numbers where an odd number of items appear, rather than identifying those numbers first and trying to remember a whole list of them.
• Rather than memorising the binary digits for the numbers 1 to 7 and trying to mentally combine their bits, it can be easier to memorise the “addition” table between those 7 numbers. The pseudo-addition we are using is commutative, just like normal addition, so x+y = y+x for all pairs of numbers x and y, but it has the unusual property that x+x = 0 for any x, so if you ever “add” a number to itself, you are taken back to zero.
• The whole “addition” table for the numbers 1 to 7 can probably be learned most easily by memorising 7 triples of numbers that sum to zero:
(1,2,3), (1,4,5), (1,6,7), (2,4,6), (2,5,7), (3,4,7), (3,5,6)
Because of the rule x+x = 0, any two numbers in a triple of numbers that sum to zero will “add” to give the third number of the triple. So, written out in full, these triples correspond to these “additions”:
1+2+3 = 0
1+2 = 3
1+3 = 2
2+3 = 1
1+4+5 = 0
1+4 = 5
1+5 = 4
4+5 = 1
1+6+7 = 0
1+6 = 7
1+7 = 6
6+7 = 1
2+4+6 = 0
2+4 = 6
2+6 = 4
4+6 = 2
2+5+7 = 0
2+5 = 7
2+7 = 5
5+7 = 2
3+4+7 = 0
3+4 = 7
3+7 = 4
4+7 = 3
3+5+6 = 0
3+5 = 6
3+6 = 5
5+6 = 3
The applet below generates random boards with examples of the decoding process.
The rows and columns are numbered in binary and decimal. Those beyond the 0th with an odd number of items are shown in black, with the others in grey. The green numbers are the cumulative sums-without-carry of all the odd-item row or column numbers so far, so the last of the green numbers in each case gives the row or column number of the secret square. (Rarely, there might be no odd numbers of items, and no green numbers at all; in that case the row or column number decodes to 0.)
We can think of the n-bit binary numbers as forming a mathematical structure known as a group, where the operation is the addition-without-carry described above. Mathematicians might call this group (Z2)n or (Z/2Z)n, but whatever we call it, the main things that matters are:
Now, the coding method could be phrased as “Number the squares from 0 to 63, and perform addition-without-carry on all the numbers of squares with pieces on them.” (In fact, that is exactly how the applet itself does the calculations.) But it’s much easier for most people to deal with row numbers and column numbers from 0 to 7, rather than square numbers from 0 to 63. Counting only rows and columns that contain an ODD number of pieces simplifies the calculations further.
Having encoded one square’s position as the sum-without-carry of all the pieces on the board, if we change the state of that particular square (either adding a piece if there is none, or removing a piece if one is present), the new value encoded is guaranteed to be 0, because either adding or subtracting the original sum from itself gives 0. That is why we need a group where every number is its own opposite.
So, if your friend decodes the square number encoded in the initial, random configuration of the board, and changes that square to make the encoded value 0, then whatever (single) change the guests make will then make the encoded value the square number of the square they changed. You can then decode that, and learn exactly what they did.