docs: add notes on clue numbering

This commit is contained in:
Marc Cataford 2020-08-03 18:28:14 -04:00
parent c3cf933ca1
commit 299d0b6c58

View file

@ -26,3 +26,20 @@ The body of the puzzle starts consistently at offset `0x34`.
|Solution|`0x34`|`width * height`|Based on the height and width, the solution is written out as ASCII.| |Solution|`0x34`|`width * height`|Based on the height and width, the solution is written out as ASCII.|
|Layout|(end of the solution)|`width * height`|The layout of the grid is defined with `.` used as "empty cell"| |Layout|(end of the solution)|`width * height`|The layout of the grid is defined with `.` used as "empty cell"|
|Clues|(end of the layout)|???|`NUL` separated strings containing each of the clues, not numbered.| |Clues|(end of the layout)|???|`NUL` separated strings containing each of the clues, not numbered.|
#### Clue numbering and tagging
The file doesn't contain information in which cells correspond to across and down clues. This information can be derived from the puzzle layout and the set of clues available:
```
FOREACH cell IN grid:
IF cell has a non-empty top neighbour
THEN the cell is part of its top neighbour's down word
ELSE the cell is part of the next available down word
IF cell as a non-empty left neighbour
THEN the cell is part of its left neighbour's across word
ELSE the cell is part of the next available across word
```
By picking off clues from the across and down clue lists, assigning them using the algorithm above and numbering them as you go, you can build the correct cell <> clue mappings.