22 lines
666 B
Plaintext
22 lines
666 B
Plaintext
include c:\cxpl\codes;
|
|
|
|
proc DrawBranch(Lev, Dir, Len, X, Y);
|
|
int Lev; real Dir, Len; int X, Y;
|
|
int Red, Grn;
|
|
[Move(X, Y);
|
|
X:= X + fix(Len*Cos(Dir));
|
|
Y:= Y + fix(Len*Sin(Dir));
|
|
Red:= 255-Lev*8; Grn:= Lev*12+100;
|
|
Line(X, Y, Red<<16+Grn<<8);
|
|
if Lev < 12 then \limit level of recursion
|
|
[DrawBranch(Lev+1, Dir-0.4, Len*0.8, X, Y); \left
|
|
DrawBranch(Lev+1, Dir+0.1, Len*0.8, X, Y); \right
|
|
];
|
|
];
|
|
|
|
[SetVid($112); \set 640x480x24 video graphics mode
|
|
DrawBranch(0, -3.14159/2.0, 80.0, 360, 460);
|
|
if ChIn(1) then []; \wait for keystroke
|
|
SetVid(3); \restore normal text mode
|
|
]
|