mind

package
v0.0.0-...-d13aec0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const FiringLimit = 7777
View Source
const ResidualCharge = -111

Variables

This section is empty.

Functions

func Act

func Act(brain *Brain)

Types

type Brain

type Brain struct {
	BrainName   string            `json:"brain_name"`   // Unique name to be used for the brain
	StoragePath string            `json:"storage_path"` // The folder the data needs to be put in
	Linkups     map[string]Linkup `json:"linkups"`      // The set of Linkups for this brain
	// contains filtered or unexported fields
}

Brain contains all information that relates to the brain as a whole.

func LoadBrain

func LoadBrain(storagePath, brainName string) (*Brain, error)

func NewBrain

func NewBrain(basePath, name string) Brain

NewBrain creates a new Brain structure, and returns it (not a reference).

func (*Brain) AddNeuron

func (b *Brain) AddNeuron(neuron *Neuron)

func (*Brain) DeleteNeuron

func (b *Brain) DeleteNeuron(guid string)

func (*Brain) GetNeuron

func (b *Brain) GetNeuron(ID string) *Neuron

GetNeuron returns a reference to a Neuron if it is In the loaded map, or a nil reference otherwise.

func (*Brain) GetNeuronIfLoaded

func (b *Brain) GetNeuronIfLoaded(ID string) *Neuron

GetNeuronIfLoaded returns a reference to a Neuron if it is In the loaded map, or a nil reference otherwise.

func (*Brain) GetStorageFolder

func (b *Brain) GetStorageFolder(baseFolder string) string

func (*Brain) LoadAllLinkupNeurons

func (b *Brain) LoadAllLinkupNeurons()

func (*Brain) LoadLinkupNeurons

func (b *Brain) LoadLinkupNeurons(linkupName string)

func (*Brain) LoadNeuron

func (b *Brain) LoadNeuron(neuronName string) (*Neuron, error)

func (*Brain) LoadedSize

func (b *Brain) LoadedSize() int

LoadedSize returns the size of the map containing the Neurons loaded In memory.

func (*Brain) QueueForCharging

func (b *Brain) QueueForCharging(neuron *Neuron)

func (*Brain) QueueForFiring

func (b *Brain) QueueForFiring(neuron *Neuron)

func (*Brain) StoreBrain

func (b *Brain) StoreBrain() error

func (*Brain) StoreNeuron

func (b *Brain) StoreNeuron(neuron *Neuron) error

func (*Brain) UnQueueFromCharging

func (b *Brain) UnQueueFromCharging() *Neuron

func (*Brain) UnQueueFromFiring

func (b *Brain) UnQueueFromFiring() *Neuron

type Entity

type Entity struct {
	ID           string
	BytesInput   int
	BytesOutput  int
	IsConnected  bool
	Base64Input  string
	Base64Output string
}

func NewEntity

func NewEntity(entityID string, bytesInput, bytesOutput int) *Entity

type Linkup

type Linkup struct {
	Name   string   `json:"linkupname"` // Unique ID
	Nerves []string `json:"nerve_ids"`  // The pre-assigned set of Neurons
	Dirty  bool     `json:"dirty"`      // is the Linkup not synced to disk?
	// contains filtered or unexported fields
}

Linkup contains all information that relates to a single Linkup to an input/output device.

func NewLinkup

func NewLinkup(brain *Brain, nervecount int, name string) Linkup

NewLinkup returns a new Linkup properly initialized

func (*Linkup) Sense

func (l *Linkup) Sense(brain *Brain)

type LinkupConsole

type LinkupConsole struct {
	Linkup // the connected Linkup module
}

Linkup contains all information that relates to a single Linkup to an input/output device.

func NewLinkupConsole

func NewLinkupConsole(brain *Brain, name string) LinkupConsole

NewLinkupConsole returns a new Linkup properly initialized

func (*LinkupConsole) StartLinkup

func (c *LinkupConsole) StartLinkup()

type Neuron

type Neuron struct {
	Name   string         `json:"brain_name"` // Unique ID
	In     map[string]int `json:"in"`         // IDs of incoming Neurons
	Out    map[string]int `json:"out"`        // IDs of outgoing Neurons
	Charge int            `json:"charge"`     // the charge level
	Dirty  bool           `json:"dirty"`      // is the neuron not synced to disk?
}

Neuron contains all information that relates to a single neuron In the brain.

func NewNeuron

func NewNeuron(brain Brain) *Neuron

NewNeuron returns a new neuron properly initialized

func (*Neuron) Accumulate

func (n *Neuron) Accumulate(brain *Brain)

func (*Neuron) AddNeuronIn

func (n *Neuron) AddNeuronIn(neuron *Neuron)

AddNeuronIn adds a neuron to the

func (*Neuron) AddNeuronOut

func (n *Neuron) AddNeuronOut(neuron *Neuron)

func (*Neuron) Distribute

func (n *Neuron) Distribute(b *Brain)

func (*Neuron) GetFirstIn

func (n *Neuron) GetFirstIn() string

func (*Neuron) GetFirstOut

func (n *Neuron) GetFirstOut() string

Jump to

Keyboard shortcuts

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