The program endlessly calculates the generations. It determines the new values for all squares, and then "copies" these values into the visible world:
for y in 1..size_y-2
for x in 1..size_x-2
newCells[y][x] = newCellValue(cells, y, x)
end
end
for y in 1..size_y-2
for x in 1..size_x-2
cells[y][x] = newCells[y][x]
world.setLeaf(x, y, cells[y][x])
end
end
tools.checkState()