Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- Programmer : Jean Riko Kurniawan Putra
- Fanpage : http://www.facebook.com/jean.software
- Blog : http://djeansoftware.blogspot.com/
- }
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Buttons, XPMan, Menus, ActnMan, ActnColorMaps, jpeg,
- ExtCtrls;
- type
- TForm1 = class(TForm)
- GroupBox1: TGroupBox;
- SB1: TSpeedButton;
- SB2: TSpeedButton;
- SB3: TSpeedButton;
- SB4: TSpeedButton;
- SB6: TSpeedButton;
- SB7: TSpeedButton;
- SB8: TSpeedButton;
- SB9: TSpeedButton;
- SB5: TSpeedButton;
- Label1: TLabel;
- XPManifest1: TXPManifest;
- MainMenu1: TMainMenu;
- File1: TMenuItem;
- Mulai1: TMenuItem;
- Keluar1: TMenuItem;
- Help1: TMenuItem;
- About1: TMenuItem;
- SBMulai: TSpeedButton;
- SBKeluar: TSpeedButton;
- procedure SBKeluarClick(Sender: TObject);
- procedure SBMulaiClick(Sender: TObject);
- procedure SB1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure SB2Click(Sender: TObject);
- procedure SB3Click(Sender: TObject);
- procedure SB4Click(Sender: TObject);
- procedure SB5Click(Sender: TObject);
- procedure SB6Click(Sender: TObject);
- procedure SB7Click(Sender: TObject);
- procedure SB8Click(Sender: TObject);
- procedure SB9Click(Sender: TObject);
- procedure About1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- //Variabel Pencacah Tombol
- tombol: Integer;
- //Variabel Bom
- Bom: Integer;
- implementation
- {$R *.dfm}
- procedure TForm1.SBKeluarClick(Sender: TObject);
- begin
- close;
- end;
- procedure TForm1.SBMulaiClick(Sender: TObject);
- begin
- Label1.Caption:='Result';
- //Mengecek Bom
- Randomize;
- Bom := random(9) + 1;
- //Mereset nilai tombol
- //Yang diklik user
- tombol := 0;
- //Tampilan dan status tombol-tombol
- SB1.Enabled:=True;
- SB1.Caption:='Klik';
- SB2.Enabled:=True;
- SB2.Caption:='Klik';
- SB3.Enabled:=True;
- SB3.Caption:='Klik';
- SB4.Enabled:=True;
- SB4.Caption:='Klik';
- SB5.Enabled:=True;
- SB5.Caption:='Klik';
- SB6.Enabled:=True;
- SB6.Caption:='Klik';
- SB7.Enabled:=True;
- SB7.Caption:='Klik';
- SB8.Enabled:=True;
- SB8.Caption:='Klik';
- SB9.Enabled:=True;
- SB9.Caption:='Klik';
- end;
- procedure TForm1.SB1Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=1 then
- begin
- SB1.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB2.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB1.Enabled:=False;
- SB1.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- Label1.Caption:='Result';
- //Nilai Awal Jumlah Tombol
- //yang diklik user
- tombol:=0;
- //Tombol tidak Bisa diakses
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end;
- procedure TForm1.SB2Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=2 then
- begin
- SB2.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB1.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB2.Enabled:=False;
- SB2.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.SB3Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=3 then
- begin
- SB3.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB2.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB3.Enabled:=False;
- SB3.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.SB4Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=4 then
- begin
- SB4.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB2.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB4.Enabled:=False;
- SB4.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.SB5Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=5 then
- begin
- SB5.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB2.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB5.Enabled:=False;
- SB5.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.SB6Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=6 then
- begin
- SB6.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB2.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB6.Enabled:=False;
- SB6.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.SB7Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=7 then
- begin
- SB7.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB2.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB8.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB7.Enabled:=False;
- SB7.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.SB8Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=8 then
- begin
- SB8.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB2.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB9.Caption:='Gagal';
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB9.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB8.Enabled:=False;
- SB8.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.SB9Click(Sender: TObject);
- begin
- //Jika Mengklik tombol Bom
- if Bom=9 then
- begin
- SB9.Caption:='Duer!!!';
- Label1.Caption:='Anda Kalah!';
- SB1.Caption:='Gagal';
- SB2.Caption:='Gagal';
- SB3.Caption:='Gagal';
- SB4.Caption:='Gagal';
- SB5.Caption:='Gagal';
- SB6.Caption:='Gagal';
- SB7.Caption:='Gagal';
- SB8.Caption:='Gagal';
- SB1.Enabled:=False;
- SB2.Enabled:=False;
- SB3.Enabled:=False;
- SB4.Enabled:=False;
- SB5.Enabled:=False;
- SB6.Enabled:=False;
- SB7.Enabled:=False;
- SB8.Enabled:=False;
- end
- //Jika mengklik bukan tombol Bom
- else
- Begin
- tombol:=tombol+1;
- SB9.Enabled:=False;
- SB9.Caption:='Sukses';
- //Jika berhasil membuka 8 buah tombol
- //bukan tombol Bom
- if tombol=8 then
- label1.Caption:='Anda Menang!!!';
- End;
- end;
- procedure TForm1.About1Click(Sender: TObject);
- begin
- Application.MessageBox('Klik Sebanyak 8 kali Maka Anda Menang' + #13 + 'Jika Ketemu Bom Anda Kalah' + #13 + 'Selamat Mencoba!!','Petunjuk Penggunaan',MB_ICONINFORMATION);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement