bots

package
v0.0.0-...-73daa5e Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: MIT Imports: 0 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTurnBasedBots

func InitTurnBasedBots(bots []Bot, gameName, gameID string) error

InitTurnBasedBots is an helper that starts and discovers connected bots

Types

type Bot

type Bot interface {
	Name() string
	SetName(string)
	Path() string
	Start() error
	SendMessage(QuestionMessage) (*ReplyMessage, error)
}

type QuestionMessage

type QuestionMessage struct {
	GameID      string      `json:"game-id,omitempty" binding:"required"`
	Action      string      `json:"action,omitempty" binding:"required"`
	Game        string      `json:"game,omitempty" binding:"required"`
	Players     int         `json:"players,omitempty"`
	Board       interface{} `json:"board,omitempty"`
	You         interface{} `json:"you,omitempty"`
	PlayerIndex int         `json:"player-index,omitempty" binding:"required"`
}

type ReplyMessage

type ReplyMessage struct {
	Name        string      `json:"name,omitempty"`
	Play        interface{} `json:"play,omitempty"`
	Error       interface{} `json:"error,omitempty"`
	Comment     interface{} `json:"comment,omitempty"`
	PlayerIndex int         `json:"player-index,omitempty" binding:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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