bot

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SelfPlayer = 0
	BotPlayer  = 1
)
View Source
const (
	StarPlayThreshold = 10.0 // equity
)

Variables

This section is empty.

Functions

func Main

func Main(channel string, bot *Bot)

func MakeRequest

func MakeRequest(game *runner.GameRunner, config *config.Config) ([]byte, error)

Types

type Bot

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

func NewBot

func NewBot(config *config.Config, options *runner.GameOptions) *Bot

func (*Bot) Deserialize

func (bot *Bot) Deserialize(data []byte) (*game.Game, *pb.EvaluationRequest, pb.BotRequest_BotCode, error)

type Client

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

func (*Client) RequestMove

func (c *Client) RequestMove(game *runner.GameRunner, config *config.Config) (*move.Move, error)

Send a game to the bot and get a move back.

type Response

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

func Msg

func Msg(message string) *Response

func Send

func Send(message string) *Response

Keep Send in case we need bot debug messages, but for regular bot-to-play the shell now automatically sends a message.

type ShellController

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

func NewShellController

func NewShellController(cfg *config.Config, execPath string) *ShellController

func (*ShellController) IsBotOnTurn

func (sc *ShellController) IsBotOnTurn() bool

func (*ShellController) IsPlaying

func (sc *ShellController) IsPlaying() bool

func (*ShellController) Loop

func (sc *ShellController) Loop(channel string, sig chan os.Signal)

type ShellOptions

type ShellOptions struct {
	runner.GameOptions
	// contains filtered or unexported fields
}

Options to configure the interactve shell

func NewShellOptions

func NewShellOptions() *ShellOptions

func (*ShellOptions) Show

func (opts *ShellOptions) Show(key string) (bool, string)

func (*ShellOptions) ToDisplayText

func (opts *ShellOptions) ToDisplayText() string

Jump to

Keyboard shortcuts

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