RosettaCodeData/Task/Archimedean-spiral/BASIC256/archimedean-spiral.basic
2023-07-01 13:44:08 -04:00

30 lines
640 B
Text

# Basic-256 ver 1.1.4
# Archimedean Spiral
width = 430 : height = 430
graphsize width, height
rect 0,0, graphwidth,graphheight
penwidth 1
color green
x = width/2 : y = height/2 # Center of graphics window
i = 1 : t = 0 : xn = 0 : yn = 0 # Initial values
iter = 150 : q = 30
line x,0,x,height
line 0,y,width,y
penwidth 2
color red
while i <= iter
t = i / q * pi
xn = (1 + (1 * t)) * cos(t) +x
yn = (1 + (1 * t)) * sin(t) +y
line x,y,xn,yn
x = xn : y = yn
print i + chr(9) + int(x) + chr(9) + int(y) + chr(9) + int(t) # chr(9) = TAB
i += 1
end while
imgsave "spiral-Basic-256.png", "PNG"