private int neighbors(int row, int col) {
        int count = 0;

        for(int r = row-1; r <= row+1; r++)
            for(int c = col-1; c <= col+1; c++) {
                if(r < 0 || r >= map.length ||
                        c < 0 || c >= map[0].length)
                    continue;
                if(map[r][c] == true)
                    count++;
            }

        if(map[row][col] == true)
            count--;

        return count;
    }