# Herman Hiddema / Problem Encoding

Sub-page of HermanHiddema

Is there an easy way to "encode" problems, so that they yield a unique strings?

Patrick Traill: Herman, having edited this, I have just realised that this is your personal sub-page, so please feel free to revert / remove my contributions if they are unwanted.

 Table of contentsAn attempt Example How long can this get? Table of diagramsPosition to encode Position to encode, stripped

Patrick Traill: Depending how unique you want to get, you may need to impose some conventions to exclude symmetrically equivalent positions.

## An attempt

Patrick Traill: The following convention encodes positions rather than problems, as it does not specify either who is to move or what is to be achieved. In principle one, should also specify what rules apply.

1. Two characters, indicating the size of the problem in both directions, smallest first, with 136 encoded as 09,AZ.
2. One character indicating the type:
1. Corner problem
2. Edge problem (largest dimension along edge)
3. Edge problem (smallest dimension along edge)
4. Whole side problem (largest dimension along edge)
5. Whole side problem (smallest dimension along edge)
6. Whole board problem
3. The remaining characters encode the points in the board in groups of three according to the following table, where . stands for an empty point.
```- = ...
A = ..B
B = ..W
C = .B.
D = .BB
E = .BW
F = .W.
G = .WB
H = .WW
I = B..
J = B.B
K = B.W
L = BB.
M = BBB
N = BBW
O = BW.
P = BWB
Q = BWW
R = W..
S = W.B
T = W.W
U = WB.
V = WBB
W = WB.
X = WW.
Y = WWB
Z = WWW
```

Patrick Traill: Specifying largest/smallest dimension along edge (for types 2/3 and 4/5) is ambiguous when the dimensions are equal. I propose specifying first/second dimension along edge.

### Example

Encoding does not encode empty space around it, so actually encodes:

Which is:

```. W B . . B
. . . W W B
W W W B B B
B B B B . .
```

Encoded:

```G A
- Y
Z M
M I
```

So, adding sizes (4x6) and type (corner), we get:

```461GA-YZMMI
```

### How long can this get?

The first three characters are always present, and after that, there is one character per 3 points on the board. So a 9x9 corner problem (81 intersections) is encoded as 30 characters.

For 19×19 = 361 intersections one needs 124 characters and for the maximum (36×36) one needs 3 + (36×36) = 3 + 1296 / 3 = 435 characters :)

 The usual order is width×height and not small×large.

Herman Hiddema / Problem Encoding last edited by PJTraill on January 7, 2019 - 13:45