JuliaPattern

Based on an example posted at the Just BASIC forum by uncleBen. For more info check [|WikiPedia]

The 3D Version was inspired by a "Simons BASIC" demo I run on a C64.

2D Julia Set
code format="vbnet" graphic #j, 400, 400 dim col$(20) for c = 1 to 14 read i$ : col$(c) = i$   next c

input "Keep all patterns displayed (Y/[N])"; keepDisplay$

[restart] G=(rnd(0)*2)-1 H=(rnd(0)*2)-1 MCT=int(rnd(0)*6)+8

[bfin3] FOR X = -2 TO 0 step .01 FOR Y = -2 TO 2 step .01 R=X:I=Y:CT=0 'you may use CT=int(rnd(1)*16) FIN=0 WHILE FIN=0 N=R*R-I*I+G:M=2*R*I+H:CT=CT+1:S=R*R+I*I:R=N:I=M IF S > 4 OR CT > MCT -1 THEN FIN = 1 WEND PT = CT +1 IF CT > MCT-1 OR CT > 13 THEN PT=14 #j color(col$(PT)) XT=X*100+200:YT=Y*100+200 #j SET(XT,YT) MX = 400 - XT : MY = 150 -YT #j SET(MX,MY+249) NEXT Y   NEXT X

if instr("YESyes", keepDisplay$) = 0 then cls

html " Julia Patterns " render #j html " REAL = ";G;" IMAGINARY = ";H;"  MAXDEPTH = ";MCT;" "

a$ = "N" input "Run once more (Y/[N])"; a$   if instr("YESyes", a$)>0 then [restart] end

[cols] data "black","blue","brown","cyan","darkblue","darkcyan" data "darkgreen","darkpink","darkred","green","pink" data "red","white","yellow" end code



3D Julia Set
You can decide to continue calculation after each quarter.

code format="vbnet" graphic #j, 400, 332

[restart] G=(rnd(0)*2)-1 H=(rnd(0)*2)-1 MCT=14 count = 0

#j cls("blue")

[bfin3] while count < 4 count = count + 1 FOR X = count-3 TO count-2 step .01 FOR Y = -2 TO 2 step .01 R=X I=Y CT=0 FIN=0 WHILE FIN=0 N=R*R-I*I+G M=2*R*I+H CT=CT+1 S=R*R+I*I R=N I=M IF S > 4 OR CT > MCT -1 THEN FIN = 1 WEND PT = CT +1 IF CT > MCT-1 OR CT > 13 THEN PT=14 XT=Y*100+200 YT=(X*100/1.5)+200 YB=YT-PT #j color(255, 135, 0) #j line(XT,YT,XT,YB) #j color("yellow") #j line(XT+1,YT+1,XT+1,YB) #j color("brown") #j line(XT-1,YT+1,XT-1,YB+1) NEXT next if count < 4 then cls dummy$ = "Y" render #j print input "Calculate next quarter ([Y]/N)"; dummy$ if instr("Nn", dummy$) > 0 then count = 4 end if   wend

cls html " 3D Julia Patterns " render #j html " REAL = ";G;" IMAGINARY = ";H;"  MAXDEPTH = ";MCT;" "

a$ = "N" input "Run once more (Y/[N])"; a$   if instr("Yy", a$)>0 then [restart] end code