creature

package
v0.0.0-...-309fd15 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// Antenna types.
	AntennaLeft  = 1
	AntennaRight = 2
)

Fixed values.

View Source
const (
	// Booster types.
	BoosterLinear  = 1
	BoosterAngular = 2

	// Velocity scaling.  Linear is in pixels, but rotation is in radians - so scale the latter down.
	LinPerAng = 10

	// Maximum velocity.
	MaxLinVel = 1.0
	MaxAngVel = MaxLinVel / LinPerAng
)

Fixed values.

View Source
const (
	MaxVitality      = 600
	InitialVitality  = 300
	SpeedDegredation = 0.9
)

Fixed values.

Variables

This section is empty.

Functions

This section is empty.

Types

type Creature

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

The high-level creature struct.

func New

Initialize a new creature object.

func NewSimple

func NewSimple(lm locationmanager.Detection) *Creature

Generate a basic creature.

func (*Creature) AddAntenna

func (host *Creature) AddAntenna(antType int) *antenna

Add a new antenna object to a creature.

func (*Creature) AddBoosters

func (host *Creature) AddBoosters() (*booster, *booster)

Add a standard set of boosters to a host; one angular and one linear.

func (*Creature) AddMouth

func (host *Creature) AddMouth() *mouth

Add a new mouth to a creature. This is at the front of the creature.

func (*Creature) AddPulser

func (host *Creature) AddPulser() *pulser

Add a new pulser to a creature.

func (*Creature) Breed

func (cx *Creature) Breed(cy *Creature) *Creature

Breed a new creature from two existing ones.

func (*Creature) Check

func (c *Creature) Check() bool

Check the status of the creature and update LM appropriately. Returns a boolean for whether teardown occured.

func (*Creature) Clone

func (c *Creature) Clone() *Creature

Clone an existing creature.

func (*Creature) Color

func (c *Creature) Color() color.RGBA

Get the colour of the creature.

func (*Creature) Consume

func (c *Creature) Consume() float64

Creatures cannot consume each other.

func (*Creature) Prepare

func (c *Creature) Prepare()

Generates a new random DNA string for a creature and injects it into the brain. Must be called AFTER all outputs and inputs have been added.

func (*Creature) Radius

func (c *Creature) Radius() float64

Creatures always report a radius of zero, as they cannot be detected.

func (*Creature) Work

func (c *Creature) Work()

Do all updating and moving of a creature.

Jump to

Keyboard shortcuts

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