Group behavior
TO BE DONE
Content in this section is under development.
This section will cover creating a state/behavior model for the entire group of cells.
/**
* Create an initial square grid of cells.
*
* @param {*} gridWidth the width of the grid in cells
* @param {*} maxSize the maximum size the cell can grow to; this must be a
* positive number
* @param {*} minSize the minimum size the cell can shrink to; this must be
* less than maxSize and greater than or equal to zero
* @param {number} growthRate how fast the cell can grow each time the next cell
* state is generated
* @returns {Array<Array<object>>} a two dimensional array of the cells
*/
function buildBehaviorGrid(gridWidth, maxSize, minSize, growthRate) {
let cells = [];
for (let x = 0; x < gridWidth; x++) {
cells[x] = [];
for (let y = 0; y < gridWidth; y++) {
cells[x][y] = spawnCell(maxSize, minSize, growthRate);
}
}
return cells;
}