private int countLivingNeighbors(int x, int y) {
    int livingNeighbors = 0;

    for (int xx = x - 1; xx < x + 2; xx++) {
      for (int yy = y - 1; yy < y + 2; yy++) {
        if (xx == x && yy == y)
          continue;

        if (isAlive(xx, yy)) {
          livingNeighbors++;
        }
      }
    }

    return livingNeighbors;
  }