And just again for comparison if someone thinks I am cheating because I don't use PulsarLua. This time another Pascal version using the same graphics routines as the Lua example:
{$IFDEF Windows}
{$APPTYPE GUI}
{$ENDIF}
program voronoi;
uses graphtools,ptcgraph,ptccrt,sysutils,math;
const points = 36 * 13;
const rad = pi /180;
const gem=700;
var cy:integer = gem div 2;
ga:integer = 10;
x:array [0..points] of integer;
y:array [0..points] of integer;
rd:array [0..points] of integer;
gr:array [0..points] of integer;
bl:array [0..points] of integer;
scale:float = 0.7;
n,r,g,b,xx,yy,i,d,q,a,kkl, time1, time2: integer;
BEGIN
mode (3);
textsize (2);
setvisualpage (0);
setactivepage (1);
cleardevice;
time1:=gettickcount64;
for n := 0 to points do begin
x[n] := round (cy + scale * n * cos(rad * n * ga));
y[n] := round (cy + scale * n * sin(rad * n * ga));
if (x[n] < gem) and (x[n] > 0) and (y[n] < gem) and (y[n] > 0) then begin
g := round (127 - abs(cy - x[n]) * 127 / cy + 127 - abs(cy - y[n]) * 127 / cy);
end
else begin
g := 0;
end;
if (x[n] < gem) and (x[n] > 0) then begin
r := round (255 - x[n] * 255 / gem);
end
else begin
r := 0;
end;
if (y[n] < gem) and (y[n] > 0) then begin
b := round (y[n] * 255 / gem);
end
else begin
b := 0 ;
end;
rd [n]:=r;
gr[n]:=g;
bl[n]:=b;
ink (r, g, b);
fillcircle(x[n], y[n], 2);
end;
for xx := 0 to gem do begin
for yy := 0 to gem do begin
d := gem * gem + 1;
for i := 0 to points do begin
a := x[i] - xx;
b := y[i] - yy;
q := a * a + b * b;
if q < d then begin
d := q ;
kkl := i;
end;
end;
ink (rd[kkl],gr[kkl],bl[kkl]);
pset(xx, yy);
end;
//redraw;
end;
time2:=gettickcount64;
setvisualpage (1);
ink (0,0,0);
OuttextXY (0,0,'Time: ' + FloatToStr ((time2-time1)/1000) + ' seconds');
getkey;
mode (0);
END.
Time: 1.655 seconds
Just for comparison: with my slow (but nice) notebook using an Intel Celeron N2940 (quadcore @ 1.83 GHz), I got the following times (all 32 Bit exe on a 64 Bit Windows 10 system - and all done working with the battery):
Free Pascal (Graph): 2.985 seconds
FreeBASIC (SDL2): 3.78 seconds
ChipmonkeyLua: 190.5 seconds