Documentation
¶
Index ¶
- func RenderPNG(c *Crossword, width, height int, opts ...RenderOption) (*gg.Context, error)
- func RenderText(cw *Crossword, opts ...RenderOption) string
- type Cell
- type Crossword
- type Generator
- type GeneratorOpt
- type Grid
- type Placement
- type RenderOption
- func WithAllSolved(solveAll bool) RenderOption
- func WithBackgroundColor(cl color.Color) RenderOption
- func WithBorder(width int) RenderOption
- func WithClueColor(color color.Color) RenderOption
- func WithClueFontSize(size float64) RenderOption
- func WithClues(clues bool) RenderOption
- func WithLabelColor(cl color.Color) RenderOption
- func WithRandomSolved() RenderOption
- func WithWordBackgroundColor(cl color.Color) RenderOption
- func WithWordColor(cl color.Color) RenderOption
- func WithWordFontSize(size float64) RenderOption
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderText ¶
func RenderText(cw *Crossword, opts ...RenderOption) string
Types ¶
type Crossword ¶
func Generate ¶
func Generate(gridSize int, words []Word, attempts int, opts ...GeneratorOpt) *Crossword
func (*Crossword) CellPlacements ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
type GeneratorOpt ¶ added in v1.2.0
type GeneratorOpt func(opts *generatorOpts)
func WithAllAttempts ¶ added in v1.4.0
func WithAllAttempts(allAttempts bool) GeneratorOpt
WithAllAttempts will prevent return until all attempts have been exhausted. The result with the most crossed words will be returned.
func WithKeepSpecialCharacters ¶ added in v1.2.0
func WithKeepSpecialCharacters(keep bool) GeneratorOpt
func WithRevealFirstLetterOfEachWord ¶ added in v1.2.0
func WithRevealFirstLetterOfEachWord(reveal bool) GeneratorOpt
type Placement ¶
type RenderOption ¶ added in v1.1.0
type RenderOption func(opts *renderOpts)
func WithAllSolved ¶ added in v1.1.0
func WithAllSolved(solveAll bool) RenderOption
func WithBackgroundColor ¶ added in v1.3.0
func WithBackgroundColor(cl color.Color) RenderOption
func WithBorder ¶ added in v1.3.0
func WithBorder(width int) RenderOption
func WithClueColor ¶ added in v1.5.0
func WithClueColor(color color.Color) RenderOption
func WithClueFontSize ¶ added in v1.6.2
func WithClueFontSize(size float64) RenderOption
func WithClues ¶ added in v1.5.0
func WithClues(clues bool) RenderOption
func WithLabelColor ¶ added in v1.3.0
func WithLabelColor(cl color.Color) RenderOption
func WithRandomSolved ¶ added in v1.5.0
func WithRandomSolved() RenderOption
func WithWordBackgroundColor ¶ added in v1.3.0
func WithWordBackgroundColor(cl color.Color) RenderOption
func WithWordColor ¶ added in v1.3.0
func WithWordColor(cl color.Color) RenderOption
func WithWordFontSize ¶ added in v1.6.5
func WithWordFontSize(size float64) RenderOption
type Word ¶
type Word struct {
Word string
Clue string
Label *string
// The number of letters in the original words(s). Since they are concatinated, we need this
// to know the letter counts for multiple words.
LettersCounts []int
// CharacterHints allows subset of characters to be revealed (e.g. []int{0} would reveal
// the first char of a word by default)
CharacterHints []int
}
func WordsFromCSV ¶ added in v1.3.0
WordsFromCSV creates a word list from a CSV with 2 columns (word, clue) todo: update to support multiple words in the "word"
func (Word) LetterCountStr ¶ added in v1.6.0
Click to show internal directories.
Click to hide internal directories.