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:

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.

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_build
No description available.

ipuz_cell_clear_clue_direction

Clears the clue in the direction direction.

ipuz_cell_clear_clues

Removes all clues associated with cell.

ipuz_cell_equal

Compares two cells and returns TRUE if they are identical.

ipuz_cell_get_cell_type

Returns the IpuzCellType of cell.

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_get_initial_val

Returns the initial value of cell.

ipuz_cell_get_label

Returns the label of cell.

ipuz_cell_get_number

Returns the number for cell.

ipuz_cell_get_saved_guess

Returns the saved guess of cell.

ipuz_cell_get_solution

Returns the solution of cell.

ipuz_cell_get_style

Returns the current style of cell, or NULL.

ipuz_cell_get_style_name

Returns the style_name of cell.

ipuz_cell_parse_puzzle
No description available.

ipuz_cell_parse_solution
No description available.

ipuz_cell_ref

Refs the cell.

ipuz_cell_set_cell_type

Sets the IpuzCellType of cell to be cell_type.

ipuz_cell_set_clue

Sets the clue associated with cell in the direction direction.

ipuz_cell_set_initial_val

Sets the initial value of cell.

ipuz_cell_set_label

Sets the label of cell.

ipuz_cell_set_number

Sets the number of cell.

ipuz_cell_set_saved_guess

Sets the saved guess of cell.

ipuz_cell_set_solution

Sets the solution of cell.

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.

ipuz_cell_set_style_name

Sets the style_name of cell.

ipuz_cell_unref

Unrefs cell, which will be freed when the reference count reaches 0.