Class
IpuzNonogramColor
Description [src]
class Ipuz.NonogramColor : Ipuz.Nonogram
{
/* No available fields */
}
A color nonogram puzzle.
A nonogram is a picture-based logic puzzle in which the player uses hints on the edge of the puzzle to reveal a picture. Unlike a more traditional monochrome nonogram, color nonograms use different colors with its hints to reveal a multi-colored image.
Representation
The IpuzCellType
is used to determine whether a cell 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.
With color nonograms, if the cell is a block then the solution
field is set to a string to indicate which grouping the cell
belongs to. This grouping is also reflected in the
IpuzNonogramClue
segments. All other fields of
IpuzCell
(such as number and label) are ignored.
Color nonograms are expected to have a style with the same style_name as the group to indicate the color to be used with a given group. All other fields of the style are undefined. If a style with that name doesn’t exist, apps can choose an arbitrary color to define that group.
static void
paint_cell (IpuzPuzzle *puzzle,
IpuzCellCoord *coord)
{
IpuzCell *cell;
cell = ipuz_grid_get_cell (IPUZ_GRID (puzzle), coord);
if (ipuz_cell_get_cell_type (cell) == IPUZ_CELL_BLOCK)
{
IpuzStyle *style;
style = ipuz_cell_get_style (cell);
// If a puzzle doesn't have a style defined, then pick a random one for that group
if (style == NULL)
style = get_default_style (ipuz_cell_get_solution (cell));
// Do something with the color
paint_block_at_coord (coord, ipuz_style_get_bg_color (style));
}
}
Note that ipuz_puzzle_get_style()
can also return the style
for a style_group. This is useful when matching to a group with a
IpuzNonogramClue
.
Guesses
When used with an IpuzGuesses
object, guesses are tested
against the solution group. Since implementations will want to
record additional information per-cell, any guess not matching a
group indicator will be ignored.
Instance methods
Methods inherited from IpuzNonogram (6)
ipuz_nonogram_fix_clues
Fixes the clues of self
to match the current grid state.
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
.
ipuz_nonogram_get_group
Returns the group at index
.
ipuz_nonogram_get_n_groups
Returns the number of different groups within self
.
ipuz_nonogram_print
Prints self
to stdout. This method is meant to be used for debugging.
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.