public double[][] genMap(){
		initMap();
		double var = maxHeight; // max random variation
		int side = size;// the side of the smallest square with all four points generated
		while (side >1){
			int xNr;
			int yNr;
			for (xNr=0;xNr<size;xNr+=side) // diamond step
				for(yNr=0;yNr<size;yNr+=side)
					makeDiamond(xNr,yNr,side,var);
			for(xNr=0;xNr<=size;xNr+=side/2) // square step
				for(yNr=(xNr+side/2)%side;yNr<=size;yNr+=side)
					makeSquare(xNr,yNr,side,var);
			side/=2;// next square stage
			var/=factor; // random variation decreases
		}
		return heights;
		
			
	}