Documentation ¶
Overview ¶
Package crossword provides functions to read crossword puzzles in the AcrossLite PUZ file format and render them as PDF files.
Index ¶
- func PuzzleBytes(s string) []byte
- func PuzzleString(s string) string
- type Checksums
- type Clue
- type Direction
- type Grid
- type IndexedPositions
- type IndexedStrings
- type IndexedWords
- type Key
- type Layout
- type LayoutScore
- type Layouts
- type Position
- type Puzzle
- func (p *Puzzle) Answer(x, y int) byte
- func (p *Puzzle) IsBlack(x, y int) bool
- func (p *Puzzle) IsCircled(x, y int) bool
- func (p *Puzzle) MakeGrid() Grid
- func (p *Puzzle) NewRenderContext(pdf *gofpdf.Fpdf) *RenderContext
- func (p *Puzzle) PositionNumber(pos Position) int
- func (p *Puzzle) Solution() string
- func (p *Puzzle) SolutionBytes() []byte
- func (p *Puzzle) SquareNumber(x, y int) int
- func (p *Puzzle) Unlock() (int, error)
- func (p *Puzzle) UnlockWithKey(k int) error
- type RenderContext
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PuzzleBytes ¶
func PuzzleString ¶
Types ¶
type Clue ¶
type Clue struct { // Clue numbers in increasing order. Numbers []int // Reverse map from clue number to index in Numbers. Indexes map[int]int // Clues indexed by their number. Clues IndexedStrings // Answers indexed by their number. Answers IndexedStrings // Positions[n] is the position of the square with number n. Positions IndexedPositions // Words[n] is the Word for answer number n, in left-right or top-down order. Words IndexedWords // Start[y][x] is clue number for the word that passes through square (x, y). // May be zero for uncrossed words in unusual puzzles. Start Grid }
Per-direction clue information.
type IndexedPositions ¶
type IndexedStrings ¶
type IndexedWords ¶
type Key ¶
type Key []uint8
Key stores a 4-digit decimal key in big-endian order, one digit per byte.
func NewKeyFromInt ¶
type Layout ¶
type Layout struct { NumColumns int PointSize float64 Score LayoutScore }
type LayoutScore ¶
type LayoutScore struct {
// contains filtered or unexported fields
}
func (LayoutScore) IsBetterThan ¶
func (a LayoutScore) IsBetterThan(b LayoutScore) bool
func (LayoutScore) Scalar ¶
func (a LayoutScore) Scalar() float64
Scalar calculates a single "goodness" score from the LayoutScore components.
func (LayoutScore) String ¶
func (a LayoutScore) String() string
type Layouts ¶
type Layouts []Layout
type Position ¶
func NewPosition ¶
type Puzzle ¶
type Puzzle struct { Header []byte Checksum Checksums Version string Author string Copyright string Title string Notepad string Width int Height int NumClues int AllClues []string Scrambled bool // Clue information indexed by direction. Dir []Clue // contains filtered or unexported fields }
func (*Puzzle) NewRenderContext ¶
func (p *Puzzle) NewRenderContext(pdf *gofpdf.Fpdf) *RenderContext
func (*Puzzle) PositionNumber ¶
PositionNumber(pos) is the number for the square at position pos, or 0.
func (*Puzzle) SolutionBytes ¶
func (*Puzzle) SquareNumber ¶
SquareNumber(x, y) is the number for square (x, y), or 0.
func (*Puzzle) UnlockWithKey ¶
type RenderContext ¶
type RenderContext struct { Layouts []Layout // in order of increasing NumColumns BestLayout int // contains filtered or unexported fields }
func (*RenderContext) Render ¶
func (r *RenderContext) Render()
func (*RenderContext) RenderAll ¶
func (r *RenderContext) RenderAll()
Click to show internal directories.
Click to hide internal directories.