Documentation
¶
Index ¶
- Constants
- func Color(f FieldProvider) color.Color
- func Coord(f FieldProvider) *coord.Coord
- func HasComment(f FieldProvider) bool
- func IsMove(f FieldProvider) bool
- func IsPass(f FieldProvider) bool
- type Command
- func DecodeToCommand(evt event.Event) (Command, error)
- func NewAddLabelCommand(crd *coord.Coord, label string) Command
- func NewAddLetterCommand(crd *coord.Coord, letter string) Command
- func NewAddNumberCommand(crd *coord.Coord, number int) Command
- func NewAddSquareCommand(crd *coord.Coord) Command
- func NewAddStoneCommand(crd *coord.Coord, color color.Color) Command
- func NewAddTriangleCommand(crd *coord.Coord) Command
- func NewCommentCommand(text string) Command
- func NewCopyCommand() Command
- func NewCutCommand() Command
- func NewDownCommand() Command
- func NewDrawCommand(x0, y0, x1, y1 float64, color string) Command
- func NewErasePenCommand() Command
- func NewFastForwardCommand() Command
- func NewGotoCoordCommand(crd *coord.Coord) Command
- func NewGotoGridCommand(index int) Command
- func NewGraftCommand(text string) Command
- func NewLeftCommand() Command
- func NewMarkDeadCommand(crd *coord.Coord) Command
- func NewPassCommand(color color.Color) Command
- func NewPasteCommand() Command
- func NewRemoveMarkCommand(crd *coord.Coord) Command
- func NewRemoveStoneCommand(crd *coord.Coord) Command
- func NewRewindCommand() Command
- func NewRightCommand() Command
- func NewScoreCommand() Command
- func NewUpCommand() Command
- type FieldProvider
- type Frame
- type FrameType
- type Label
- type Marks
- type Metadata
- type NodeJSON
- type Pen
- type State
- func (s *State) AddNode(crd *coord.Coord, col color.Color) *coord.Diff
- func (s *State) AddStones(moves []*coord.Stone)
- func (s *State) AddStonesToTrunk(t int, moves []*coord.Stone)
- func (s *State) AnyMove()
- func (s *State) Board() *board.Board
- func (s *State) Current() *tree.TreeNode
- func (s *State) EditKomi(value string)
- func (s *State) EditPlayerBlack(value string)
- func (s *State) EditPlayerWhite(value string)
- func (s *State) GenerateFullFrame(t TreeJSONType) *Frame
- func (s *State) GenerateTreeOnly(t TreeJSONType) *Frame
- func (s *State) GetColorAt(t int) color.Color
- func (s *State) GetNextIndex() int
- func (s *State) Head() *tree.TreeNode
- func (s *State) HeadColor() color.Color
- func (s *State) Nodes() map[int]*tree.TreeNode
- func (s *State) PushHead(x, y int, col color.Color) bool
- func (s *State) Root() *tree.TreeNode
- func (s *State) Save() *StateJSON
- func (s *State) SetLocation(loc string)
- func (s *State) SetNextIndex(i int)
- func (s *State) SetPrefs(prefs map[string]int)
- func (s *State) Size() int
- func (s *State) ToSGF() string
- func (s *State) ToSGFIX() string
- type StateJSON
- type TreeJSON
- type TreeJSONType
Constants ¶
View Source
const ( DiffFrame = iota FullFrame )
View Source
const Letters = "ABCDEFGHIJKLNMOPQRSTUVWXYZ"
Variables ¶
This section is empty.
Functions ¶
func Color ¶
func Color(f FieldProvider) color.Color
func Coord ¶
func Coord(f FieldProvider) *coord.Coord
func HasComment ¶
func HasComment(f FieldProvider) bool
func IsMove ¶
func IsMove(f FieldProvider) bool
func IsPass ¶
func IsPass(f FieldProvider) bool
Types ¶
type Command ¶
func NewAddSquareCommand ¶
func NewAddTriangleCommand ¶
func NewCommentCommand ¶
func NewCopyCommand ¶
func NewCopyCommand() Command
func NewCutCommand ¶
func NewCutCommand() Command
func NewDownCommand ¶
func NewDownCommand() Command
func NewDrawCommand ¶
func NewErasePenCommand ¶
func NewErasePenCommand() Command
func NewFastForwardCommand ¶
func NewFastForwardCommand() Command
func NewGotoCoordCommand ¶
func NewGotoGridCommand ¶
func NewGraftCommand ¶
func NewLeftCommand ¶
func NewLeftCommand() Command
func NewMarkDeadCommand ¶
func NewPassCommand ¶
func NewPasteCommand ¶
func NewPasteCommand() Command
func NewRemoveMarkCommand ¶
func NewRemoveStoneCommand ¶
func NewRewindCommand ¶
func NewRewindCommand() Command
func NewRightCommand ¶
func NewRightCommand() Command
func NewScoreCommand ¶
func NewScoreCommand() Command
func NewUpCommand ¶
func NewUpCommand() Command
type FieldProvider ¶
type Frame ¶
type Frame struct {
Type FrameType `json:"type"`
Diff *coord.Diff `json:"diff"`
Marks *Marks `json:"marks"`
Comments []string `json:"comments"`
Metadata *Metadata `json:"metadata"`
TreeJSON *TreeJSON `json:"tree"`
BlackCaps int `json:"black_caps"`
WhiteCaps int `json:"white_caps"`
BlackArea []*coord.Coord `json:"black_area"`
WhiteArea []*coord.Coord `json:"white_area"`
Dame []*coord.Coord `json:"dame"`
}
Frame provides the data for when the board needs to be updated (not the explorer)
type Marks ¶
type Marks struct {
Current *coord.Coord `json:"current"`
Squares []*coord.Coord `json:"squares"`
Triangles []*coord.Coord `json:"triangles"`
Labels []*Label `json:"labels"`
Pens []*Pen `json:"pens"`
}
Marks provides data for any marks on the board
type Metadata ¶
Metadata provides the size of the board plus any fields (usually from the root node)
type NodeJSON ¶
type NodeJSON struct {
Color color.Color `json:"color"`
Down []int `json:"down"`
Depth int `json:"depth"`
Comment bool `json:"comment"`
}
NodeJSON is a key component of TreeJSON
type Pen ¶
type Pen struct {
X0 float64 `json:"x0"`
Y0 float64 `json:"y0"`
X1 float64 `json:"x1"`
Y1 float64 `json:"y1"`
Color string `json:"color"`
}
Pen contains a start and end coordinate plus a color
type State ¶
type State struct {
// contains filtered or unexported fields
}
as a rule, anything that would need to get sent to new connections should be stored here
func NewEmptyState ¶
func (*State) EditPlayerBlack ¶
func (*State) EditPlayerWhite ¶
func (*State) GenerateFullFrame ¶
func (s *State) GenerateFullFrame(t TreeJSONType) *Frame
func (*State) GenerateTreeOnly ¶
func (s *State) GenerateTreeOnly(t TreeJSONType) *Frame
func (*State) GetNextIndex ¶
func (*State) SetLocation ¶
func (*State) SetNextIndex ¶
type TreeJSON ¶
type TreeJSON struct {
Nodes map[int]*NodeJSON `json:"nodes"`
Current int `json:"current"`
Preferred []int `json:"preferred"`
Depth int `json:"depth"`
Up int `json:"up"`
Root int `json:"root"`
}
TreeJSON is the basic struct to encode information about the explorer this makes up one part of a Frame
type TreeJSONType ¶
type TreeJSONType int
TreeJSONType defines some options for how much data to send in a TreeJSON
const ( CurrentOnly TreeJSONType = iota CurrentAndPreferred PartialNodes Full )
Click to show internal directories.
Click to hide internal directories.