Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Fractal-tree/Prolog/fractal-tree.pro
Normal file
19
Task/Fractal-tree/Prolog/fractal-tree.pro
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
fractal :-
|
||||
new(D, window('Fractal')),
|
||||
send(D, size, size(800, 600)),
|
||||
drawTree(D, 400, 500, -90, 9),
|
||||
send(D, open).
|
||||
|
||||
|
||||
drawTree(_D, _X, _Y, _Angle, 0).
|
||||
|
||||
drawTree(D, X1, Y1, Angle, Depth) :-
|
||||
X2 is X1 + cos(Angle * pi / 180.0) * Depth * 10.0,
|
||||
Y2 is Y1 + sin(Angle * pi / 180.0) * Depth * 10.0,
|
||||
new(Line, line(X1, Y1, X2, Y2, none)),
|
||||
send(D, display, Line),
|
||||
A1 is Angle - 30,
|
||||
A2 is Angle + 30,
|
||||
De is Depth - 1,
|
||||
drawTree(D, X2, Y2, A1, De),
|
||||
drawTree(D, X2, Y2, A2, De).
|
||||
Loading…
Add table
Add a link
Reference in a new issue