Archimedean spiral: Difference between revisions

m
Replace deprecated functions
(Easylang)
m (Replace deprecated functions)
 
(7 intermediate revisions by 5 users not shown)
Line 498:
 
imgsave "spiral-Basic-256.png", "PNG"
</syntaxhighlight>
 
==={{header|BBC BASIC}}===
{{works with|BBC BASIC for Windows}}
[[File:Archimedean_spiral_bbc_basic.jpeg|300px|right]]
<syntaxhighlight lang="bbcbasic"> A=320
VDU 23, 22, A+10; A+10; 8, 16, 16, 128
ORIGIN @size.x%, @size.y%
GCOL 7
FOR I=-(A - A MOD 100) TO A - A MOD 100 STEP 100
LINE I, -A, I, A : LINE -A, I, A, I
NEXT
 
MOVE 0, 0
GCOL 1
VDU 23, 23, 3|
FOR I=0 TO 5 * PI STEP .05
R=A / 16 * I
DRAW R * COS(I), R * SIN(I)
NEXT
</syntaxhighlight>
 
Line 1,109 ⟶ 1,129:
=={{header|EasyLang}}==
 
[https://easylang.dev/show/#cod=JYxBCoAgFET3/xSzThALapWnKaEPpqCSevv8tZp5w8x4Dq7yWS4YvVCDxWqo/3LHx6GhU73YOyTskgLwYzRwwhEzCtQoCWUOH3XpJCg7PmfxRfxGml4JcwxCsAgEETRfk8xdQQRol08TSK4IAZUUG8f11TDg88kzqHz0yKMtjTg4QzNf3rkFFBwCQCk1S4euN+KBoWxVTlvTWkKlF9Xxgma4CRNHw== Run it]
 
<syntaxhighlight lang="easylang">
linewidth 0.24
x = 50
y = 50
move x y
while r < 50
line r * cos t + x r * sin t + y
r += 0.105
t += 63
.
</syntaxhighlight>
Line 1,839 ⟶ 1,858:
</syntaxhighlight>
[[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}}==
Line 2,600 ⟶ 2,653:
return
</syntaxhighlight>
 
=={{header|RPL}}==
[[File:Archimedean.png|thumb|right|HP-48G emulator screenshot]]
{{works with|HP|48G}}
« → a b
« -20 20 DUP2 XRNG YRNG
POLAR RAD 'a+b*t' STEQ { t 0 18.9 } INDEP
ERASE DRAW { } PVIEW
{ EQ PPAR } PURGE
» » '<span style="color:blue">ARCHI</span>' STO
 
1 1 <span style="color:blue">ARCHI</span>
 
=={{header|Ruby}}==
Line 2,835 ⟶ 2,900:
theta +:= delta;
end while;
DRAW_FLUSHflushGraphic;
ignore(getc(KEYBOARD));
end func;</syntaxhighlight>
Line 2,939 ⟶ 3,004:
{{trans|Sidef}}
{{libheader|DOME}}
<syntaxhighlight lang="ecmascriptwren">import "graphics" for Canvas, Color
import "dome" for Window
 
Line 2,967 ⟶ 3,032:
static draw(dt) {}
}</syntaxhighlight>
 
{{out}}
[[File:Wren-Archimedean_spiral.png]]
 
=={{header|XPL0}}==
29

edits