genetics

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: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// Length of a gene, in bytes.
	GENELEN = 4

	// A gene contains four bytes for a signed integer.
	MAXGENEVAL = (2147483647.0)
)

Variables

This section is empty.

Functions

func CompareSequence

func CompareSequence(dx, dy *Dna) bool

Compare two genetic sequences to see if they match.

func NewGene

func NewGene(value float64) *gene

func NewRandomGene

func NewRandomGene() *gene

Generate a new random gene.

Types

type Dna

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

A full sequence of genetic information. This is variable in length, as the amount of genetic information is dependent on the brain's structure.

func NewDna

func NewDna() *Dna

Generate a new sequence of DNA. This is initially empty, until populated.

func (*Dna) AddGene

func (d *Dna) AddGene(g *gene)

Add a gene to the genetic sequence.

func (*Dna) Breed

func (dx *Dna) Breed(dy *Dna) *Dna

Breed with an external DNA strand to produce a child sequence. Simulate genetic recombination, rather than randomly picking genes from each.

func (*Dna) Clone

func (d *Dna) Clone() *Dna

Cloning, like breeding but with less parents and more science.

func (*Dna) GetValues

func (d *Dna) GetValues() chan float64

Channel over which we retrieve values from a sequence of DNA.

Jump to

Keyboard shortcuts

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