unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons, ComCtrls;

type
  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    BitBtn5: TBitBtn;
    BitBtn6: TBitBtn;
    BitBtn7: TBitBtn;
    BitBtn8: TBitBtn;
    BitBtn9: TBitBtn;
    BitBtn10: TBitBtn;
    BitBtn11: TBitBtn;
    Edit1: TEdit;
    Timer1: TTimer;
    BitBtn12: TBitBtn;
    BitBtn13: TBitBtn;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    procedure FormCreate(Sender: TObject);
    procedure BitBtn11Click(Sender: TObject);
    procedure BitBtn12Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure BitBtn13Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,otv:byte;
   otv2:string;
  implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin

a1:=Random(30);
  a2:=Random(30);
  a3:=Random(30);
  a4:=Random(30);
  a5:=Random(30);
  a6:=Random(30);
  a7:=Random(30);
  a8:=Random(30);
  a9:=Random(30);
  a10:=Random(30);
  BitBtn1.Caption:=IntToStr(a1);
  BitBtn2.Caption:=IntToStr(a2);
  BitBtn3.Caption:=IntToStr(a3);
  BitBtn4.Caption:=IntToStr(a4);
  BitBtn5.Caption:=IntToStr(a5);
  BitBtn6.Caption:=IntToStr(a6);
  BitBtn7.Caption:=IntToStr(a7);
  BitBtn8.Caption:=IntToStr(a8);
  BitBtn9.Caption:=IntToStr(a9);
  BitBtn10.Caption:=IntToStr(a10);
     Edit1.Visible:=false;
     BitBtn13.Visible:=false;
    Timer1.Enabled:=false;
    BitBtn1.Visible:=false;
     BitBtn2.Visible:=false;
    BitBtn3.Visible:=false;
    BitBtn4.Visible:=false;
    BitBtn5.Visible:=false;
    BitBtn6.Visible:=false;
     BitBtn7.Visible:=false;
     BitBtn8.Visible:=false;
     BitBtn9.Visible:=false;
     BitBtn10.Visible:=false;
end;
         
procedure TForm1.BitBtn11Click(Sender: TObject);
begin
 if RadioButton1.Checked then begin

    Timer1.Interval:=60000;
 end;
  if RadioButton2.Checked then begin

    Timer1.Interval:=40000;
 end;
 if RadioButton3.Checked then begin

    Timer1.Interval:=30000;
 end;
  RadioButton1.Visible:=false;
  RadioButton2.Visible:=false;
  RadioButton3.Visible:=false;
  BitBtn13.Visible:=false;
  BitBtn12.Visible:=false;
  BitBtn11.Visible:=false;
  Edit1.Visible:=false;
  Timer1.Enabled:=True;
  a1:=Random(30);
  a2:=Random(30);
  a3:=Random(30);
  a4:=Random(30);
  a5:=Random(30);
  a6:=Random(30);
  a7:=Random(30);
  a8:=Random(30);
  a9:=Random(30);
  a10:=Random(30);
  BitBtn1.Caption:=IntToStr(a1);
  BitBtn2.Caption:=IntToStr(a2);
  BitBtn3.Caption:=IntToStr(a3);
  BitBtn4.Caption:=IntToStr(a4);
  BitBtn5.Caption:=IntToStr(a5);
  BitBtn6.Caption:=IntToStr(a6);
  BitBtn7.Caption:=IntToStr(a7);
  BitBtn8.Caption:=IntToStr(a8);
  BitBtn9.Caption:=IntToStr(a9);
  BitBtn10.Caption:=IntToStr(a10);
   BitBtn1.Visible:=true;
     BitBtn2.Visible:=true;
    BitBtn3.Visible:=true;
    BitBtn4.Visible:=true;
    BitBtn5.Visible:=true;
    BitBtn6.Visible:=true;
     BitBtn7.Visible:=true;
     BitBtn8.Visible:=true;
     BitBtn9.Visible:=true;
     BitBtn10.Visible:=true;

  end;

procedure TForm1.BitBtn12Click(Sender: TObject);
begin
  close
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  BitBtn13.Visible:=True;
  otv:=a1+a2+a3+a4+a5+a6+a7+a8+a9+a10;

Edit1.Visible:=true;
   Timer1.Enabled:=false;
    BitBtn1.Visible:=false;
     BitBtn2.Visible:=false;
    BitBtn3.Visible:=false;
    BitBtn4.Visible:=false;
    BitBtn5.Visible:=false;
    BitBtn6.Visible:=false;
     BitBtn7.Visible:=false;
     BitBtn8.Visible:=false;
     BitBtn9.Visible:=false;
     BitBtn10.Visible:=false;
  end;

procedure TForm1.BitBtn13Click(Sender: TObject);
begin
    otv2:=Edit1.Text;
    if otv = StrToInt(otv2) then begin
        ShowMessage('Верно');
        BitBtn13.Visible:=false;
        Edit1.Visible:=false;
        BitBtn11.Visible:=true;
    end
    else begin
     showmessage('Неверно');
     BitBtn13.Visible:=false;
        Edit1.Visible:=false;
        BitBtn11.Visible:=true;
     end;
end;

end.
