private void setWaveNums() {
        int dx[] = {1, 0, -1, 0};
        int dy[] = {0, 1, 0, -1};
        boolean stop = true;
        ArrayList<Cell> markedCells = new ArrayList<>();
        markedCells.add(begin);
            stop = true;
            for (int j = 0; j < markedCells.size(); j++) {
                Cell cell = markedCells.get(j);
                for (int i = 0; i < 4; ++i) {
                    if (cell.getX() + dx[i] < cells.length
                            && cell.getY() + dy[i] < cells.length
                            && cell.getX() + dx[i] >= 0
                            && cell.getY() + dy[i] >= 0
                            && cells[cell.getX() + dx[i]][cell.getY() + dy[i]] != null
                            && cells[cell.getX() + dx[i]][cell.getY() + dy[i]].getWavenum() == -1) {
                        stop = false;
                        cells[cell.getX() + dx[i]][cell.getY() + dy[i]].setWaveNum(cell.getWavenum() + 1);
                        markedCells.add(cells[cell.getX() + dx[i]][cell.getY() + dy[i]]);
                    }
                   //markedCells.remove(cell);
                }   
            }

//        int dx[] = {1, 0, -1, 0};
//        int dy[] = {0, 1, 0, -1};
//        System.out.println(c.getX() + " " + c.getY());
//        for (int i = 0; i < 4; ++i) {
//            if (c.getX() + dx[i] < cells.length
//                    && c.getY() + dy[i] < cells.length
//                    && c.getX() + dx[i] >= 0
//                    && c.getY() + dy[i] >= 0
//                    && cells[c.getX() + dx[i]][c.getY() + dy[i]] != null
//                    && cells[c.getX() + dx[i]][c.getY() + dy[i]].getWavenum() == -1) {
//                cells[c.getX() + dx[i]][c.getY() + dy[i]].setWaveNum(curWaveNum + 1);
//                setWaveNums(cells[c.getX() + dx[i]][c.getY() + dy[i]], curWaveNum + 1);
//            }
//        }
    }