Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Fractal-tree/XPL0/fractal-tree.xpl0
Normal file
21
Task/Fractal-tree/XPL0/fractal-tree.xpl0
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue