unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Math;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    CatEdt: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    XFromEdt: TEdit;
    XToEdt: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    YFromEdt: TEdit;
    YToEdt: TEdit;
    Button1: TButton;
    Label6: TLabel;
    CountEdt: TEdit;
    CodeMemo: TMemo;
    Label7: TLabel;
    ParamEdt: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.Button1Click(Sender: TObject);
var i,xfrom,yfrom,xto,yto: integer;
begin
 xfrom := StrToInt(XFromEdt.Text);
 yfrom := StrToInt(YFromEdt.Text);
 xto := StrToInt(XToEdt.Text);
 yto := StrToInt(YToEdt.Text);
 CodeMemo.Clear;
 CodeMemo.Lines.Add('// Generated by Losowe Umieszczanie Objektów dla CoLoBoT by LolSoft');
 CodeMemo.Lines.Add('// X='+IntToStr(xfrom)+'..'+IntToStr(xto)+'  Y='+
  IntToStr(yfrom)+'..'+IntToStr(yto)+'  Count='+CountEdt.Text);  
 for i := 1 to StrToInt(CountEdt.Text) do begin
  CodeMemo.Lines.Add('CreateObject pos='+
   IntToStr(RandomRange(xfrom,xto))+';'+IntToStr(RandomRange(yfrom,yto))+
   ' dir='+StringReplace(FloatToStr(Random(20)/10), ',','.',[rfReplaceAll])+
   ' type='+CatEdt.Text+' '+ParamEdt.Text);
 end;
 
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 randomize;
end;

end.
