uci

package
v0.0.0-...-9a4bc7e Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package uci implements encoding and decoding for Universal Chess Interface (UCI) messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(m Message) ([]byte, error)

Marshal returns the UCI encoding of m.

func Unmarshal

func Unmarshal(text []byte, m Message) error

Unmarshal parses the UCI-encoded data and stores the result in the value pointed to by m.

Types

type BestMove

type BestMove struct {
	Move   string
	Ponder string
}

BestMove represents the "bestmove" message.

func (*BestMove) MarshalText

func (b *BestMove) MarshalText() ([]byte, error)

func (*BestMove) UnmarshalText

func (b *BestMove) UnmarshalText(text []byte) error

type CopyProtection

type CopyProtection struct{}

CopyProtection represents the "copyprotection" message.

func (*CopyProtection) MarshalText

func (c *CopyProtection) MarshalText() ([]byte, error)

func (*CopyProtection) UnmarshalText

func (c *CopyProtection) UnmarshalText(text []byte) error

type Debug

type Debug struct {
	Flag bool
}

Debug represents the "debug" message.

func (*Debug) MarshalText

func (d *Debug) MarshalText() ([]byte, error)

func (*Debug) UnmarshalText

func (d *Debug) UnmarshalText(text []byte) error

type Decoder

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

Decoder decodes UCI messages from an input stream.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a new decoder that reads from r.

func (*Decoder) Decode

func (d *Decoder) Decode(m Message) error

Decode reads the next message from its input and stores it in the value pointed to by m.

func (*Decoder) Message

func (d *Decoder) Message() (Message, error)

Message returns the next UCI message in the input stream. At the end of the input stream, Message returns nil, io.EOF.

type Encoder

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

Encoder encodes UCI messages to an output stream.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new encoder that writes to w.

func (*Encoder) Encode

func (e *Encoder) Encode(m Message) error

Encode writes m to the stream, followed by a newline character.

type Go

type Go struct {
	SearchMoves []string // Restrict search to these moves only. Ignore if empty.

	Ponder   bool // Search in pondering mode.
	Infinite bool // Search until interrupted.
	MoveTime int  // If > 0, search for this many milliseconds.

	WhiteTime      int // If > 0, white's remaining time in milliseconds.
	BlackTime      int // If > 0, black's remaining time in milliseconds.
	WhiteIncrement int // If > 0, white's increment in milliseconds.
	BlackIncrement int // If > 0, black's increment in milliseconds.

	Depth     int // If > 0, search this many plies only.
	Nodes     int // If > 0, search this many nodes only.
	Mate      int // If > 0, search for a mate in this many moves.
	MovesToGo int // If > 0, there are this many moves until the next time control.
}

Go represents the "go" message.

func (*Go) MarshalText

func (g *Go) MarshalText() ([]byte, error)

func (*Go) UnmarshalText

func (g *Go) UnmarshalText(text []byte) error

type ID

type ID struct {
	Name   string
	Author string
}

ID represents the "id" message.

func (*ID) MarshalText

func (i *ID) MarshalText() ([]byte, error)

func (*ID) UnmarshalText

func (i *ID) UnmarshalText(text []byte) error

type Info

type Info struct{}

Info represents the "info" message.

func (*Info) MarshalText

func (i *Info) MarshalText() ([]byte, error)

func (*Info) UnmarshalText

func (i *Info) UnmarshalText(text []byte) error

type IsReady

type IsReady struct{}

IsReady represents the "isready" message.

func (*IsReady) MarshalText

func (*IsReady) MarshalText() ([]byte, error)

func (*IsReady) UnmarshalText

func (*IsReady) UnmarshalText(text []byte) error

type Message

type Message interface {
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

Message is the interface implemented by all UCI messages.

type Option

type Option struct{}

Option represents the "option" message.

func (*Option) MarshalText

func (o *Option) MarshalText() ([]byte, error)

func (*Option) UnmarshalText

func (o *Option) UnmarshalText(text []byte) error

type PonderHit

type PonderHit struct{}

PonderHit represents the "ponderhit" message.

func (*PonderHit) MarshalText

func (*PonderHit) MarshalText() ([]byte, error)

func (*PonderHit) UnmarshalText

func (*PonderHit) UnmarshalText(text []byte) error

type Position

type Position struct {
	FEN   string
	Moves []string
}

Position represents the "position" message.

func (*Position) MarshalText

func (p *Position) MarshalText() ([]byte, error)

func (*Position) UnmarshalText

func (p *Position) UnmarshalText(text []byte) error

type Quit

type Quit struct{}

Quit represents the "quit" message.

func (*Quit) MarshalText

func (*Quit) MarshalText() ([]byte, error)

func (*Quit) UnmarshalText

func (*Quit) UnmarshalText(text []byte) error

type ReadyOk

type ReadyOk struct{}

ReadyOk represents the "readyok" message.

func (*ReadyOk) MarshalText

func (*ReadyOk) MarshalText() ([]byte, error)

func (*ReadyOk) UnmarshalText

func (*ReadyOk) UnmarshalText(text []byte) error

type Register

type Register struct {
	Later bool
	Name  string
	Code  string
}

Register represents the "register" message.

func (*Register) MarshalText

func (r *Register) MarshalText() ([]byte, error)

func (*Register) UnmarshalText

func (r *Register) UnmarshalText(text []byte) error

type Registration

type Registration struct{}

Registration represents the "registration" message.

func (*Registration) MarshalText

func (r *Registration) MarshalText() ([]byte, error)

func (*Registration) UnmarshalText

func (r *Registration) UnmarshalText(text []byte) error

type SetOption

type SetOption struct {
	Name  string
	Value string
}

SetOption represents the "setoption" message.

func (*SetOption) MarshalText

func (s *SetOption) MarshalText() ([]byte, error)

func (*SetOption) UnmarshalText

func (s *SetOption) UnmarshalText(text []byte) error

type Stop

type Stop struct{}

Stop represents the "stop" message.

func (*Stop) MarshalText

func (*Stop) MarshalText() ([]byte, error)

func (*Stop) UnmarshalText

func (*Stop) UnmarshalText(text []byte) error

type UCI

type UCI struct{}

UCI represents the "uci" message.

func (*UCI) MarshalText

func (*UCI) MarshalText() ([]byte, error)

func (*UCI) UnmarshalText

func (*UCI) UnmarshalText(text []byte) error

type UCINewGame

type UCINewGame struct{}

UCINewGame represents the "ucinewgame" message.

func (*UCINewGame) MarshalText

func (*UCINewGame) MarshalText() ([]byte, error)

func (*UCINewGame) UnmarshalText

func (*UCINewGame) UnmarshalText(text []byte) error

type UCIOk

type UCIOk struct{}

UCIOk represents the "uciok" message.

func (*UCIOk) MarshalText

func (*UCIOk) MarshalText() ([]byte, error)

func (*UCIOk) UnmarshalText

func (*UCIOk) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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