ast

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ast declares puzzle types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name string `yaml:"name"`
	ID   string `yaml:"id"`
}

Author of puzzle.

type Char

type Char rune

Char uniquely identifies a color.

func (Char) MarshalText

func (c Char) MarshalText() ([]byte, error)

MarshalText encodes the character into UTF-8-encoded text and returns the result.

func (*Char) UnmarshalText

func (c *Char) UnmarshalText(b []byte) error

UnmarshalText decodes the character from UTF-8-encoded text.

type Clue

type Clue struct {
	Columns []Line `yaml:"columns,flow"`
	Rows    []Line `yaml:"rows,flow"`
}

Clue defines a clue used in the puzzle.

type Color

type Color struct {
	R, G, B uint8
}

Color in RGB.

func (Color) MarshalText

func (c Color) MarshalText() ([]byte, error)

MarshalText encodes the color into UTF-8-encoded hex string.

func (Color) RGBA

func (c Color) RGBA() (r, g, b, a uint32)

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the color.

func (*Color) UnmarshalText

func (c *Color) UnmarshalText(b []byte) (err error)

UnmarshalText decodes the color from UTF-8-encoded hex string.

type Colors

type Colors map[Char]Color

Colors used in puzzle.

type Goal

type Goal [][]Char

Goal of the puzzle.

type Item

type Item struct {
	Color Char `yaml:"color"`
	Count int  `yaml:"count"`
}

Item of the clue.

type Line

type Line []Item

Line of clue items.

type Puzzle

type Puzzle struct {
	ID          string  `yaml:"id,omitempty"`
	Source      string  `yaml:"source,omitempty"`
	Author      *Author `yaml:"author,omitempty"`
	Copyright   string  `yaml:"copyright,omitempty"`
	Title       string  `yaml:"title"`
	Description string  `yaml:"description,omitempty"`
	Background  Char    `yaml:"background"`
	Colors      Colors  `yaml:"colors"`
	Clue        Clue    `yaml:"clue"`
	Goal        *Goal   `yaml:"goal,flow,omitempty"`
}

Puzzle a puzzle in the set of puzzles.

type PuzzleSet

type PuzzleSet []Puzzle

PuzzleSet the root structure of the document. Includes all puzzles.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL