KDL: Kakuro Description Language

by Dave Aronson


A KDL file describes one complete Kakuro puzzle. It consists of lines, each one describing a sum, using the following items:

  1. The X coordinate (i.e., column) of the start of the digits, starting at 1 from the left side of the puzzle
  2. The Y coordinate (i.e., row) of the start of the digits, starting at 1 from the top of the puzzle
  3. Either a dash (-) or a vertical bar (|), to tell whether the sum runs across or down, respectively, so it's language-independent
  4. The length of the sum, i.e., the number of digits
  5. The number that the digits should sum to

That's it! There is no need to describe the puzzle overall; a KDL parser should be able to figure out the total X and Y size of the puzzle.

There may be any amount of whitespace between these elements. KDL files may also have blank lines, and comments (which start with a # sign). For instance, the file:

# This is a comment.
# The next line is blank.

# column 2, row 1, across, 2 digits, summing to 5
2 1 - 2 5

# column 1, row 2, across, 3 digits, summing to 7; get the idea now?
 1  2   -    3     7

# This is another comment

1 3 - 3 15
# All the whitespace on the line below, is tabs
1	2	|	2	7
2 1 | 3 7
3 1 | 3 13

# The lines above and below are blank... except for some whitespace.

would produce a puzzle that looks as follows:
_________________
|***|***|\  |\  |
|***|***| \ | \ |
|***|***|_7\|13\|
|***|\ 5|   |   |
|***| \ |   |   |
|***|_7\|___|___|
|\ 7|   |   |   |
| \ |   |   |   |
|__\|___|___|___|
|\15|   |   |   |
| \ |   |   |   |
|__\|___|___|___|
and would be solved as follows:
_________________
|***|***|\  |\  |
|***|***| \ | \ |
|***|***|_7\|13\|
|***|\ 5|   |   |
|***| \ | 2 | 3 |
|***|_7\|___|___|
|\ 7|   |   |   |
| \ | 2 | 4 | 1 |
|__\|___|___|___|
|\15|   |   |   |
| \ | 5 | 1 | 9 |
|__\|___|___|___|


[ Home ]|[ Dave's Software ]|[ Email ]