operator

package
v0.0.0-...-351bd47 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteGame

func ExecuteGame(whiteAgent, blackAgent PlayerInstance, config Config) api.GameResult

func Validate

func Validate(pathToExecutable string, scheduler *PortScheduler) error

Types

type Config

type Config struct {
	Start game.State
	Limit time.Duration

	// GameHadState is called after every state transition. It allows clients
	// to subscribe to updates while the game is in progress.
	GameHadState func(*game.State) error
}

type PlayerInstance

type PlayerInstance interface {
	Play(s *game.State, limit time.Duration) (*game.State, error)
	Player() api.Player
}

type PlayerProcessInstance

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

PlayerProcessInstance is not thread-safe

func NewPlayerProcessInstance

func NewPlayerProcessInstance(player api.Player, executable string, scheduler *PortScheduler) (*PlayerProcessInstance, error)

func (*PlayerProcessInstance) Close

func (i *PlayerProcessInstance) Close() error

func (*PlayerProcessInstance) Play

func (i *PlayerProcessInstance) Play(s *game.State, limit time.Duration) (*game.State, error)

func (*PlayerProcessInstance) Player

func (i *PlayerProcessInstance) Player() api.Player

type PortScheduler

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

func NewScheduler

func NewScheduler(basePort, numPorts int) *PortScheduler

func (*PortScheduler) GetPort

func (ps *PortScheduler) GetPort() (int, error)

func (*PortScheduler) ReleasePort

func (ps *PortScheduler) ReleasePort(port int)

type RemotePlayerInstance

type RemotePlayerInstance struct {
	APIPlayer api.Player
	Host      string
}

func (*RemotePlayerInstance) Ping

func (i *RemotePlayerInstance) Ping() error

func (*RemotePlayerInstance) Play

func (i *RemotePlayerInstance) Play(s *game.State, limit time.Duration) (*game.State, error)

func (*RemotePlayerInstance) Player

func (i *RemotePlayerInstance) Player() api.Player

Jump to

Keyboard shortcuts

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