int laskeRivit(Muodostelma muod) {
        int rivit = 0;
        int korkeinY = 19;
        int matalinY = 0;
        for (int i = 0; i < 4; i++) {
            Palikka p = muod.getPalikat().get(i);
            int x = p.getX();
            int y = p.getY();
            if (y < korkeinY){
                korkeinY = y;
            } else if (y > matalinY){
                matalinY = y;
            }
            this.pelipalikat[y][x] = p;
        }
        for (int i = matalinY; i >= korkeinY; i--) {
            if (pelipalikat[i][0] != null) {
                boolean taysi = true;
                for (int j = 0; j < pelipalikat[i].length; j++) {
                    if (pelipalikat[i][j] == null) {
                        taysi = false;
                        break;
                    }
                }
                if (taysi) {
                    rivit++;
                }
            }
        }
        for (int i = 0; i < 4; i++) {
            Palikka p = muod.getPalikat().get(i);
            int x = p.getX();
            int y = p.getY();
            this.pelipalikat[y][x] = null;
        }
        return rivit;
    }