SurViVors
a struggle for life on a grid

Abstract

This project uses GP to bread program-cooperatives that can survive and self-replicate in an artificial world.

The World

The artificial world is based on a 2D grid of 100x100 locations. Each location may contain at most one program. A location may also contain "food" and may accumulate at most one unit of food. Such food in the form of "vegetation" that naturally "grows" on the grid at random. The program-cooperatives move around on the grid, eat the food (and each other), develop and reproduce.

Individuals

An individual is a self-replicating cooperative of programs. An individual may have one or more programs, each program occupies a single grid location. All the programs of the same individuals are maintained at some proximity.

Each individual has a genome that consists of a vector of 10 genes. Each gene is a program that can be expressed zero or more times. When a program is expressed it is copied from the respective gene into a vacant grid location and connected to the creating program. The sum of all programs and their connections is the graph of the individual.

Each individual has a food counter, so whenever it eats, the counter is incremented. Whenever it expresses a gene the counter is decremented. The counter must be non-negative for the individual to reproduce. Because all individuals are "born" with their counter set to -1, they must eat at least once to become "fertile".

Execution

The execution of the system is cycle-based such that the output of cycle n is used as an input to cycle n+1. In each cycle the following phases are performed in order:

Programs

A program is a tree of functions and terminals at a maximum height of 5. Each program belongs to a single individual. The program might be connected to other programs and these connections may effect its movement. Each program has a direction register that defines the direction the program seeks to move. The register has i and j components. Positive i means "down", negative means "up". Positive j means "right", negative means "left". Zero for either i or j means "here" respectively. Combinations of i and j can represent each of the 8 directions, including staying at the same place.

Functions

Terminals

Notes:

Kill

When a program is killed:

Reproduction

Reproduction is invoked upon an execution of the express function with a negative argument. If the food counter of the individual is negative, the function is ignored and has no effect. If the food counter is non-negative, the reproduction process takes place as follows:

Mutation and crossover operators are applied to every gene during reproduction at Pm=0.02 and Pc=0.04 rates:

Population Control

The simulation keeps a population of up to a 100 individuals, where all individuals are ordered in a queue. When an individual is created it is inserted at the tail of the queue. Whenever an individual eats, it is removed from its queue position and re-inserted at the tail of the queue. If the size of the queue reaches 101, the individual at the head of the queue is killed including all of its programs. The dead programs are left on the grid to be scavenged.

Physics

At the end of each cycle, every program is moved to its new position according to its direction register and the force exerted on it by the programs it is connected to.

The programs on the grid are scanned in a left-to-right-top-to-down order. For each program, the system calculates a "force" direction. If an adjacent location is available at that direction, the program moves there. Otherwise, the program doesn't move. If the move results in stretching the distance to a connected program beyond 4, the program doesn't move.

The direction of the force is calculated by summing up the direction register with all the "pull" forces. Each connected program at a distance greater than 2 contributes one unit vector of "pull" at its direction.

Display

The grid is displayed divided into locations. Each location indicates the existence of food and a program. An empty location is black. The food is green. An "alive" program is colored in vivid color (high saturation and luminosity) according to its gene. When a program dies, its color becomes "pale" by lowering its saturation and luminosity. Lines are drawn between programs that are connected.

Ancestor

The first self-replicator introduced to the grid is a human-designed replicator. It is added to the grid as a seed of all grid interactions.

Implementation Notes

Hoped-for Results

Output


Valid HTML 4.01! (C) Copyright 2004, by Barak Naveh. All rights reserved.