s:

The countNeighbors function takes the x and y coordinates of a cell and counts the number of live neighbors it has (neighbors can be in eight directions).
Updating the Grid:

The updateGrid function applies the rules of Conway's Game of Life to update the grid:
For each cell, it counts the number of live neighbors.
Based on the rules, it determines whether the cell should live, die, or remain unchanged.
The new state is stored in a newGrid array to avoid affecting the current iteration.
After p