Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
23
Task/Fractal-tree/Sidef/fractal-tree.sidef
Normal file
23
Task/Fractal-tree/Sidef/fractal-tree.sidef
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
func tree(img, x, y, scale=6/10, len=400, angle=270) {
|
||||
|
||||
len < 1 && return()
|
||||
|
||||
img.moveTo(x, y)
|
||||
img.angle(angle)
|
||||
img.line(len)
|
||||
|
||||
var (x1, y1) = img.curPos
|
||||
tree(img, x1, y1, scale, len*scale, angle+35)
|
||||
tree(img, x1, y1, scale, len*scale, angle-35)
|
||||
}
|
||||
|
||||
require('GD::Simple')
|
||||
|
||||
var (width=1000, height=1000)
|
||||
var img = %s|GD::Simple|.new(width, height)
|
||||
img.fgcolor('black')
|
||||
img.penSize(1, 1)
|
||||
|
||||
tree(img, width/2, height)
|
||||
|
||||
File('tree.png').write(img.png, :raw)
|
||||
Loading…
Add table
Add a link
Reference in a new issue