This simulation implements Epstein and Axtell’s Sugarscape model.
Each ‘sugar’ cell is fixed and has a predetermined amount of sugar that is mapped to a specific height and color. These sugar values are then diffused for a certain number of steps to make traversal of the cells easier for the agents.
Agents start randomly on the grid of ‘sugar’ cells and roam the grid, accumulating sugar. At each step, agents look at their neighbors and moves to the cell with the greatest amount of sugar.