slime

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

* This code was ported from https://play.ertdfgcvb.xyz/#/src/contributed/slime_dish

The original header was as follows: @author zspotter (IG @zzz_desu, TW @zspotter) @title Slime Dish @desc Low-res physarum slime mold simulation

🔍 Tap and hold to magnify.

With inspiration from: - https://sagejenson.com/physarum - https://uwe-repository.worktribe.com/output/980579 - http://www.tech-algorithm.com/articles/nearest-neighbor-image-scaling

Index

Constants

View Source
const (
	WIDTH      int = 400
	HEIGHT     int = 400
	NUM_AGENTS     = 1500
	DECAY          = 0.9
	MIN_CHEM       = 0.0001
	ASPECT         = 0.5017144097222223

	SENS_ANGLE = 45 * math.Pi / 180
	SENS_DIST  = 9
	AGT_SPEED  = 1
	AGT_ANGLE  = 45 * math.Pi / 180
	DEPOSIT    = 1

	OOB = ' '
)

Variables

View Source
var (
	TEXTURE0 = []rune("  ``^@")
	TEXTURE1 = []rune(" ..„v0")
)

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Pos Vec2
	Dir Vec2
	// contains filtered or unexported fields
}

func (*Agent) Deposit

func (a *Agent) Deposit(chem []float64)

func (*Agent) React

func (a *Agent) React(chem []float64)

func (*Agent) Sense

func (a *Agent) Sense(m float64, chem []float64) float64

type Cursor

type Cursor struct {
	Pressed bool
	X, Y    float64
}

type Simulator

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

func New

func New(rows, cols int) *Simulator

func (*Simulator) Render

func (s *Simulator) Render(out image.Image)

func (*Simulator) Step

func (s *Simulator) Step(cursor Cursor)

type Slime added in v1.3.0

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

func (*Slime) Init added in v1.3.0

func (f *Slime) Init(start image.Image)

func (*Slime) Update added in v1.3.0

func (f *Slime) Update(delta time.Duration) image.Image

type Vec2

type Vec2 struct {
	X, Y float64
}

func (Vec2) Add

func (v Vec2) Add(other Vec2) Vec2

func (Vec2) MulN

func (v Vec2) MulN(n float64) Vec2

func (Vec2) Rot

func (v Vec2) Rot(angle float64) Vec2

Jump to

Keyboard shortcuts

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