Class

IpuzGrid

Description [src]

class Ipuz.Grid : Ipuz.Puzzle
{
  /* No available fields */
}

IpuzGrid is the base class for all grid-like puzzles. It is used to access the IpuzCell of a given puzzle kind, and is indexed by IpuzCellCoord.

Guesses

One can associate an IpuzGuesses with a grid through ipuz_grid_set_guesses(). The guesses struct is mainly intended to represent a user play-through of a game, though can be used to store other information per-cell as well.

Here’s an example of how you would create and set the guesses on a grid.

g_autoptr (IpuzGuesses) guesses;

guesses = ipuz_grid_create_guesses (grid);
ipuz_grid_set_guesses (guesses);

If you’re using guesses with a grid that’s being edited, you should use ipuz_grid_fix_guesses() to keep them in sync. As an example:

g_autoptr (IpuzGuesses) guesses;

guesses = ipuz_grid_create_guesses (grid);
ipuz_grid_set_guesses (grid, guesses);

...

ipuz_grid_resize (grid, new_width, new_height);
ipuz_grid_fix_guesses (grid);
// guesses is updated to match grid

g_assert_cmpint (ipuz_guesses_get_width (guesses), ==, new_width);

Ancestors

Instance methods

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.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Ipuz.Grid:guesses
No description available.

Ipuz.Grid:height
No description available.

Ipuz.Grid:width
No description available.

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.

Class structure

struct IpuzGridClass {
  IpuzPuzzleClass parent_class;
  gboolean (* check_cell) (
    IpuzGrid* grid,
    IpuzCell* cell,
    const IpuzCellCoord* coord,
    IpuzGuesses* guesses,
    IpuzGridCheckType check_type
  );
  
}
No description available.
Class members
parent_class: IpuzPuzzleClass
No description available.
check_cell: gboolean (* check_cell) ( IpuzGrid* grid, IpuzCell* cell, const IpuzCellCoord* coord, IpuzGuesses* guesses, IpuzGridCheckType check_type )
No description available.

Virtual methods

Ipuz.GridClass.check_cell

Invokes the operation determined by check_type on cell and guesses at coord.