Archimedean spiral: Difference between revisions

Content added Content deleted
imported>Chinhouse
No edit summary
Line 1,838: Line 1,838:
</syntaxhighlight>
</syntaxhighlight>
[[File:Archi spi.png|thumb|center]]
[[File:Archi spi.png|thumb|center]]

=={{header|MiniScript}}==
For use with the [http://miniscript.org/MiniMicro Mini Micro].
<syntaxhighlight lang="miniscript">
clear
x0 = gfx.width / 2
y0 = gfx.height / 2
gfx.clear color.white
for t in range(0, 70 * pi, 0.1)
r = 3.2+ 1.5 * t
x = r * cos(t) + gfx.width / 2
y = r * sin(t) + gfx.height / 2
gfx.line x0, y0, x, y, color.black,2
x0 = x; y0 = y
end for
</syntaxhighlight>

Alternative version using a Turtle library included with the [http://miniscript.org/MiniMicro Mini Micro].

<syntaxhighlight lang="miniscript">
import "turtle"
radToDegrees = function(rad)
return 180 * rad / pi
end function

clear
print Turtle.displayNum
display(Turtle.displayNum).clear
t = new Turtle
for i in range(0, 50, 0.04)
t.forward i
t.left radToDegrees(pi/20)
end for
</syntaxhighlight>


=={{header|Nim}}==
=={{header|Nim}}==