set display mode 1024,768,32
start:
cls
 
 
boxx=600
boxy=600
segment=10
 
 
`draw box
ink -1,0
box 0,0,boxx,boxy
 
for p=1 to 2
 
boxx=600
boxy=600
 
for n=1 to 4
ink 0,0
 
  `draw horizintal wall
  wally=(1+rnd((boxx-(segment*2))/segment))*segment
  line 0,wally,boxx,wally
  `draw vertical line
 
  wallx=(1+rnd((boxy-(segment*2))/segment))*segment
  line wallx,0,wallx,boxy
  colour=rnd(2)
  if colour=0 then ink rgb(255,0,0),0
  if colour=1 then ink rgb(255,255,0),0
  if colour=2 then ink rgb(0,0,255),0
  if rnd(2)=0 then box 0,0,wallx,wally else box wallx,wally,boxx,boxy
`iterate
 
boxx=wallx
boxy=wally
 
next n
next p
 
text 0,650,"Press Space for next Mondrian"
sync
wait key
goto start