vikebot

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

README

vikebot-go

Official Go SDK for interacting with Vikebot Challenge, a competitive online coding game.

Go Report Card GoDoc

Documentation

Index

Constants

View Source
const (
	// AngleLeft is a constant for the 'left'
	AngleLeft = "left"
	// AngleRight is a constant for 'right'
	AngleRight = "right"

	// DirectionNorth is a constant for 'north'
	DirectionNorth = "north"
	// DirectionEast is a constant for 'east'
	DirectionEast = "east"
	// DirectionSouth is a constant for 'south'
	DirectionSouth = "south"
	// DirectionWest is a constant for 'west'
	DirectionWest = "west"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockEntity

type BlockEntity struct {
}

BlockEntity is not implemented yet

type Game

type Game struct {
	Encrypted bool
	Player    *Player
	// contains filtered or unexported fields
}

Game manages all connections and authorizations for the client. Also holds the state of the active player

func Join

func Join(authtoken string) (g *Game, err error)

Join exchanges the `authtoken` for server credentials and establishes a secure connection (`AES256-GCM`) to the game-server. Afterwards it returns a game object containing basic infos and the player's state.

func MustJoin

func MustJoin(authtoken string) *Game

MustJoin is like Join but panics if any errors occur. It simplifies safe initialization of the game object.

func (*Game) Close

func (g *Game) Close() error

Close frees all local infos about the game and closes all remote connections to any servers or APIs.

type MapEntity

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

MapEntity is a struct with the width and height of the map

func (*MapEntity) Block

func (me *MapEntity) Block(x int, y int) *BlockEntity

Block is not implemented yet

func (*MapEntity) Height

func (me *MapEntity) Height() int

Height returns an int of the Height of the map entity

func (*MapEntity) Width

func (me *MapEntity) Width() int

Width returns an int of the width of the map entity

type Player

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

Player represents a single controllable game entitiy (also called character).

func (*Player) Attack

func (p *Player) Attack() (enemyHealth int, err error)

Attack performs an attack into the direction the player is currently looking.

func (*Player) Defend

func (p *Player) Defend() (err error)

Defend implements the function of 'sdk-wiki.vikebot.com/#defend-and-undefend'

func (*Player) GetHealth

func (p *Player) GetHealth() (health int, err error)

GetHealth implements the function of 'sdk-wiki.vikebot.com/#GetHealth'

func (*Player) Move

func (p *Player) Move(direction string) error

Move instructs the player to run in the neighbor block specified by the direction parameter. Directions are cardinal-directions and predefined in package constants: `vikebot.Direction*`

func (*Player) MustAttack

func (p *Player) MustAttack() (enemyHealth int)

MustAttack is like `Attack` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustDefend

func (p *Player) MustDefend()

MustDefend is like `Defend` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustGetHealth

func (p *Player) MustGetHealth() (health int)

MustGetHealth is like `GetHealth` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustMove

func (p *Player) MustMove(direction string)

MustMove is like `Move` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustRadar

func (p *Player) MustRadar() (count int)

MustRadar is like `Radar` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustRotate

func (p *Player) MustRotate(angle string)

MustRotate is like `Rotate` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustScout

func (p *Player) MustScout(distance int) (count int)

MustScout is like `Scout` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustUndefend

func (p *Player) MustUndefend()

MustUndefend is like `Undefend` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) MustWatch

func (p *Player) MustWatch() (healthMatrix [][]int)

MustWatch is like `Watch` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.

func (*Player) Radar

func (p *Player) Radar() (count int, err error)

Radar implements the function of 'sdk-wiki.vikebot.com/#radar'

func (*Player) Rotate

func (p *Player) Rotate(angle string) error

Rotate implements the function of 'sdk-wiki.vikebot.com/#rotate'

func (*Player) Scout

func (p *Player) Scout(distance int) (count int, err error)

Scout implements the function of 'sdk-wiki.vikebot.com/#scout'

func (*Player) Undefend

func (p *Player) Undefend() (err error)

Undefend implements the function of 'sdk-wiki.vikebot.com/#defend-and-undefend'

func (*Player) Watch

func (p *Player) Watch() (healthMatrix [][]int, err error)

Watch implements the function of 'sdk-wiki.vikebot.com/#watch'

Jump to

Keyboard shortcuts

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