From 299d0b6c58a101c86fa9d2425f19d8d1597c23e1 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Mon, 3 Aug 2020 18:28:14 -0400 Subject: [PATCH] docs: add notes on clue numbering --- format_specs.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/format_specs.md b/format_specs.md index a553613..1a63df2 100644 --- a/format_specs.md +++ b/format_specs.md @@ -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.| |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.| + +#### 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.