Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://mega.nz/#F!vMcFVaJB!3QnNcYNNkSYF1kuH9-EbTw
- unit Unit1;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
- ExtCtrls, StdCtrls, Spin;
- type
- { TForm1 }
- TForm1 = class(TForm)
- Button1: TButton;
- Button2: TButton;
- Button3: TButton;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Label6: TLabel;
- Label7: TLabel;
- ProgressBar: TProgressBar;
- suma: TSpinEdit;
- Timer1: TTimer;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
- private
- { private declarations }
- public
- { public declarations }
- end;
- var
- Form1: TForm1;
- body,a,b,c:integer;
- stop:byte;
- isStop:boolean;
- implementation
- {$R *.lfm}
- { TForm1 }
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- ProgressBar.Position:=ProgressBar.Position+2;
- label5.Caption:=inttostr(ProgressBar.Position)+'%';
- if ProgressBar.Position>=100 then
- begin
- Timer1.Enabled:=false;
- if body > 0 then showmessage('Získal si '+inttostr(body)+' bodov')
- else showmessage('Nezískal si žiadne body!');
- label7.Caption:='Vyhrál si sumu: '+inttostr(suma.Value*body)+'€';
- end;
- a:=1+random(6); b:=1+random(6); c:=1+random(6);
- label1.Caption:=inttostr(a);
- label2.Caption:=inttostr(b);
- label3.Caption:=inttostr(c);
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- Timer1.Enabled:=true;
- suma.ReadOnly:=true;
- isStop:=false;
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- begin
- Timer1.Enabled:=false;
- if (isStop = false) then
- begin
- isStop:=true;
- if (a=b) or (a=c) or (b=c) then body:=body+10;
- if (a=b) and (b=c) then body:=body+100;
- label4.Caption:=inttostr(body);
- end;
- if stop = 2 then
- begin
- if body > 0 then showmessage('Získal si '+inttostr(body)+' bodov')
- else showmessage('Nezískal si žiadne body!');
- label7.Caption:='Vyhrál si sumu: '+inttostr(suma.Value*body)+'€';
- Button1.Enabled:=false;
- end
- else inc(stop);
- end;
- procedure TForm1.Button3Click(Sender: TObject);
- begin
- body:=0;
- label4.Caption:='0';
- ProgressBar.Position:=0;
- label5.Caption:='0%';
- stop:=0;
- Button1.Enabled:=true;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- body:=0;
- ProgressBar.Position:=0;
- label5.Caption:='0%';
- label4.Caption:='0';
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment