Class

IpuzAcrostic

Description [src]

class Ipuz.Acrostic : Ipuz.Crossword
  implements Ipuz.Clues {
  /* No available fields */
}

An acrostic is a quote-based word puzzle. It consists of two parts: a grid containing a quote, and a list of clues. Each cell in the grid has a label and corresponds to one of the cells in a clue. The puzzle can be solved by a combination of guessing words in the quote and solving the clues.

Example of an acrostic Example of a solved acrostic

Entering a guess in either the grid or clue will also guess in its corresponding cell. For example. in the example above, the A at the cursor is being guessed at cell 152A, which is in both the clues and the grid.

As an additional solving aid, the first letter of all the solved clues spells out the title and/or author of the work. This acrostic hint gives the puzzle kind its name. In the example above, the first letter of each answer spells out David Halberstam / The Amateurs, which is the author and title of the work the quote came from.

Representation

Grid

Similar to a crossword, the IpuzCellType is used to determine whether an IpuzCell is a block or guessable. Within a cell, the label and solution fields are used. An IpuzCellType cell could indicate a shaped acrostic, though that is traditionally not used. Similarly, styles are possible but also non-traditional.

There is an IpuzAcrostic:quote property that corresponds to the solution of the grid. This property can be used to provide a user-visible description of the quote. The solution of the grid is constrained to the IpuzPuzzle:charset of the puzzle.

The quote property and grid can be kept in sync with each other through ipuz_acrostic_fix_quote().

Clues

The clues are all of direction IpuzClueDirection. Unlike crosswords, the cells of each clue are not consecutive, but are placed arbitrarily across the grid. When being rendered, the label of the cells of each clue should be extracted from the source clue.

In addition, there is an IpuzAcrostic:source property that corresponds to the first letter of each clue. It spells out the source of the quote — some combination of the author or title.

The source property and clues can be kept in sync with each other through ipuz_acrostic_fix_source().

In addition to the clues, there is a special quote clue that represents the full grid. See ipuz_acrostic_get_quote_clue() for more details.

Guesses

Only IpuzCellType cells are considered with an IpuzGuesses. The string there will be compared to the solution field.

Acrostic puzzles also support using a checksum instead of having a solution.

Editing

The easiest way to create an acrostic is to set the quote and the source, and then use the fix functions to make it work. For example, consider this block:

IpuzPuzzle *acrostic;
const gchar *quote =
  "The time has come, the Walrus said, "
  "To talk of many things: "
  "Of shoes — and ships — and sealing-wax — "
  "Of cabbages — and kings — "
  "And why the sea is boiling hot — "
  "And whether pigs have wings.";
const gchar *source = "Lewis Carroll";

// Note, generating the answers is outside the scope of libipuz
g_autoptr (GArray) answers = generate_answers (quote, source);

acrostic = ipuz_acrostic_new ();
ipuz_acrostic_set_quote (IPUZ_ACROSTIC (acrostic), quote);
ipuz_acrostic_set_source (IPUZ_ACROSTIC (acrostic), source);

// Change the grid to match the quote and label it correctly
ipuz_acrostic_fix_quote (IPUZ_ACROSTIC (acrostic),
                         IPUZ_ACROSTIC_SYNC_STRING_TO_PUZZLE);

// Change the clue count to match the source
ipuz_acrostic_fix_source (IPUZ_ACROSTIC (acrostic),
                          IPUZ_ACROSTIC_SYNC_STRING_TO_PUZZLE);

// Set answers to all clues. Answers is a GArray of strings,
// collectively containing each letter in quote
ipuz_acrostic_set_answers (IPUZ_ACROSTIC (acrostic), answers);

// update the labels to match the clues
ipuz_acrostic_fix_labels (IPUZ_ACROSTIC (acrostic));

This will generate the following grid:

Grid generated by the code example Grid generated by the code example

Implements

Constructors

ipuz_acrostic_new

Returns a newly created acrostic puzzle.

Instance methods

ipuz_acrostic_fix_labels

Updates the labels of the cells in the grid to match the clues.

ipuz_acrostic_fix_quote

Makes sure that grid and quote string are in sync.

ipuz_acrostic_fix_source

Makes sure that clues and source string are in sync.

ipuz_acrostic_get_quote

Returns the quote of self as a displayable string.

ipuz_acrostic_get_quote_clue

Returns the quote clue associated with the acrostic.

ipuz_acrostic_get_source

Returns the source of self as a displayable string.

ipuz_acrostic_set_answers

This will map the cells of the clues in self to cells in the grid.

ipuz_acrostic_set_quote

Sets the quote of the puzzle. This is a human-displayable representation of the grid.

ipuz_acrostic_set_source

Sets the source of the puzzle. Traditionally it is some combination of the author and the title of the work. This is a human-displayable representation.

Methods inherited from IpuzCrossword (15)
ipuz_crossword_check_mirror
No description available.

ipuz_crossword_clue_continues_down
No description available.

ipuz_crossword_clue_continues_left
No description available.

ipuz_crossword_clue_continues_right
No description available.

ipuz_crossword_clue_continues_up
No description available.

ipuz_crossword_fix_all
No description available.

ipuz_crossword_fix_clues
No description available.

ipuz_crossword_fix_enumerations
No description available.

ipuz_crossword_fix_numbering
No description available.

ipuz_crossword_fix_styles
No description available.

ipuz_crossword_fix_symmetry

Enforce the board symmetry of the cells in coords in the direction of symmetry. That is to say, go through each cell in coords and make sure that the appropriate cell at the point(s) of symmetry have the same IpuzCellType.

ipuz_crossword_get_solution_chars
No description available.

ipuz_crossword_get_symmetry

Calculates the symmetry of self. Note, there can be multiple valid calculations for a board. For example, we can’t say anything at all about the symmetry for a blank, square board. This function returns the first one that matches.

ipuz_crossword_mirror_cell
No description available.

ipuz_crossword_print
No description available.

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.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from IpuzClues (18)
ipuz_clues_add_clue_set

Adds a new clue set to clues. This clue set will be in the direction of direction, and will be empty. If label is set, then it will set the label of the newly created clue set.

ipuz_clues_clear_clue_sets

Removes all the clues and clue sets of clues.

ipuz_clues_clue_guessed

Returns TRUE if clue has a user guess for every cell. If all the user guesses are correct, then correct is set to TRUE as well.

ipuz_clues_clue_set_get_dir

Returns the direction of the clueset at index.

ipuz_clues_clue_set_get_label

Returns the label of the clueset at direction.

ipuz_clues_find_clue_by_coord

[ RETHINK THIS FUNCTION. CANT WE GET IT FROM THE CELL?]

ipuz_clues_find_clue_by_label

Searches for and returns the clue with direction and label.

ipuz_clues_find_clue_by_number

Searches for and returns the clue with direction and number.

ipuz_clues_foreach_clue

Calls func for each IpuzClue in clues.

ipuz_clues_get_clue_by_id

Returns the clue at clue_id, or NULL.

ipuz_clues_get_clue_string_by_id

Returns a string containing the solution of the puzzle for a given clue. This string will have ‘?’ characters embedded within it if there are cells without solutions set yet.

ipuz_clues_get_clues

Returns an array of all clues in the direction of direction.

ipuz_clues_get_guess_string_by_id

Returns a string containing the guess in the puzzle for a given clue. This string will have ‘?’ characters embedded within it if there are cells not completely filled out.

ipuz_clues_get_id_by_clue

Finds the IpuzClueId of clue within clues.

ipuz_clues_get_n_clue_sets

Returns the number of clue sets associated with clues.

ipuz_clues_get_n_clues

Returns the number of clues in direction.

ipuz_clues_remove_clue

Removes clue from clues. The clue will also be unlinked from the grid.

ipuz_clues_remove_clue_set

Removes the clue set in the direction of direction. All the clues associated with that clue set will be unreffed.

Properties

Ipuz.Acrostic:quote

Human readable string representing the quote of the puzzle.

Ipuz.Acrostic:source

Human readable source representing the author and/or title of the quote.

Properties inherited from IpuzCrossword (2)
Ipuz.Crossword:clue-placement
No description available.

Ipuz.Crossword:showenumerations
No description available.

Properties inherited from IpuzGrid (3)
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 IpuzAcrosticClass {
  IpuzCrosswordClass parent_class;
  
}
No description available.
Class members
parent_class: IpuzCrosswordClass
No description available.