Zoe: organisms that hunt, mate, reproduce, and evolve under the control of algorithms that mutate.


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.


In Zoe, organisms ("bugs") are simulated creatures that

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.

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:
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 {
And Not It.IsSameSpecies
} Do {

When {
And Not It.IsSameSpecies
} Do {
Turn Me.Toward,

When {
And It.IsSameSpecies
} And {
GreaterThan Me.Size
} Do {
// Flock with conspecific leader
Turn It.Heading,

Do {