18 lines
418 B
Text
18 lines
418 B
Text
procedure main()
|
|
WOpen("size=800,600", "bg=black", "fg=white") | stop("*** cannot open window")
|
|
drawtree(400,500,-90,9)
|
|
WDone()
|
|
end
|
|
|
|
link WOpen
|
|
|
|
procedure drawtree(x,y,angle,depth)
|
|
if depth > 0 then {
|
|
x2 := integer(x + cos(dtor(angle)) * depth * 10)
|
|
y2 := integer(y + sin(dtor(angle)) * depth * 10)
|
|
DrawLine(x,y,x2,y2)
|
|
drawtree(x2,y2,angle-20, depth-1)
|
|
drawtree(x2,y2,angle+20, depth-1)
|
|
}
|
|
return
|
|
end
|