ptn

package
v0.0.0-...-7c4a433 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMove

func FormatMove(m *tak.Move) string

func FormatTPS

func FormatTPS(p *tak.Position) string

func ParseMove

func ParseMove(move string) (tak.Move, error)

func ParseTPS

func ParseTPS(tpn string) (*tak.Position, error)

Types

type Comment

type Comment struct {
	Comment string
	// contains filtered or unexported fields
}

func (Comment) Source

func (o Comment) Source() string

type Move

type Move struct {
	Move      tak.Move
	Modifiers string
	// contains filtered or unexported fields
}

func (Move) Source

func (o Move) Source() string

type MoveNumber

type MoveNumber struct {
	Number int
	// contains filtered or unexported fields
}

func (MoveNumber) Source

func (o MoveNumber) Source() string

type Op

type Op interface {
	Source() string
	// contains filtered or unexported methods
}

type PTN

type PTN struct {
	Tags []Tag
	Ops  []Op
}

func ParsePTN

func ParsePTN(r io.Reader) (*PTN, error)

func (*PTN) AddMoves

func (p *PTN) AddMoves(moves []tak.Move)

func (*PTN) FindTag

func (p *PTN) FindTag(name string) string

func (*PTN) InitialPosition

func (p *PTN) InitialPosition() (*tak.Position, error)

func (*PTN) PositionAtMove

func (p *PTN) PositionAtMove(move int, color tak.Color) (*tak.Position, error)

PositionAtMove returns the position of the game after PTN move marker `move`, with `color` to play.

`move=0` will cause the code to return the final position of the game.

func (*PTN) Render

func (p *PTN) Render() string

type Result

type Result struct {
	Result string
	// contains filtered or unexported fields
}

func (Result) Source

func (o Result) Source() string

func (*Result) Winner

func (r *Result) Winner() tak.Color

type Tag

type Tag struct {
	Name  string
	Value string
}

Jump to

Keyboard shortcuts

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