Struct
IpuzCell
Description [src]
struct IpuzCell {
/* No available fields */
}
An opaque data type containing the information for an individual
IpuzGrid
cell.
Cells are always created by a IpuzGrid
and aren’t intended
to exist independently.
Representation
Cells are found in three fundamental types as defined by
IpuzCellType
:
-
IpuzCellType
— A regular light cell -
IpuzCellType
— A block -
IpuzCellType
— An omitted cell
Cells also have a number of fields associated with them. They are:
-
number
: The number associated with the cell -
label
: An alternative to number, in string form -
solution
: The target answer for the puzzle -
initial val
: A string representing a pre-filled value.
The inline images above indicate how a cell could be rendered for crossword-style puzzles. However, each puzzle kind defines how the fields are interpreted. Not every puzzle kind uses every field. Please see the Representation section located in each class’s documentation for more information.
As an example of how things can vary, for IpuzCrossword
the number
field refers to the clue number associated with that
cell (as shown above). For sudoku puzzles, it’s the number solution
in the grid. It is never used with IpuzAcrostic
or
IpuzNonogram
puzzles.
Info
Since cells are semantically undefined, the IpuzCell
setters don’t do any type of validation. It is very possible to
get a cell into a state that is undefined for a given puzzle
kind. As an example, one can set the label
on a cell with a
cell_type
of IpuzCellType
, despite it being
meaningless in all known puzzle kinds.
Links to other structs
Cells keep a reference to the styles and clues associated to
them. It’s possible to look these up by calling
ipuz_cell_get_clue()
and ipuz_cell_get_style()
respectively.
Warning
Cells don’t automatically maintain the styles or clues
associated with them. When modifying a puzzle, care must be
taken to keep these in sync with the rest of the puzzle. The
_fix()
functions generally do this.
Instance methods
ipuz_cell_get_clue
Returns the clue associated with cell
in the direction
direction. If not such clue exists, then NULL
is returned.
ipuz_cell_set_style
Sets the style for a given cell. As a convenience, it’s possible to
set the style_name at the same time when style
is a named style.