bot

package
v0.0.0-...-0992052 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

Bot a battleline bot. The bot may finish on its own if the connection is lost in that case the finConnCh is closed.

func New

func New(
	scheme, gameURL, name, pw string,
	limitNoGames int,
	inviteHandler InviteHandler,
	mover Mover,
) (bot *Bot, err error)

New create a battleline bot. remember to call cancel or stop to close all connections if created without errors.

func (*Bot) Cancel

func (bot *Bot) Cancel()

Cancel cancel a created bot.

func (*Bot) Start

func (bot *Bot) Start()

Start starts a batttleline bot.

func (*Bot) Stop

func (bot *Bot) Stop()

Stop stops a battleline bot.

type InviteHandler

type InviteHandler interface {
	AcceptInvite(invite *games.Invite) bool
	SendInvite(readyOpps []*games.PubData) (playerID int)
}

InviteHandler handles invites

type JsonDataTemp

type JsonDataTemp struct {
	JsonType int
	Data     json.RawMessage
}

JsonDataTemp is the JsonData type before we can umarshal the interface values.

type Mover

type Mover interface {
	GameStart(playingData *games.PlayingChData)
	GameRestart(playingData *games.PlayingChData)
	GameStop(playingData *games.PlayingChData)
	GameFinish(playingData *games.PlayingChData)
	Move(viewPos *game.ViewPos) (moveis int)
}

Mover a interface for handle battleline moves.

type StdInviteHandler

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

StdInviteHandler handles invite by accept all or invite first.

func NewStdInviteHandler

func NewStdInviteHandler(isInviter bool) *StdInviteHandler

NewStdInviteHandler create invite handler.

func (*StdInviteHandler) AcceptInvite

func (s *StdInviteHandler) AcceptInvite(invite *games.Invite) bool

AcceptInvite accept or decline invites

func (*StdInviteHandler) SendInvite

func (s *StdInviteHandler) SendInvite(readyOpps []*games.PubData) (playerID int)

SendInvite sends invites.

Directories

Path Synopsis
dht

Jump to

Keyboard shortcuts

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