notation

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: BSD-3-Clause Imports: 5 Imported by: 5

README

zurichess/notation is a library for parsing chess positions. See documentation at https://godoc.org/bitbucket.org/zurichess/notation.

Currently only positions in EPD and FEN formats are supported, but game parsing (PGN files) is also be planned. Good documentation on FEN, EPD and PGN formats can be found at http://www.thechessdrum.net/PGN_Reference.txt.

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EPD

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

func (e *EPD) String() string

type EPDScanner

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

EPDScanner parses an input line by line and returns EPDs.

func NewEPDScanner

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

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

func (*EPDScanner) EPD

func (es *EPDScanner) EPD() *EPD

EPD returns the parsed position.

func (*EPDScanner) Err

func (es *EPDScanner) Err() error

Err returns the last error.

func (*EPDScanner) Scan

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

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

Parser parses a string and returns an EPD.

Directories

Path Synopsis
Package epd implementes a parser for chess positions in EPD format.
Package epd implementes a parser for chess positions in EPD format.
Package fen implementes a parser for chess positions in FEN format.
Package fen implementes a parser for chess positions in FEN format.
Package moves provides functionally to parse a move in SAN representation.
Package moves provides functionally to parse a move in SAN representation.

Jump to

Keyboard shortcuts

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