Documentation ¶
Overview ¶
Package crosswd provides a base for implementing crossword applications using data in the .puz format.
Index ¶
- Constants
- type Coord
- type Direction
- type Grid
- type Header
- type Puzzle
- func (p *Puzzle) Cksum() uint16
- func (p *Puzzle) Clue(pos Coord, dir Direction) string
- func (p *Puzzle) HeaderCksum() uint16
- func (p *Puzzle) MagicCksum() [8]byte
- func (p *Puzzle) NextCell(pos Coord, dir Direction, doSkip bool) Coord
- func (p *Puzzle) NextWord(pos Coord, dir Direction) Coord
- func (p *Puzzle) Read(r io.Reader) error
- func (p *Puzzle) Setup()
- func (p *Puzzle) Solve()
- func (p *Puzzle) TextCksum(cksum uint16) uint16
- func (p *Puzzle) Verify() bool
- func (p *Puzzle) WordExtent(pos Coord, dir Direction) Coord
- func (p *Puzzle) WordExtents(pos Coord, dir Direction) (Coord, Coord)
- func (p *Puzzle) WordID(pos Coord, dir Direction) int
- func (p *Puzzle) WordStart(id int) (Coord, bool)
- func (p *Puzzle) Write(w io.Writer) error
- type Warning
Constants ¶
const ( Magic = "ACROSS&DOWN\x00" CksumMagic = "ICHEATED" Blank = '.' Empty = '-' )
.puz constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Direction ¶
type Direction int
Direction is a relative direction.
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
Grid represents a 2D array stored contiguously.
type Header ¶
type Header struct { Cksum uint16 Magic [len(Magic)]byte HeaderCksum uint16 MagicCksum [8]byte Version [4]byte Unused [2]byte Unknown [2]byte Reserved [12]byte Width uint8 Height uint8 NumClues uint16 BitMask1 [2]byte // normally set to 0x0001 BitMask2 [2]byte // 0x0004 = scrambled }
Header holds .puz file header data
type Puzzle ¶
type Puzzle struct { Header Header *Grid Solution *Grid Title string Author string Copyright string Clues []string Notes string Extra []byte // contains filtered or unexported fields }
Puzzle holds the state of a crossword puzzle
func (*Puzzle) Clue ¶
Clue returns the clue for the word that contains pos in direction dir, or an empty string if invalid.
func (*Puzzle) HeaderCksum ¶
HeaderCksum calculates base checksum
func (*Puzzle) MagicCksum ¶
MagicCksum calculates magic checksum
func (*Puzzle) NextCell ¶
NextCell returns the location one square from pos in dir direction. If doSkip is true, skip blank squares and wrap around the grid, otherwise, pos is returned unmodified.
func (*Puzzle) NextWord ¶
NextWord returns the position of the first cell of the word after the one that includes pos in direction dir, wrapping if necessary.
func (*Puzzle) WordExtent ¶
WordExtent returns the position of the last cell of the word that includes pos in direction dir.
func (*Puzzle) WordExtents ¶
WordExtents returns the positions of the first and last cells of the word that includes pos along direction dir.
func (*Puzzle) WordID ¶
WordID returns the ID number of the word that includes pos along direction dir.