uci

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package uci contains the UciHandler data structure and functionality to handle the UCI protocol communication between the Chess User Interface and the chess engine.

Index

Constants

View Source
const (
	Check  uciOptionType = 0
	Spin   uciOptionType = 1
	Combo  uciOptionType = 2
	Button uciOptionType = 3
	String uciOptionType = 4
)

uci option types constants

Variables

This section is empty.

Functions

This section is empty.

Types

type UciHandler

type UciHandler struct {
	InIo  *bufio.Scanner
	OutIo *bufio.Writer
	// contains filtered or unexported fields
}

UciHandler handles all communication with the chess ui via UCI and controls options and search. Create an instance with NewUciHandler()

func NewUciHandler

func NewUciHandler() *UciHandler

NewUciHandler creates a new UciHandler instance. Input / Output io can be replaced by changing the instance's InIo and OutIo members.

 Example:
		u.InIo = bufio.NewScanner(os.Stdin)
		u.OutIo = bufio.NewWriter(os.Stdout)

func (*UciHandler) Command

func (u *UciHandler) Command(cmd string) string

Command handles a single line of UCI protocol aka command. Returns the uci response as string output. Mostly useful for debugging and unit testing.

func (*UciHandler) Loop

func (u *UciHandler) Loop()

Loop starts the main loop to receive commands through input stream (pipe or user)

func (*UciHandler) SendAspirationResearchInfo

func (u *UciHandler) SendAspirationResearchInfo(depth int, seldepth int, value Value, bound string, nodes uint64, nps uint64, time time.Duration, pv moveslice.MoveSlice)

SendAspirationResearchInfo sends information about Aspiration researches to the UCI ui

func (*UciHandler) SendCurrentLine

func (u *UciHandler) SendCurrentLine(moveList moveslice.MoveSlice)

SendCurrentLine sends a periodically update about the currently searched variation ti the UCI ui

func (*UciHandler) SendCurrentRootMove

func (u *UciHandler) SendCurrentRootMove(currMove Move, moveNumber int)

SendCurrentRootMove sends the currently searched root move to the UCI ui

func (*UciHandler) SendInfoString

func (u *UciHandler) SendInfoString(info string)

SendInfoString send a arbitrary string to the UCI user interface

func (*UciHandler) SendIterationEndInfo

func (u *UciHandler) SendIterationEndInfo(depth int, seldepth int, value Value, nodes uint64, nps uint64, time time.Duration, pv moveslice.MoveSlice)

SendIterationEndInfo sends information about the last search depth iteration to the UCI ui

func (*UciHandler) SendReadyOk

func (u *UciHandler) SendReadyOk()

SendReadyOk tells the UciDriver to send the uci response "readyok" to the UCI user interface

func (*UciHandler) SendResult

func (u *UciHandler) SendResult(bestMove Move, ponderMove Move)

SendResult send the search result to the UCI ui after the search has ended are has been stopped

func (*UciHandler) SendSearchUpdate

func (u *UciHandler) SendSearchUpdate(depth int, seldepth int, nodes uint64, nps uint64, time time.Duration, hashfull int)

SendSearchUpdate sends a periodically update about search stats to the UCI ui

Jump to

Keyboard shortcuts

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