# C curve   Acorn  1982
# %n level
# http://www.fundza.com/algorithmic/space_filling/hilbert/basics/

Options {
  PaperSize 2
  Limits {
	#Portrait
	Landscape
 }
  Mode Select
}

( $r2 :=  sqrt 2 )

( ( $x0 := 300  $y0 := 200  $min := 13 ) )

define ccurve [ %l %a ] {
  IFLess %l $min
     Rline  ( %l * cos ( %a ) ) ( %l * sin ( %a )  )
  Else ( (
    %l := %l / $r2
    ccurve [ %l ( %a + $Pi / 4 ) ]
    ccurve [ %l ( %a - $Pi / 4 ) ]

   ) ) Endif

}




path {
  #fillcolour 238 210 255
  outlinecolour blue
  move $x0 $y0
  ccurve [ 700 0 ]
   #close
}


