notation: bitbucket.org/zurichess/notation Index | Files | Directories

package notation

import "bitbucket.org/zurichess/notation"

Package notation implements parsing of chess positions.

Current supported formats are FEN and EPD notations. For EPD format see https://chessprogramming.wikispaces.com/Extended+Position+Description. For FEN format see https://chessprogramming.wikispaces.com/Forsyth-Edwards+Notation.

Index

Package Files

epd.go

type EPD Uses

type EPD struct {
    Position   *Position         // first 4 fields
    Id         string            // id
    BestMove   []Move            // bm
    AvoidMove  []Move            // am
    Comment    map[string]string // c0-c9
    Evaluation *int32            // ce, centipawn evaluation if not nil
}

EPD contains a parsed chess position in Extended Position Description. https://chessprogramming.wikispaces.com/Extended+Position+Description

func (*EPD) String Uses

func (e *EPD) String() string

type EPDScanner Uses

type EPDScanner struct {
    // contains filtered or unexported fields
}

EPDScanner parses an input line by line and returns EPDs.

func NewEPDScanner Uses

func NewEPDScanner(r io.Reader, p Parser) *EPDScanner

NewEPDScanner returns a new scanner that reads epds from file one by one.

func (*EPDScanner) EPD Uses

func (es *EPDScanner) EPD() *EPD

EPD returns the parsed position.

func (*EPDScanner) Err Uses

func (es *EPDScanner) Err() error

Err returns the last error.

func (*EPDScanner) Scan Uses

func (es *EPDScanner) Scan() bool

Scan returns true if there was a new EPD read. If the EPD parsing erroneous then Scan returns true and sets the error.

type Parser Uses

type Parser interface {
    Parse(line string) (*EPD, error)
}

Parser parses a string and returns an EPD.

Directories

PathSynopsis
epdPackage epd implementes a parser for chess positions in EPD format.
fenPackage fen implementes a parser for chess positions in FEN format.
sanPackage moves provides functionally to parse a move in SAN representation.

Package notation imports 5 packages (graph) and is imported by 7 packages. Updated 2018-11-28. Refresh now. Tools for package owners.