Public Class Form5
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call game("剪刀")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Call game("石頭")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Call game("布")
    End Sub

    Sub game(ByVal x As String)
        Dim com As Integer
        Randomize()
        com = Int(Rnd() * 3) + 1
        Label1.Text = Choose(com, "剪刀", "石頭", "布")
        Select Case x
            Case Label1.Text
                MsgBox("平手")
            Case "剪刀"
                If Label1.Text = "石頭" Then
                    MsgBox("你輸了")
                Else
                    MsgBox("你贏了")
                End If
            Case "石頭"
                If Label1.Text = "布" Then
                    MsgBox("你輸了")
                Else
                    MsgBox("你贏了")
                End If
            Case "布"
                If Label1.Text = "剪刀" Then
                    MsgBox("你輸了")
                Else
                    MsgBox("你贏了")
                End If
        End Select
    End Sub
End Class
