Documentation
¶
Overview ¶
Package ast declares types used for webpbn format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnmarshal = errors.New("can't unmarshal")
ErrUnmarshal unmarshalling error.
Functions ¶
This section is empty.
Types ¶
type Char ¶
type Char rune
Char defines a color unique character.
func (Char) MarshalText ¶
MarshalText encodes the character into UTF-8-encoded text and returns the result.
func (*Char) UnmarshalText ¶
UnmarshalText decodes the character from UTF-8-encoded text.
type Color ¶
type Color struct {
Name string `xml:"name,attr"`
Char Char `xml:"char,attr"`
Hex string `xml:",chardata"`
}
Color defines a color name used in the puzzle.
type Colors ¶
type Colors []Color
Colors collection of colors.
type Image ¶
type Image [][]Char
Image defines solution image.
func (Image) MarshalText ¶
MarshalText encodes the image into UTF-8-encoded text and returns the result.
func (*Image) UnmarshalText ¶
UnmarshalText decodes the image from UTF-8-encoded text.
type Puzzle ¶
type Puzzle struct {
Type PuzzleType `xml:"type,attr"`
DefaultColor string `xml:"defaultcolor,attr,omitempty"`
BackgroundColor string `xml:"backgroundcolor,attr,omitempty"`
Source string `xml:"source,omitempty"`
ID string `xml:"id,omitempty"`
Author string `xml:"author,omitempty"`
AuthorID string `xml:"authorid,omitempty"`
Copyright string `xml:"copyright,omitempty"`
Description string `xml:"description,omitempty"`
Colors Colors `xml:"color"`
Clues Clues `xml:"clues"`
Solution *Solution `xml:"solution,omitempty"`
}
Puzzle a puzzle in the set of puzzles.
type PuzzleType ¶
type PuzzleType string
PuzzleType declares a type of the puzzle.
const Grid PuzzleType = "grid"
Grid used for a puzzle where cells are square and there will be a set of row clues and a set of column clue.
type Solution ¶
type Solution struct {
Type SolutionType `xml:"type,attr"`
Image Image `xml:"image"`
}
Solution defines puzzle solution.
type SolutionType ¶
type SolutionType string
SolutionType declares a type of the solution.
const Goal SolutionType = "goal"
Goal used for the goal solution intended by the designer of the puzzle.