Project 2: Slather

This project is inspired by slither.io, a strangely addictive multi-player online game.

You are controlling a circular cell living and moving in an environment with other cells. Cells grow over time. Once they double in radius they stop growing, and can reproduce into two smaller daughter cells that can independently move about the environment. Cells produce a pheremone that is secreted onto the ground as a cell passes (a small point-like dose at the center of the cell). Other cells of the same species are able to traverse pheremone points, but other species (i.e., other players' cells) find the pheremone repulsive and will not traverse such points. Pheremones do not last forever though; they eventually wear out.

Your goal is to maximize the population of your cell type after many turns of the game have elapsed. To achieve this goal, you will program the cell to decide its actions on each turn of the simulator. A cell may move, or reproduce if it has reached full size. The cell has access to a limited amount of locally sensed information (see below). It also can keep a small amount (one byte) of state memory from one turn to the next. Your code will be called by the simulator on each turn with this memory item supplied, and your code should return a byte for use in the next iteration. (Obviously, you are not allowed to declare persistent variables or read/write persistent data that would circumvent this requirement.)

On each turn, the simulator will choose a random ordering of all cells on the board, and resolve moves/growth/reproduction one cell at a time according to that order.

The world is 10cm by 10cm, and wraps around like a torus, so that a cell moving off the left edge appears on the right edge, and analogously for the top and botton edges. Cells start out with a diameter of 1mm, located at random nonoverlapping positions in the world. You will instruct the cell to move by up to 1mm on a turn, in any direction. You will be supplied with the memory state together with a list of pheremone points (from both self and foreign species -- you will know which points are from which species) located within dmm of the circumference of your cell, where $d \geq 1$ is a parameter. This list will include all self-pheremone points covered by the cell. Additionally, any other cells that extend into this dmm buffer will be visible: you will be supplied with the center and radius of all such cells. The simulator will reject any moves that would cause the cell to traverse a foreign pheremone or overlap another cell; in such a case the cell will stay put.

Cell diameters grow by up to 1% each turn, but stop at 2mm. Cells will grow by less than 1% if the simulator determines that further growth would cause the cell to traverse a point covered by a foreign pheremone or by another cell. This growth is automatic, and determined by the simulator without explicit instructions from your controller, once the cell has moved. The deposition of pheremones is also automatic.

When a cell reaches a diameter of 2mm, you may instruct it to reproduce into two daughter cells each of diameter 1mm (some cell mass is lost in this process). The simulator will choose a random direction for the split, and the two daughter cells will be within the footprint of the original parent cell. When a cell reproduces, there is no additional cell movement or growth on that turn. At the end of reproduction you give the simulator two different memory bytes, one for each daughter cell.

An unimpeded cell should be able to reproduce in 70 turns. The simulator will stop the simulation when 1000 consecutive turns have happened without any reproduction.

Several aspects of the simulations will be determined by parameters:

d
The distance that a cell can see.
t
The number of turns before a pheremone wears out.
p
The number of players (species).
n
The number of starting cells for each player.
We will vary these parameters when we run tournaments at the end of the project. Your player will have access to d and t, but will not know p or n since this is nonlocal information.

Some initial things to think about:

2016-10-24