polarity

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delta

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

job fields outcome from transition

type Inventory

type Inventory []int

func (Inventory) Copy

func (i Inventory) Copy() Inventory

type Job

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

func (*Job) String

func (j *Job) String() string

values for debug print

type Kit

type Kit uint8
const (
	Battery Kit = iota
	Cannon
	Build
	Scanner
)

type Mask

type Mask uint16
const (
	None Mask = 1 << iota
	Barrier
	Jaeger
	Junk
	Clone
	Self
	Fusion
	ToggleSwitch
	NorthPole
	SouthPole
	Demagnetized
)

func (Mask) Del

func (m Mask) Del(flag Mask) Mask

func (Mask) Has

func (m Mask) Has(flag Mask) bool

func (Mask) Not

func (m Mask) Not(flag Mask) bool

func (Mask) Set

func (m Mask) Set(flag Mask) Mask

type Maze

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

maze acts as world state

func NewMaze

func NewMaze(wd int, fn func(t string, v ...any)) *Maze

func (*Maze) Done

func (m *Maze) Done() error

func (*Maze) Mini

func (m *Maze) Mini() Minimap

used by game draw step

func (*Maze) String

func (m *Maze) String() string

debug print

func (*Maze) Update

func (m *Maze) Update() error

to be called by the game lifecycle

func (*Maze) Width

func (m *Maze) Width() float32

used by game draw step

type Minimap

type Minimap [][]Mask

minimap of row x col maze (2 scopes - maze and jaeger because mechs have fog-of-war)

func NewMinimap

func NewMinimap(wd int) Minimap

func (Minimap) Change

func (m Minimap) Change(oldm, newm Mask, oldrow, oldcol, row, col int)

func (Minimap) Copy

func (m Minimap) Copy() Minimap

try copy and nil to avoid losing orphans from pass by reference

func (Minimap) Jaeger

func (m Minimap) Jaeger(j Job)

initial placement

func (Minimap) JaegerMe

func (m Minimap) JaegerMe(j Job)

initial placement from jaeger pov

func (Minimap) Junk

func (m Minimap) Junk(j Job, d Delta)

func (Minimap) Walk

func (m Minimap) Walk(j Job, d Delta)

walk changes position in maze

func (Minimap) WalkMe

func (m Minimap) WalkMe(j Job, d Delta)

walk from jaeger (/self) pov

type Move

type Move struct {
	Command   string `json:"command"`
	Direction string `json:"direction"`
}

move request data from the ticket JSON

type Script

type Script interface {
	Next(state string) string
}

*wasm* a user defined script

type TestScript

type TestScript struct{}

TODO load wasm script

func (TestScript) Next

func (s TestScript) Next(state string) string

type Ticket

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

Jump to

Keyboard shortcuts

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