Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Fractal-tree/Amazing-Hopper/fractal-tree.hopper
Normal file
32
Task/Fractal-tree/Amazing-Hopper/fractal-tree.hopper
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Execute with:
|
||||
|
||||
$ hopper jm/tree.jambo -x -o bin/tree
|
||||
$ rxvt -g 280x250 -fn "xft:FantasqueSansMono-Regular:pixelsize=1" -e ./bin/tree
|
||||
|
||||
*/
|
||||
|
||||
#include <jambo.h>
|
||||
|
||||
Main
|
||||
Set '25, 0.76, 160, 100, 10' Init 'Spread, Scale, SizeX, SizeY, Depth'
|
||||
Color back '22', Cls
|
||||
Color back '15'
|
||||
Set '{SizeX} Mul by (2), -30, Div(SizeY,2), 90, Depth' Gosub 'Branch'
|
||||
Pause
|
||||
End
|
||||
|
||||
Subrutines
|
||||
|
||||
Define 'Branch, x1, y1, size, angle, depth'
|
||||
x2=0, y2=0
|
||||
Let ( x2 := #(x1 + size * cos(d2r(angle))) )
|
||||
Let ( y2 := #(y1 + size * sin(d2r(angle))) )
|
||||
Draw a line ( #(180-y1), #(180-x1), #(180-y2), #(180-x2))
|
||||
If ( #( depth > 0) )
|
||||
Set (x2, y2, {size} Mul by 'Scale', {angle} Minus 'Spread',\
|
||||
Minus one(depth)) Gosub 'Branch'
|
||||
Set (x2, y2, {size} Mul by 'Scale', {angle} Plus 'Spread',\
|
||||
Minus one(depth)) Gosub 'Branch'
|
||||
End If
|
||||
Return
|
||||
Loading…
Add table
Add a link
Reference in a new issue