goids

package
v0.0.0-...-e40663e Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GopherSize = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	SideImage image.Image
	PinkImage image.Image
	// contains filtered or unexported fields
}

func CreateEnv

func CreateEnv(width, height float64, n int, maxSpeed, maxForce float64, sight float64) Environment

func (Environment) Goids

func (e Environment) Goids() []Goid

func (Environment) GoidsNum

func (e Environment) GoidsNum() int

func (Environment) Height

func (e Environment) Height() float64

func (Environment) Render

func (e Environment) Render() string

func (Environment) RenderImage

func (e Environment) RenderImage() image.Image

func (*Environment) Update

func (e *Environment) Update()

func (Environment) Width

func (e Environment) Width() float64

type Goid

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

func (*Goid) AdjustEdge

func (g *Goid) AdjustEdge(width, height float64)

func (*Goid) Align

func (g *Goid) Align(goids []Goid)

func (*Goid) Cohesive

func (g *Goid) Cohesive(goids []Goid)

func (*Goid) Flee

func (g *Goid) Flee(t Vector)

func (*Goid) Flock

func (g *Goid) Flock(goids []Goid)

func (Goid) IsInsight

func (g Goid) IsInsight(g2 Goid) bool

func (*Goid) Seek

func (g *Goid) Seek(t Vector)

func (*Goid) Separate

func (g *Goid) Separate(goids []Goid)

func (*Goid) Update

func (g *Goid) Update(width, height float64)

type ImageType

type ImageType int
const (
	Front ImageType = iota
	Side
	Pink
)

type Vector

type Vector struct {
	X float64
	Y float64
}

func CreateVector

func CreateVector(x, y float64) Vector

func Sub

func Sub(v2, v1 Vector) Vector

func (*Vector) Add

func (v *Vector) Add(v2 Vector)

func (Vector) Len

func (v Vector) Len() float64

func (*Vector) Limit

func (v *Vector) Limit(l float64)

func (*Vector) ScalarMul

func (v *Vector) ScalarMul(c float64)

func (*Vector) Scale

func (v *Vector) Scale(l float64)

func (*Vector) Sub

func (v *Vector) Sub(v2 Vector)

Jump to

Keyboard shortcuts

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