pkg

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth    = 800
	ScreenHeight   = 600
	StatusBarDelay = 60
	DefaultDPI     = 96
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

func (*Engine) Bootstrap added in v1.4.0

func (e *Engine) Bootstrap(initialState map[string]interface{}, ppWakeup int, ppLook int, ppCompute int, ppMove int) error

func (*Engine) Init

func (e *Engine) Init(numRows, numCols int) error

func (*Engine) InitialState

func (e *Engine) InitialState() (int, map[string]interface{}, int, int, int, int, error)

func (*Engine) IsRunning

func (e *Engine) IsRunning() bool

func (*Engine) LoadScripts

func (e *Engine) LoadScripts() error

func (*Engine) Particle

func (e *Engine) Particle(p *Particle, neighbors1 []string, neighbors2 []string, neighbors1Deg []int) (string, error)

func (*Engine) Scheduler

func (e *Engine) Scheduler(particles []interface{}, states []interface{}) ([]interface{}, error)

func (*Engine) SelectScript added in v1.1.0

func (e *Engine) SelectScript(i int) (string, error)

func (*Engine) SetAsyncSheduler added in v1.1.0

func (e *Engine) SetAsyncSheduler()

func (*Engine) SetSyncSheduler added in v1.1.0

func (e *Engine) SetSyncSheduler()

func (*Engine) Start

func (e *Engine) Start()

func (*Engine) Stop

func (e *Engine) Stop()

func (*Engine) Update added in v1.1.0

func (e *Engine) Update(eTick *chan int)

type InnerState

type InnerState int
const (
	SLEEP InnerState = iota
	AWAKE
)

type Particle

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

func (*Particle) Awake

func (p *Particle) Awake() bool

Awake a particle. Returns true if particle changes the inner state

func (*Particle) GetDeg

func (p *Particle) GetDeg() int

func (*Particle) GetNeighborsString added in v1.1.0

func (p *Particle) GetNeighborsString() ([]string, []string)

func (*Particle) GetStateN

func (p *Particle) GetStateN() int

func (*Particle) GetStateS

func (p *Particle) GetStateS(state *State) string

func (*Particle) Init

func (p *Particle) Init() *Particle

func (*Particle) Round

func (p *Particle) Round() int

func (*Particle) SetDeg

func (p *Particle) SetDeg(n int) error

func (*Particle) SetNeighbors

func (p *Particle) SetNeighbors(n1, n2 []State) error

func (*Particle) SetNeighborsDeg added in v1.1.0

func (p *Particle) SetNeighborsDeg(n1Deg []int) error

func (*Particle) SetStateN

func (p *Particle) SetStateN(n int) error

func (*Particle) SetStateS

func (p *Particle) SetStateS(s string) error

func (*Particle) Sleep

func (p *Particle) Sleep() bool

Sleep a particle. Returns true if particle changes the inner state

type Phases

type Phases int
const (
	SCHEDULER Phases = iota
	LOOK
	COMPUTE
	MOVE
)

type Renderer

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

func (*Renderer) Draw

func (r *Renderer) Draw(screen *ebiten.Image)

func (*Renderer) Init

func (r *Renderer) Init() error

func (*Renderer) InitImages

func (r *Renderer) InitImages() error

func (*Renderer) Layout

func (r *Renderer) Layout(outsideWidth, outsideHeight int) (int, int)

func (*Renderer) Update

func (r *Renderer) Update() error

type Scheduler added in v1.1.0

type Scheduler int
const (
	SYNC Scheduler = iota
	ASYNC
)

type State

type State int
const (
	VOID State = iota
	CONTRACTED
	EXPANDL  // LEFT
	EXPANDR  // RIGHT
	EXPANDUL // UPPER LEFT
	EXPANDUR // UPPER RIGHT
	EXPANDLL // LOWER LEFT
	EXPANDLR // LOWER RIGHT
	MOVEL    // LEFT
	MOVER    // RIGHT
	MOVEUL   // UPPER LEFT
	MOVEUR   // UPPER RIGHT
	MOVELL   // LOWER LEFT
	MOVELR   // LOWER RIGHT
	OBSTACLE
)

Jump to

Keyboard shortcuts

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