Added routine to calculate number of live neighbors.