function f() {'compiled';
Xr=0;
Xi=0;
i=0;
while ((i<16) & ((Xr*Xr+Xi*Xi)<4)) {
t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
i=i+1;
}
}
var i,t,Xr,Xi,Cr,Ci;
for (y=0;y<32;y++) {
line="";
Ci=(4.0*y/32)-2.0;
for (x=0;x<32;x++) {
Cr=(4.0*x/32)-2.0;
f();
line += (i&1)?"*":" ";
}
print(line);
}
So locking is now sorted and this is powerful enough for while loops - for instance for the mandelbrot fractal. There's some minor glitch with the maths but it looks very promising.
Interestingly this still isn't super fast because of the variable lookup, but that's something that will change soon too!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
One more:
So locking is now sorted and this is powerful enough for while loops - for instance for the mandelbrot fractal. There's some minor glitch with the maths but it looks very promising.
Interestingly this still isn't super fast because of the variable lookup, but that's something that will change soon too!