Having trouble computing the number of occupied neighbors each cell in the array has. Any help would be greatly appreciated.

```
Array[rows][cols-1]
Array[rows+1][cols-1]
Array[rows-1][cols]
Array[rows][cols]
Array[rows+1][cols]
Array[rows-1][cols+1]
Array[rows][cols+1]
Array[rows+1][cols+1]
```