Spectacular Cellular Automata
    Preparing search index...

    Function clearGrid

    • Clear all cells.

      Returns void

      export function clearGrid() {
      let clearedCells = new Set();
      sharedState.cells.forEach((cell, i) => {
      if (cell !== 0) {
      // Dying cells would be undone as alive cells
      sharedState.cells[i] = 0;
      clearedCells.add(i);
      }
      });

      pushHistory(Change(clearedCells, 0, "Clear"));
      }