Nonogram Solver



XML format for Nonogram puzzles

This format is in development and is not currently supported!

Here's an XML-based format used elsewhere:

However, I've started to design my own XML format (below) so that a future solver will be able to deal with multicoloured and non-rectangular puzzles.

The top-level element <nonogram> has a matrix attribute which specifies the shape of the puzzle and its solution image. It can be:

rect

The image is rectangular, with two banks row (from top to bottom, block sizes listed from left to right) and col (columns from left to right, block sizes listed from top to bottom).

iso

The image is made up of triangles in an isometric grid. The banks are row (from top to bottom, block sizes listed from left to right), tlbr (oblique columns, with block sizes listed from top-left to bottom right, starting with the bottom-leftmost) and trbl (oblique columns, with block sizes listed from top-right to bottom left, starting with the top-leftmost). An additional dim dimension is required, giving the length of the top edge.

The puzzle consists of metadata, tile shapes/colours, and banks of block sizes/colours. Dimensions are derived from the banks, but extra dimensions can be specified. Elements within <nonogram> can be:

<meta>

Each of these specifies metadata for the puzzle, such as the author and title. The same metadata can be provided in multiple languages.

<dim>

Each of these specifies an additional dimension which cannot be determined from the banks.

<tile>

Each <tile> effectively defines a cell type (dot, solid, red, yellow, etc). The following attributes are defined:

key

This should be an English Latin letter A-Z which will be used in the puzzle's banks to identify a block as being of a particular colour. An empty key is permitted, meaning the default solid colour, which blocks of monochrome puzzle are made up of exclusively. The key ? specifies the appearance for unknown cells. A missing key specifies the appearance for dots.

fg

This specifies the foreground colour, as used by the various symbols, expressed in CSS format, e.g. #000. The default is black.

bg

This specifies the background colour, as used by the various symbols, expressed in CSS format, e.g. #fff. The default is white.

sym

This specifies the symbol to draw, and can be one of the following (solid being the default):

dot

The cell is filled with the background colour, then a dot is printed over it in the foreground colour.

solid

The cell is filled with the foreground colour.

blank

The cell is filled with the background colour.

The following tiles apply by default:

<tile key="?" sym="blank" />
<tile         sym="dot"   />
<tile key=""  sym="solid" />

Additional colours will usually be specified by (for red, for example):

<tile key="R" fg="#f00" />
<bank>

Each bank consists of line data. Each line datum is a comma-/dot-separated list of block data. Each block datum consists of a non-negative integer giving the length of the block, and an optional key (as specified by the <tile> elements) indicating its colour/shape. Given the following declaration:

<tile key="R" fg="#f00" />

…the following datum indicates a block of 3 in the default colour, and 4 red:

3,4R

Instead of a comma, whitespace separating two block data acts as a line-datum separator.

A length of zero shall only appear on a line datum by itself, and indicates a line with no blocks.

The length can be omitted if it is 1 and a key is specified.

<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE nonogram SYSTEM
"http://www.comp.lancs.ac.uk/~ss/nonogram/TR/nonogram.dtd">
<nonogram matrix="rect" xml:lang="en">
  <meta name="author">Hirofumi Fujiwara</meta>
  <meta name="title">Dog</meta>

  <bank name="row">
    3
    2,1
    1,1
    1,4
    1,1,1,1

    2,1,1,1
    2,1,1
    1,2
    2,3
    3
  </bank>

  <bank name="col">
    3
    2,1
    2,2
    2,1
    1,2,1

    1,1
    1,4,1
    1,1,2
    3,1
    4
  </bank>
</nonogram>