Module Module1
    Sub Show_pic()
        Dim i, n(2) As Short
        Randomize()
        For i = 0 To 2
            n(i) = Int(Rnd() * 4) + 1
            Select Case i
                Case 0 : Form1.PictureBox1.Load(Form1.path & n(i) & ".jpg")
                Case 1 : Form1.PictureBox2.Load(Form1.path & n(i) & ".jpg")
                Case 2 : Form1.PictureBox3.Load(Form1.path & n(i) & ".jpg")
            End Select
        Next
        Call Score(n)
    End Sub

    Sub Score(ByVal num() As Short)        '計算得分及判斷輸贏
        Dim victor As String = ""
        If num(0) = num(1) Then            '判斷3張水果圖片是否相同
            If num(1) = num(2) Then
                victor = "贏"
                If Form1.sum > 0 Then      '計算得分(原得分大於0時，獲得兩倍得分）
                    Form1.sum *= 2
                ElseIf Form1.sum = 0 Then  '原得分等於0時，獲得10分
                    Form1.sum = 10
                Else                       '原得分小於0時，得分改為0分
                    Form1.sum = 0
                End If
            End If
        Else
            victor = "輸"
            Form1.sum -= 1                 '計算得分(未獲勝，總分減1分)
        End If
        Form1.TextBox1.Text += victor + vbCrLf
        Form1.TextBox2.Text += Form1.sum & vbCrLf
    End Sub
End Module
