unit basicunit;
{$mode delphi} {$H+}
interface
uses  Classes, SysUtils;
Procedure ModulesInit;
Procedure ModulesDone;
procedure BASICmain;

Const DrawTimeInterval=0;
Const DrawStartDelay=0;
Const VirtualStackSize=65536;

implementation
uses Forms, math, graphics,
 Unix,dl,
  base,base2,textfrm,textfile,arrays,affine,graphsys,
  math2sub,datalist,baslib,graphlib,debugdg,paintfrm,
  MyThread,assignlib, mathlib0;
{$MAXFPUREGISTERS 0}





(* Modules initialize and dispose *)
Procedure ModulesInit;
begin
end;
Procedure ModulesDone;
begin
end;

(* Main Program *)
procedure BASICmain;
var _GHEIGHT:double=0;
var _GWIDTH:double=0;
var _CIRCLES:double=0;
var _Y:TArray1N;
var _X:TArray1N;
var _I:double=0;
var _X1:double=0;
var _Y1:double=0;
var _R:double=0;
var _R1:double=0;
var s_S:Ansistring;
var __own1_00000:double=0;
var __own2_00001:double=0;
var __own1_00001:double=0;
var __own2_00002:double=0;
var __own1_00002:double=0;
var __own2_00003:double=0;
var __own1_00003:double=0;
var __own2_00004:double=0;
var Missing:Boolean;
begin
_Y:=TArray1N.create(0,50);
_X:=TArray1N.create(0,50);
try
//  10 LET gHeight=200
_GHEIGHT := 200;
//  20 LET gWidth=320
_GWIDTH := 320;
//  30 SET WINDOW 0,gWidth,0,gHeight
SetWindow(0,_GWIDTH,0,_GHEIGHT, false );
//  50 RANDOMIZE
MyRandoMize;
//  60 OPTION BASE 0

//  70 LET circles = 50
_CIRCLES := 50;
//  80 DIM y (50), x (50)

//  90 FOR i = 0 TO circles
__own1_00000 := _CIRCLES ;
_I := 0 ;
while (_I <= __own1_00000) do begin
//  100    LET y(i) = gHeight * rnd
_Y.elements^[_Y.index(_I)] := (_GHEIGHT)*(random52 );
//  110    LET x(i) = gWidth * rnd
_X.elements^[_X.index(_I)] := (_GWIDTH)*(random52 );
//  120 NEXT i
_I := _I + 1 ;
end;
//  130 FOR x1 = 0 TO gWidth-1
__own1_00001 := _GWIDTH-1 ;
_X1 := 0 ;
while (_X1 <= __own1_00001) do begin
//  140    FOR y1 = 0 TO gHeight-1
__own1_00002 := _GHEIGHT-1 ;
_Y1 := 0 ;
while (_Y1 <= __own1_00002) do begin
//  150       LET r = 1000000
_R := 1000000;
//  160       FOR i=0 TO circles
__own1_00003 := _CIRCLES ;
_I := 0 ;
while (_I <= __own1_00003) do begin
//  170          LET r1 = SQR ((x1 - x(i)) * (x1-x(i))+(y1-y(i))*(y1-y(i)))
_R1 := SQRT((_X1-(_X.elements^[_X.index(_I)]))*(_X1-(_X.elements^[_X.index(_I)]))+(_Y1-(_Y.elements^[_Y.index(_I)]))*(_Y1-(_Y.elements^[_Y.index(_I)])));
//  180          IF r1 < r THEN LET r = r1
if _R1<_R then
 begin
_R := _R1;
 end
 else
 begin
 end;
//  190       NEXT i
_I := _I + 1 ;
end;
//  200       IF bitand(r/3,1) = 1 THEN
if BitAND((_R)/3,1)=1 then
 begin
//  210          SET POINT COLOR 6 ! Yellow
setpointcolor(6, false );
//  220       ELSE
 end
 else
 begin
//  230          SET POINT COLOR 1 ! Black
setpointcolor(1, false );
//  240       END IF
 end;
//  250       PLOT POINTS: x1, y1
PlotPoints([_X1,_Y1]);
//  260    NEXT y1
_Y1 := _Y1 + 1 ;
end;
//  270 NEXT x1
_X1 := _X1 + 1 ;
end;
//  280 INPUT s$
with TDataList.create do 
try
 Missing:=false;
 svExtype:=  InputData(console,'s',[],'? ',MaxNumberDouble,nil,false,rsNone,26);
 if count>0 then  s_S :=  strings[0] ;
if svExtype<>0 then setexception(svExtype);
finally
 free;
end;

//  999 END

finally
_Y.free;
_X.free;
end;
end;{end main}
initialization
  AppName:='/home/shiraishi/BASICAcc1.2/INPUT_fault';
  SystemStackSize := 66846720;
  signiwidth0:=13;
  TextMode := false ;
  GraphMode:= true ;
  BMPSize:=BMP801;
  TextProblemCoordinate:= false ;
  UseCharInput:= false ;
  FontCharSet:=1;
  FontSize:=0;
  FontName:='default';
  FontStyle:=[];
  FirstThreadPriority:=tpNormal;



Finalization



end.
