Refactor getTotalLiveNeighbor