Zebra Stripes



photo by Michael Wain

This CA starts out with cells randomly set to black or white. After a number of generations, the cells organize themselves into a pattern resembling the stripes seen in zebras, tigers, and other striped animals. Each iteration, the cells look at their neighbors and update based on their neighbors' values. In this CA, each cell adds up the number of immediate neighbors who are white (including the diagonals) minus 1/10 of the number of white neighbors in 20x20 blocks to the left and right of its immediate neighbors. If the sum is greater than one the cells becomes white, other wise it becomes black. Because of this, cells want to be the same color as their immediate neighbors, but the opposite color as neighbors from further away to the left and right. Stripes form because the tendency is for a cell to be the opposite color from its left and right distant neighbors, but the same color as the neighbors above and below. The width of the stripes is governed by the size of the blocks of cells to the left and right which are subtracted from the sum.

This system mimics the behavior of a so-called reaction-diffusion system which is believed to cause most coloration patterns and govern cell differentiation in multicelled organisms. In a simple reaction-diffusion system an activator hormone produced by the cells stimulates its own production as well as the production of another hormone that inhibits production of the activator. When the inhibitor diffuses away from the cell more rapidly than the activator it causes distinct groups of cells which are either activated or inhibited. If pigment production is related to the activator production, then spots or stripes of pigment will form.

Source Code:

Links