Zoe: organisms that hunt, mate, reproduce, and evolve under the
control of algorithms that mutate.
See:
Description
Packages |
org.holtz.zoe |
A Zoe World with evolvable Bugs controlled by Genes coded as
mutating Zoel programs.
|
org.holtz.zoe.zoel |
A Turing-complete mutatable programming language featuring block
statements, a stack, a heap, registers of sensory data, and
operators to perform actions in the Zoe World.
|
org.holtz.zoe.zoeswing |
A Swing GUI to display and control a Zoe World and its Bugs.
|
Zoe: organisms that hunt, mate, reproduce, and evolve under the
control of algorithms that mutate.
Features
In Zoe, organisms ("bugs") are simulated creatures that
- feel and see nearby objects,
- turn and move toward or away from sensed objects,
- get energy from sunlight or from objects they bite,
- sense physical and genetic attributes of themselves and of
nearby bugs,
- think and act by executing "genes": subroutines running in the
bug's virtual machine, and
- mate, reproduce, and evolve through mutation and sexual
recombination of these genes.
Behavior, Not Structure
Zoe bugs have no physical or structural attributes, and instead only
have functional attributes like position, heading, size, energy
level, memory, and sensory data. Each gene of a bug is a
When/Do pair of programs in a Turing-complete language called Zoel.
Each gene executes on a separate thread in the virtual machine for
each bug. The genome of a species is a priority-ordered list
of genes, and higher-priority genes can interrupt lower-priority
genes if their When program evaluates to true. Genes are
sometimes deleted, reordered, or mutated during asexual
reproduction, resulting in a new species. If the parent mated before
giving birth, then the child gets half its genes from each parent,
also creating a new species. Thus evolution in Zoe modifies the
behavior of bugs, not their structure or appearance. (However, each
species has a distinct color in the Zoe graphical view, and mutant
species are randomly assigned a color slightly different from that
of the mother's species.)
Energy and the Zoel VM
The resources in a Zoe world are energy, plus execution time and
memory space in each bug's Zoel virtual machine.
- Energy enters Zoe through constant sunlight that every bug
automatically absorbs, and through randomly-generated simple
bugs that drift spontaneously into the world. Energy leaves Zoe
by bug locomotion and by inefficiency in eating and reproducing.
- During each cycle of a Zoe world, each living bug gets a turn
to execute its genome. Its turn continues until the bug executes
1) an operation that costs energy or 2) the maximum per-turn
number of energy-free operations.
- Each Zoe bug has a private call stack and data stack for each
of its genes, and an associative heap that is shared by all its
genes. The sizes of these data structures are limited as a
function of the bug's size. When the limits are reached, the
oldest elements drop off the bottom of the stack or are removed
from the heap.
The Zoel Genotype
A Zoel genotype is a priority-ordered list of genes. A gene is a When/Do
pair of programs written in Zoel. The When programs are
evaluated in order, to find the highest-priority gene whose When
evaluates to true. That gene's Do program is then executed.
A Zoel program is a list of expressions. An expression can be an
operation, a value, or another list of expressions. An operation
specifies an operator and an optional operand. An operator operates
on one or both of its optional operand and the top element of the
data stack. Operands and stack elements may be string literals
or floating point numbers. Operands (but not stack elements) may
also be:
- a reference to a "hardware register" (bug attribute)
- a reference to a stack element (keyed by integer depth)
- a reference to a heap value (keyed by any literal)
- a list of expressions
The Zoel grammar is:
Genotype ::== GeneList
GeneList ::== Gene GeneList
Gene ::== When ExpressionList Do ExpressionList
Gene ::== Do ExpressionList
ExpressionList ::== Label: { Expressions }
ExpressionList ::== { Expressions }
Expressions ::== Expression | Expression , Expressions
Expression ::== Value | Operation | ExpressionList
Operation ::== Operator | Operator Expression
Value ::== StringLiteral | Number | Me.Register | It.Register
| Stack.Integer | Heap.Key
Operator ::== Move | Turn | Bite | Spawn | Split | Mate | EndTurn
| SenseFarther | Mood | Print
| IfThen | Else | While | Call
| Push | Pop | Set | Get
| And | Or | Equals | LessThan | GreaterThan
| Plus | Minus | Times | DividedBy | Modulus
| Not | Random | Negate | AbsoluteVal
Register ::== Cycle | ID | Species | Age | Size | Strength | Mood | Pain | Heading
| Location | BirthLocation | AncestralLocation
| FeelSomething | SeeSomething | Toward | Away
| Range | IsAlive | IsLastMate | IsSameSpecies
| IsParent | IsChild | IsAncestor | IsDescendant | IsFamily
Example Zoe Genome
When {
Me.FeelSomething,
And Not It.IsSameSpecies
} Do {
Bite
}
When {
Me.SeeSomething,
And Not It.IsSameSpecies
} Do {
Turn Me.Toward,
Move
}
When {
{
Me.SeeSomething,
And It.IsSameSpecies
} And {
It.Size,
GreaterThan Me.Size
}
} Do {
// Flock with conspecific leader
Turn It.Heading,
Move
}
Do {
Move,
Spawn
}