Class
IpuzNonogram
Description [src]
class Ipuz.Nonogram : Ipuz.Grid
{
/* No available fields */
}
A nonogram is a picture-based logic puzzle in which the player uses hints on the edge of the puzzle to reveal a picture.
Example of a solved nonogram
Nonograms can either be monochrome or have color groups. Monochrome
puzzles are more common, but both are suppported. Color nonograms
are represented by IpuzNonogramColor
, which is a subclass
of IpuzNonogram
.
Representation
The IpuzCellType
is used to determine whether an
IpuzCell
is filled in or blank. If it’s a BLOCK
, then
it’s filled in, while NORMAL
indicates a blank cell. A NULL
cell
could indicate a shaped puzzle, though is not traditionally used
with nonograms. In addition, the solution
field is set to
IpuzPuzzle:block
, though can generally be ignored with
monochromatic puzzles.
Other fields in the cell are undefined, as is IpuzStyle
.
See IpuzNonogramColor
for information on how color
nonograms are represented.
Guesses
When used with an IpuzGuesses
object, guesses are tested
against the string IpuzPuzzle:block
to indicate a
block was guessed correctly. Since implementations will want to
record additional information per-cell, any other guess string will
be ignored.
Editing
Nonograms have one fix function —
ipuz_nonogram_fix_clues()
. This should be called after any
changes to block polarity or grouping. It will update the internal
clues and styles.
Note that not every grid can be uniquely solved as a nonogram. Some nonogram puzzles can result in multiple valid solutions. When creating a nonogram, care must be taken to be sure it’s solvable.
Note
Nonogram puzzles are currently a libipuz-only extension. As such, it’s not expected that any other program will be able to parse them.
Instance methods
ipuz_nonogram_get_cells_by_group
Returns all the cells that are set to group
. For monochrome
nonograms, the group should be IpuzPuzzle:block
.
ipuz_nonogram_get_clues
Returns an array containing the run of IpuzNonogramClue
indicated by index
and direction
.
Methods inherited from IpuzGrid (10)
ipuz_grid_check_cell
Invokes the operation determined by check_type
on cell
and
guesses
at coord
.
ipuz_grid_create_guesses
Creates a fresh IpuzGuesses
. It will be initialized to
the current state of the grid.
ipuz_grid_fix_guesses
Fixes the guesses associated with self
. The result will be a
playable IpuzGuesses
struct.
ipuz_grid_foreach_cell
Calls func
for each IpuzCell
in self
.
ipuz_grid_get_cell
Retrieves the cell at coord
. If the coordinates are
outside the bounds of the grid then NULL
will be returned.
ipuz_grid_get_guesses
Returns the IpuzGuesses
associated with self
.
ipuz_grid_get_height
Returns the number of rows in self
.
ipuz_grid_get_width
Returns the number of columns in self
.
ipuz_grid_resize
Resizes self
to the new size.
ipuz_grid_set_guesses
Sets guesses
for self
. If there’s a mismatch in the cell types
between guesses
and self
then FALSE
is returned. guesses
will
be set regardless of the return value.
Methods inherited from IpuzPuzzle (55)
Please see IpuzPuzzle for a full list of methods.
Properties
Properties inherited from IpuzGrid (3)
Ipuz.Grid:guesses
Ipuz.Grid:height
Ipuz.Grid:width
Properties inherited from IpuzPuzzle (24)
Ipuz.Puzzle:annotation
Non-displayed annotation.
Ipuz.Puzzle:author
Author of the puzzle.
Ipuz.Puzzle:block
The text value that represents a block in the saved file.
Ipuz.Puzzle:charset
Characters that can be entered in the puzzle. Setting this
explicitly will override the charset defined by
IpuzPuzzle:locale
.
Ipuz.Puzzle:charset-str
Characters that can be entered in the puzzle, in string form.
Setting this explicitly will override the charset defined by
IpuzPuzzle:locale
.
Ipuz.Puzzle:copyright
Copyright information for the puzzle.
Ipuz.Puzzle:date
Date of puzzle or publication date.
Ipuz.Puzzle:difficulty
Difficulty of the puzzle. Advisory only, as there is no standard for difficulty.
Ipuz.Puzzle:editor
Editor of the puzzle.
Ipuz.Puzzle:empty
Text value that represents an empty cell.
Ipuz.Puzzle:explanation
Text to be displayed after a successful solve.
Ipuz.Puzzle:intro
Text displayed above the puzzle.
Ipuz.Puzzle:license
License of the puzzle.
Ipuz.Puzzle:locale
Locale of the puzzle.
Ipuz.Puzzle:notes
Notes about the puzzle.
Ipuz.Puzzle:origin
Program-specific information about the program that wrote the puzzle file.
Ipuz.Puzzle:publication
Bibliographic reference for a published puzzle.
Ipuz.Puzzle:publisher
Name and/or reference for a publisher.
Ipuz.Puzzle:puzzle-kind
The kind type of the puzzle.
Ipuz.Puzzle:styles
A GHash
table containing all the named styles for the puzzle. These can be added or removed by calling ipuz_puzzle_set_style()
Ipuz.Puzzle:title
Title of the puzzle.
Ipuz.Puzzle:uniqueid
Globally unique identifier for the puzzle.
Ipuz.Puzzle:url
Permanent URL for the puzzle.
Ipuz.Puzzle:version
Version of the ipuz spec used for the puzzle.
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.