News & Events
<Programming Challenge
*Past Developer Conferences
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

Mathematica Programming Challenge 2001

Download the Mathematica notebook of solutions.

The Challenge: Aggregation!

Simulate a simple model of aggregation on a 2D grid: start with a single black cell, and at each step fill in a random white neighbor of a randomly selected existing black cell.

The Details

This is a simple model of growth sometimes called the Eden model (specifically, a type B Eden model). The model has been used since the 1960s as a model for such things as tumor growth and growth of cities. Here's how it works. Have a 2D grid of black and white cells (1s and 0s). Start with a single black cell. At each step, select at random an existing black cell that has at least one white neighbor. Then select a neighboring white cell at random, and make it black. (By neighbor we mean a cell above, below, left or right--not diagonal.) Your function should be Aggregate[state, t]; state should be an array of 0s and 1s, t should be the number of steps, and the result should be another array of 0s and 1s, with exactly t new black cells. Your function should allow the cluster of black cells to get as big as it wants (i.e., the array may grow). Unfilled cells should always be assumed white. See if you can generate a really big cluster. Make a picture of it, using ListDensityPlot. Is it a circle?

Have Fun!

A selection of the most efficient or most elegant solutions will be presented at the dinner Friday night.

If You are Feeling Adventurous...

...you could try changing the criterion for growth, and seeing what shapes you can get. For example, allow growth only when the neighbors around a cell have some particular form. What shapes can you make?

Download this information as a notebook.