De Stijl Recursion

Weight of Divisions

Weight of Colors

Drawing Options


	  	function draw( x, y, w, h ):
	  		select random color
	  		draw rectangle with top left corner (x,y) of width w and height h 
	  	function mondrian( x, y, w, h ):
	  		if ( w or h is below threshold ):
	  			choose random value from 0, 1, or 2 
	  			if ( value is 0 ):
	  				do nothing
	  			else if ( value is 1 ):
	  				neww := random value between 0 and w 
	  				mondrian( x, y, nw, h )
	  				mondrian( x+nw, y, w-nw, h )
	  			else if ( value is 2 ):
	  				newh := random value between 0 and h 
	  				mondrian( x, y, w, nh )
	  				mondrian( x, y+nh, w, h-nh )