Julia set: Difference between revisions
Content added Content deleted
(Dialects of BASIC moved to the BASIC section.) |
(→{{header|Liberty BASIC}}: Added.) |
||
Line 560: | Line 560: | ||
170 NEXT Y |
170 NEXT Y |
||
180 NEXT X</syntaxhighlight> |
180 NEXT X</syntaxhighlight> |
||
==={{header|Liberty BASIC}}=== |
|||
{{trans|Locomotive Basic}} |
|||
Shades of gray proportional to numbers of iteration are used (differently from the original version). |
|||
{{works with|Just BASIC}} |
|||
<syntaxhighlight lang="lb">rem Julia set |
|||
WindowWidth = 640: WindowHeight = 400 |
|||
graphicbox #julset.gbox, 0, 0, 639, 399 |
|||
open "Julia set" for window as #julset |
|||
print #julset.gbox, "down" |
|||
x0 = -0.512511498387847167 : y0 = 0.521295573094847167 |
|||
for xp = 0 TO 639 |
|||
for yp = 0 TO 399 |
|||
x = xp / 213 - 1.5: y = yp / 200 - 1 |
|||
iteration = 0 |
|||
maxIteration = 100 |
|||
while x * x + y * y <= 4 and iteration < maxIteration |
|||
xtemp = x * x - y * y + x0 |
|||
y = 2 * x * y + y0 |
|||
x = xtemp |
|||
iteration = iteration + 1 |
|||
wend |
|||
if iteration <> maxIteration then c = iteration else c = 0 |
|||
cl = int(c * 255 / maxIteration + .5) |
|||
print #julset.gbox, "color "; cl; " "; cl; " "; cl |
|||
print #julset.gbox, "set "; xp; " "; yp |
|||
next yp |
|||
next xp |
|||
wait |
|||
</syntaxhighlight> |
|||
==={{header|Locomotive Basic}}=== |
==={{header|Locomotive Basic}}=== |