rocessing all cells, the grid is updated with the new state, and the grid is redrawn on the canvas.
If the simulation is running (isRunning is true), it schedules the next iteration using requestAnimationFrame.
Toggling Simulation:

The toggleSimulation function starts or stops the simulation. It changes the button text accordingly and either starts the animation loop or cancels it using requestAnimationFrame.
Clearing the Grid:

The clearGrid function resets the grid to an empty state when the "Clea