analisis program puzzle

27
Analisis Program Puzzle Analisis Program Puzzle Kelompok 32 Pada program puzzle kami, kami menggunakan 2 form yaitu 1 form untuk pembukaan dan form kedua untuk puzzlenya. Berikut ini listing yang ada pada form1 : Public Class Form1 Dim smt As String Dim stp As Object Dim acak As Integer (Listing di atas digunakan untuk permisalan dari smt sebagai variabel karakter, stp sebagai variabel objek, dan acak sebagai variabel angka) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System .EventArgs) Handles Button1.Click

Upload: kausarsiregar

Post on 18-Feb-2016

4 views

Category:

Documents


0 download

DESCRIPTION

Analisis Program Puzzle

TRANSCRIPT

Page 1: Analisis Program Puzzle

Analisis Program Puzzle

Analisis Program Puzzle Kelompok 32

            Pada program puzzle kami, kami menggunakan 2 form yaitu 1 form untuk

pembukaan  dan form kedua untuk puzzlenya. Berikut ini listing yang ada pada form1 :

Public Class Form1    Dim smt As String    Dim stp As Object    Dim acak As Integer

(Listing di atas digunakan untuk permisalan dari smt sebagai variabel karakter, stp sebagai

variabel objek, dan acak sebagai variabel angka)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click        If Button2.Text = "" Then            stp = Button1.BackgroundImage            Button1.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button1.Text            Button1.Text = Button2.Text

Page 2: Analisis Program Puzzle

            Button2.Text = smt        ElseIf Button4.Text = "" Then            stp = Button1.BackgroundImage            Button1.BackgroundImage = Button4.BackgroundImage            Button4.BackgroundImage = stp            smt = Button1.Text            Button1.Text = Button4.Text            Button4.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button1 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click        If Button1.Text = "" Then            stp = Button2.BackgroundImage            Button2.BackgroundImage = Button1.BackgroundImage            Button1.BackgroundImage = stp            smt = Button2.Text            Button2.Text = Button1.Text            Button1.Text = smt        ElseIf Button3.Text = "" Then            stp = Button2.BackgroundImage            Button2.BackgroundImage = Button3.BackgroundImage            Button3.BackgroundImage = stp            smt = Button2.Text            Button2.Text = Button3.Text            Button3.Text = smt        ElseIf Button5.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button2.Text            Button2.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()

Page 3: Analisis Program Puzzle

            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button2 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click        If Button2.Text = "" Then            stp = Button3.BackgroundImage            Button3.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button3.Text            Button3.Text = Button2.Text            Button2.Text = smt        ElseIf Button6.Text = "" Then            stp = Button3.BackgroundImage            Button3.BackgroundImage = Button6.BackgroundImage            Button6.BackgroundImage = stp            smt = Button3.Text            Button3.Text = Button6.Text            Button6.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button3 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click        If Button1.Text = "" Then            stp = Button4.BackgroundImage            Button4.BackgroundImage = Button1.BackgroundImage            Button1.BackgroundImage = stp            smt = Button4.Text

Page 4: Analisis Program Puzzle

            Button4.Text = Button1.Text            Button1.Text = smt        ElseIf Button5.Text = "" Then            stp = Button4.BackgroundImage            Button4.BackgroundImage = Button5.BackgroundImage            Button5.BackgroundImage = stp            smt = Button4.Text            Button4.Text = Button5.Text            Button5.Text = smt        ElseIf Button7.Text = "" Then            stp = Button4.BackgroundImage            Button4.BackgroundImage = Button7.BackgroundImage            Button7.BackgroundImage = stp            smt = Button4.Text            Button4.Text = Button7.Text            Button7.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button4 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click        If Button2.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button2.Text            Button2.Text = smt        ElseIf Button4.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button4.BackgroundImage            Button4.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button4.Text            Button4.Text = smt        ElseIf Button6.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button6.BackgroundImage            Button6.BackgroundImage = stp            smt = Button5.Text

Page 5: Analisis Program Puzzle

            Button5.Text = Button6.Text            Button6.Text = smt        ElseIf Button8.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button8.BackgroundImage            Button8.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button8.Text            Button8.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button5 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click        If Button3.Text = "" Then            stp = Button6.BackgroundImage            Button6.BackgroundImage = Button3.BackgroundImage            Button3.BackgroundImage = stp            smt = Button6.Text            Button6.Text = Button3.Text            Button3.Text = smt        ElseIf Button5.Text = "" Then            stp = Button6.BackgroundImage            Button6.BackgroundImage = Button5.BackgroundImage            Button5.BackgroundImage = stp            smt = Button6.Text            Button6.Text = Button5.Text            Button5.Text = smt        ElseIf Button9.Text = "" Then            stp = Button6.BackgroundImage            Button6.BackgroundImage = Button9.BackgroundImage            Button9.BackgroundImage = stp            smt = Button6.Text            Button6.Text = Button9.Text            Button9.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")

Page 6: Analisis Program Puzzle

            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button6 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click        If Button4.Text = "" Then            stp = Button7.BackgroundImage            Button7.BackgroundImage = Button4.BackgroundImage            Button4.BackgroundImage = stp            smt = Button7.Text            Button7.Text = Button4.Text            Button4.Text = smt        ElseIf Button8.Text = "" Then            stp = Button7.BackgroundImage            Button7.BackgroundImage = Button8.BackgroundImage            Button8.BackgroundImage = stp            smt = Button7.Text            Button7.Text = Button8.Text            Button8.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button7 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click        If Button7.Text = "" Then            stp = Button8.BackgroundImage            Button8.BackgroundImage = Button7.BackgroundImage            Button7.BackgroundImage = stp            smt = Button8.Text

Page 7: Analisis Program Puzzle

            Button8.Text = Button7.Text            Button7.Text = smt        ElseIf Button5.Text = "" Then            stp = Button8.BackgroundImage            Button8.BackgroundImage = Button5.BackgroundImage            Button5.BackgroundImage = stp            smt = Button8.Text            Button8.Text = Button5.Text            Button5.Text = smt        ElseIf Button9.Text = "" Then            stp = Button8.BackgroundImage            Button8.BackgroundImage = Button9.BackgroundImage            Button9.BackgroundImage = stp            smt = Button8.Text            Button8.Text = Button9.Text            Button9.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button8 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click        If Button6.Text = "" Then            stp = Button9.BackgroundImage            Button9.BackgroundImage = Button6.BackgroundImage            Button6.BackgroundImage = stp            smt = Button9.Text            Button9.Text = Button6.Text            Button6.Text = smt        ElseIf Button8.Text = "" Then            stp = Button9.BackgroundImage            Button9.BackgroundImage = Button8.BackgroundImage            Button8.BackgroundImage = stp            smt = Button9.Text            Button9.Text = Button8.Text            Button8.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" And Button5.Text = "5" AndButton6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text = "" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")

Page 8: Analisis Program Puzzle

            Form2.Show()            Me.Hide()        End If    End Sub

(listing di atas bertujuan untuk menukarkan gambar pada button9 sehingga dia berpindah tempat

ke button tanpa gambar dan juga apabila gambar tersusun urut dari gambar pada button1 sampai

button8 maka akan muncul tanda berhasil dari MsgBox)

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click        Button10.Enabled = False        Timer1.Enabled = True        Timer2.Enabled = False

        acak = Rnd() * 10

        Button1.Enabled = True        Button2.Enabled = True        Button3.Enabled = True        Button4.Enabled = True        Button5.Enabled = True        Button6.Enabled = True        Button7.Enabled = True        Button8.Enabled = True        Button9.Enabled = True

        PictureBox2.Show()    End Sub

(listing di atas berguna untuk mengaktifkan timer1 yang berguna untuk mengacak dan

mematikan timer2 yang berfungsi sebagai stopwatch, men-disabled kan tombol acak sendiri dan

memunculkan gambar stop, serta mengaktifkan tombol-tombol puzzle yang awal mulanya tidak

aktif)

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick        stp = Button9.BackgroundImage        Button9.BackgroundImage = Button4.BackgroundImage        Button4.BackgroundImage = stp        smt = Button9.Text        Button9.Text = Button4.Text        Button4.Text = smt

Page 9: Analisis Program Puzzle

        stp = Button9.BackgroundImage        Button9.BackgroundImage = Button3.BackgroundImage        Button3.BackgroundImage = stp        smt = Button9.Text        Button9.Text = Button3.Text        Button3.Text = smt

        stp = Button2.BackgroundImage        Button2.BackgroundImage = Button7.BackgroundImage        Button7.BackgroundImage = stp        smt = Button2.Text        Button2.Text = Button7.Text        Button7.Text = smt

        stp = Button2.BackgroundImage        Button2.BackgroundImage = Button6.BackgroundImage        Button6.BackgroundImage = stp        smt = Button2.Text        Button2.Text = Button6.Text        Button6.Text = smt

        stp = Button3.BackgroundImage        Button3.BackgroundImage = Button8.BackgroundImage        Button8.BackgroundImage = stp        smt = Button3.Text        Button3.Text = Button8.Text        Button8.Text = smt

        stp = Button3.BackgroundImage        Button3.BackgroundImage = Button1.BackgroundImage        Button1.BackgroundImage = stp        smt = Button3.Text        Button3.Text = Button1.Text        Button1.Text = smt

        stp = Button5.BackgroundImage        Button5.BackgroundImage = Button8.BackgroundImage        Button8.BackgroundImage = stp        smt = Button5.Text        Button5.Text = Button8.Text        Button8.Text = smt

        stp = Button5.BackgroundImage        Button5.BackgroundImage = Button7.BackgroundImage        Button7.BackgroundImage = stp        smt = Button5.Text        Button5.Text = Button7.Text        Button7.Text = smt

        stp = Button6.BackgroundImage        Button6.BackgroundImage = Button1.BackgroundImage

Page 10: Analisis Program Puzzle

        Button1.BackgroundImage = stp        smt = Button6.Text        Button6.Text = Button1.Text        Button1.Text = smt    End Sub

(listing di atas berguna untuk merubah susunan gambar pada button secara acak)

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click        MsgBox("Terima Kasih~", 0, "KELUAR")        Close()

    End Sub

(berguna untuk menutup program dan memunculkan MsgBox terima kasih)

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click        Timer1.Enabled = False        Timer2.Enabled = True        MsgBox("Semoga Berhasil", 0, "Lets Play !")        PictureBox2.Hide()        Button10.Enabled = True    End Sub

 (menghentikan timer1 yang berfungsi mengacak dan mengaktifkan timer2 sebagai stopwatch,

lalu menyembunyikan gambar stop dan meng-enabled kan button acak kembali)

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick        Label2.Text = Val(Label2.Text) + Val(1)        If Label2.Text = 60 Then            Label4.Text = Val(Label4.text) + Val(1)            Label2.Text = 0        End If        If Label4.Text = "5" Then            Label2.Text = "--"            Label4.Text = "--"            Timer2.Enabled = False            MsgBox("TET TOT", 0, "Waktu habis")            Dim testMsg As String

            testMsg = MsgBox("Ingin Mengulangi Permainan ??", vbYesNo + vbQuestion, "Re-Start")

Page 11: Analisis Program Puzzle

            If testMsg = vbYes Then                MsgBox("Selamat Mencoba Kembali !", 0, "Re-Start")                Application.Restart()            ElseIf testMsg = vbNo Then                MsgBox("Thank You for Playing~", 0, "EXIT")                Close()            End If

            Close()        End If    End Sub

(listing di atas berfungsi sebagai stopwatch yang akan menset waktu sampai angka 5 pada label4, apabila melebihi angka tersebut maka MsgBox akan keluar yang berisi untuk restart program atau mengakhirinya)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        Label2.Text = ""        Label4.Text = ""    End Sub

(berguna untuk membuat label2 dan label4 yang berfungsi sebagai stopwatch menjadi tanpa teks)

End Class

            Selanjutnya untuk form2 kami gunakan sebagai form masuk permainan, sehingga pada

program kami awal mula aplikasi berawal dari form2, berikut listingnya :

Page 12: Analisis Program Puzzle

Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click        Form1.Show()        Me.Hide()

        Form1.Button1.Enabled = False        Form1.Button2.Enabled = False        Form1.Button3.Enabled = False        Form1.Button4.Enabled = False        Form1.Button5.Enabled = False        Form1.Button6.Enabled = False        Form1.Button7.Enabled = False        Form1.Button8.Enabled = False        Form1.Button9.Enabled = False        Form1.PictureBox2.Hide()        MsgBox("Tekan Acak Untuk Memulai Permainan", MsgBoxStyle.Information, "Let's Play")    End Sub

(berguna untuk memunculkan form1 yang berisi puzzle dan mendisabled-kan button-button

puzzle, serta memunculkan MsgBox pemberitahuan)

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click        MsgBox("Terima Kasih~", 0, "KELUAR")        Close()    End Sub

Page 13: Analisis Program Puzzle

TUTORIAL

Tutorial Program Puzzle

Tutorial Program Puzzle                Untuk membuat program puzzle diperlukan 2 form, pertama kali yang digunakan adalah membuka program microsoft Visual Basic 10. Lalu buat form dengan template default yaitu Windows Form.

Berikut ini form awal dari program kami dan juga komponen yang diperlukan,

Komponen terpenting yang diperlukan yaitu sebagai berikut,No Komponen Properties Keterangan1 Button1 Name

TextButton1Mainkan !!

2 Button2 NameText

Button2Exit

3 Form2 NameText

Form2Puzzle Riqri

Tambahkan juga komponen-komponen lain untuk mempercantik tampilan form awal ini. Sekaligus beri juga textbox yang berisi

Page 14: Analisis Program Puzzle

petunjuk dan cara bermain. Read only pada textbox dibuat true.  Lalu berikut ini adalah listingnya:Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click        Form1.Show()        Me.Hide()

        Form1.Button1.Enabled = False        Form1.Button2.Enabled = False        Form1.Button3.Enabled = False        Form1.Button4.Enabled = False        Form1.Button5.Enabled = False        Form1.Button6.Enabled = False        Form1.Button7.Enabled = False        Form1.Button8.Enabled = False        Form1.Button9.Enabled = False        Form1.PictureBox2.Hide()        MsgBox("Tekan Acak Untuk Memulai Permainan", MsgBoxStyle.Information, "Let's Play")    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton2.Click        MsgBox("Terima Kasih~", 0, "KELUAR")        Close()    End SubEnd ClassPenjelasan secara rinci dari listing diatas dapat dilihat pada analisa program puzzle kami. Untuk form selanjutnya digunakan sebagai form puzzle. Berikut tampilannya,

Page 15: Analisis Program Puzzle

No Komponen Properties Keterangan1 Button1 Name

textButton11

2 Button2 NameText

Button22

3 Button3 NameText

Buton33

4 Button4 NameText

Button44

5 Button5 NameText

Button55

6 Button6 NameText

Button66

7 Button7 NameText

Button77

8 Button8 NameText

Button88

9 Button9 NameText

Button9

10 Button10 NameText

Button10Acak

11 Timer1 NameText

Timer1

12 Button12 NameText

Button12Exit

13 Timer2 Name Timer2

Page 16: Analisis Program Puzzle

Text14 Form1 Name

TextForm1Come n Play !

15 PictureBox2 NameText

PictureBox2

16 Label2 NameText

Label2

17 Label4 NameText

Label4

Berikan juga komponen komponen lain untuk mempercantik form puzzle ini, ganti juga background image dari button 1-8, lalu untuk button 9 dikosongkan background image nya. Tambahkan timer1 untuk mengacak gambar dan timer2 sebagai stopwatch, label2 dan label4 sebagai penunjuk waktu. Berikut ini listing yang ada pada form puzzle :Public Class Form1    Dim smt As String    Dim stp As Object    Dim acak As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click        If Button2.Text = "" Then            stp = Button1.BackgroundImage            Button1.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button1.Text            Button1.Text = Button2.Text            Button2.Text = smt        ElseIf Button4.Text = "" Then            stp = Button1.BackgroundImage            Button1.BackgroundImage = Button4.BackgroundImage            Button4.BackgroundImage = stp            smt = Button1.Text            Button1.Text = Button4.Text            Button4.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton2.Click        If Button1.Text = "" Then

Page 17: Analisis Program Puzzle

            stp = Button2.BackgroundImage            Button2.BackgroundImage = Button1.BackgroundImage            Button1.BackgroundImage = stp            smt = Button2.Text            Button2.Text = Button1.Text            Button1.Text = smt        ElseIf Button3.Text = "" Then            stp = Button2.BackgroundImage            Button2.BackgroundImage = Button3.BackgroundImage            Button3.BackgroundImage = stp            smt = Button2.Text            Button2.Text = Button3.Text            Button3.Text = smt        ElseIf Button5.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button2.Text            Button2.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton3.Click        If Button2.Text = "" Then            stp = Button3.BackgroundImage            Button3.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button3.Text            Button3.Text = Button2.Text            Button2.Text = smt        ElseIf Button6.Text = "" Then            stp = Button3.BackgroundImage            Button3.BackgroundImage = Button6.BackgroundImage            Button6.BackgroundImage = stp            smt = Button3.Text            Button3.Text = Button6.Text            Button6.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

Page 18: Analisis Program Puzzle

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton4.Click        If Button1.Text = "" Then            stp = Button4.BackgroundImage            Button4.BackgroundImage = Button1.BackgroundImage            Button1.BackgroundImage = stp            smt = Button4.Text            Button4.Text = Button1.Text            Button1.Text = smt        ElseIf Button5.Text = "" Then            stp = Button4.BackgroundImage            Button4.BackgroundImage = Button5.BackgroundImage            Button5.BackgroundImage = stp            smt = Button4.Text            Button4.Text = Button5.Text            Button5.Text = smt        ElseIf Button7.Text = "" Then            stp = Button4.BackgroundImage            Button4.BackgroundImage = Button7.BackgroundImage            Button7.BackgroundImage = stp            smt = Button4.Text            Button4.Text = Button7.Text            Button7.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton5.Click        If Button2.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button2.BackgroundImage            Button2.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button2.Text            Button2.Text = smt        ElseIf Button4.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button4.BackgroundImage            Button4.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button4.Text            Button4.Text = smt        ElseIf Button6.Text = "" Then            stp = Button5.BackgroundImage            Button5.BackgroundImage = Button6.BackgroundImage            Button6.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button6.Text            Button6.Text = smt        ElseIf Button8.Text = "" Then            stp = Button5.BackgroundImage

Page 19: Analisis Program Puzzle

            Button5.BackgroundImage = Button8.BackgroundImage            Button8.BackgroundImage = stp            smt = Button5.Text            Button5.Text = Button8.Text            Button8.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton6.Click        If Button3.Text = "" Then            stp = Button6.BackgroundImage            Button6.BackgroundImage = Button3.BackgroundImage            Button3.BackgroundImage = stp            smt = Button6.Text            Button6.Text = Button3.Text            Button3.Text = smt        ElseIf Button5.Text = "" Then            stp = Button6.BackgroundImage            Button6.BackgroundImage = Button5.BackgroundImage            Button5.BackgroundImage = stp            smt = Button6.Text            Button6.Text = Button5.Text            Button5.Text = smt        ElseIf Button9.Text = "" Then            stp = Button6.BackgroundImage            Button6.BackgroundImage = Button9.BackgroundImage            Button9.BackgroundImage = stp            smt = Button6.Text            Button6.Text = Button9.Text            Button9.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton7.Click        If Button4.Text = "" Then            stp = Button7.BackgroundImage            Button7.BackgroundImage = Button4.BackgroundImage            Button4.BackgroundImage = stp            smt = Button7.Text            Button7.Text = Button4.Text            Button4.Text = smt

Page 20: Analisis Program Puzzle

        ElseIf Button8.Text = "" Then            stp = Button7.BackgroundImage            Button7.BackgroundImage = Button8.BackgroundImage            Button8.BackgroundImage = stp            smt = Button7.Text            Button7.Text = Button8.Text            Button8.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton8.Click        If Button7.Text = "" Then            stp = Button8.BackgroundImage            Button8.BackgroundImage = Button7.BackgroundImage            Button7.BackgroundImage = stp            smt = Button8.Text            Button8.Text = Button7.Text            Button7.Text = smt        ElseIf Button5.Text = "" Then            stp = Button8.BackgroundImage            Button8.BackgroundImage = Button5.BackgroundImage            Button5.BackgroundImage = stp            smt = Button8.Text            Button8.Text = Button5.Text            Button5.Text = smt        ElseIf Button9.Text = "" Then            stp = Button8.BackgroundImage            Button8.BackgroundImage = Button9.BackgroundImage            Button9.BackgroundImage = stp            smt = Button8.Text            Button8.Text = Button9.Text            Button9.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton9.Click        If Button6.Text = "" Then            stp = Button9.BackgroundImage            Button9.BackgroundImage = Button6.BackgroundImage            Button6.BackgroundImage = stp            smt = Button9.Text

Page 21: Analisis Program Puzzle

            Button9.Text = Button6.Text            Button6.Text = smt        ElseIf Button8.Text = "" Then            stp = Button9.BackgroundImage            Button9.BackgroundImage = Button8.BackgroundImage            Button8.BackgroundImage = stp            smt = Button9.Text            Button9.Text = Button8.Text            Button8.Text = smt        End If        If Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4" AndButton5.Text = "5" And Button6.Text = "6" And Button7.Text = "7" And Button8.Text = "8" And Button9.Text ="" Then            MsgBox("Selamat~ Anda Hebat", MsgBoxStyle.Information, "Berhasil !")            Form2.Show()            Me.Hide()        End If    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton10.Click        Button10.Enabled = False        Timer1.Enabled = True        Timer2.Enabled = False

        acak = Rnd() * 10

        Button1.Enabled = True        Button2.Enabled = True        Button3.Enabled = True        Button4.Enabled = True        Button5.Enabled = True        Button6.Enabled = True        Button7.Enabled = True        Button8.Enabled = True        Button9.Enabled = True

        PictureBox2.Show()    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick        stp = Button9.BackgroundImage        Button9.BackgroundImage = Button4.BackgroundImage        Button4.BackgroundImage = stp        smt = Button9.Text        Button9.Text = Button4.Text        Button4.Text = smt

        stp = Button9.BackgroundImage        Button9.BackgroundImage = Button3.BackgroundImage        Button3.BackgroundImage = stp        smt = Button9.Text        Button9.Text = Button3.Text        Button3.Text = smt

Page 22: Analisis Program Puzzle

        stp = Button2.BackgroundImage        Button2.BackgroundImage = Button7.BackgroundImage        Button7.BackgroundImage = stp        smt = Button2.Text        Button2.Text = Button7.Text        Button7.Text = smt

        stp = Button2.BackgroundImage        Button2.BackgroundImage = Button6.BackgroundImage        Button6.BackgroundImage = stp        smt = Button2.Text        Button2.Text = Button6.Text        Button6.Text = smt

        stp = Button3.BackgroundImage        Button3.BackgroundImage = Button8.BackgroundImage        Button8.BackgroundImage = stp        smt = Button3.Text        Button3.Text = Button8.Text        Button8.Text = smt

        stp = Button3.BackgroundImage        Button3.BackgroundImage = Button1.BackgroundImage        Button1.BackgroundImage = stp        smt = Button3.Text        Button3.Text = Button1.Text        Button1.Text = smt

        stp = Button5.BackgroundImage        Button5.BackgroundImage = Button8.BackgroundImage        Button8.BackgroundImage = stp        smt = Button5.Text        Button5.Text = Button8.Text        Button8.Text = smt

        stp = Button5.BackgroundImage        Button5.BackgroundImage = Button7.BackgroundImage        Button7.BackgroundImage = stp        smt = Button5.Text        Button5.Text = Button7.Text        Button7.Text = smt

        stp = Button6.BackgroundImage        Button6.BackgroundImage = Button1.BackgroundImage        Button1.BackgroundImage = stp        smt = Button6.Text        Button6.Text = Button1.Text        Button1.Text = smt    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton12.Click        MsgBox("Terima Kasih~", 0, "KELUAR")

Page 23: Analisis Program Puzzle

        Close()

    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesPictureBox2.Click        Timer1.Enabled = False        Timer2.Enabled = True        MsgBox("Semoga Berhasil", 0, "Lets Play !")        PictureBox2.Hide()        Button10.Enabled = True    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick        Label2.Text = Val(Label2.Text) + Val(1)        If Label2.Text = 60 Then            Label4.Text = Val(Label4.text) + Val(1)            Label2.Text = 0        End If        If Label4.Text = "5" Then            Label2.Text = "--"            Label4.Text = "--"            Timer2.Enabled = False            MsgBox("TET TOT", 0, "Waktu habis")            Dim testMsg As String

            testMsg = MsgBox("Ingin Mengulangi Permainan ??", vbYesNo + vbQuestion, "Re-Start")

            If testMsg = vbYes Then                MsgBox("Selamat Mencoba Kembali !", 0, "Re-Start")                Application.Restart()            ElseIf testMsg = vbNo Then                MsgBox("Thank You for Playing~", 0, "EXIT")                Close()            End If

            Close()        End If    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        Label2.Text = ""        Label4.Text = ""    End SubEnd Class