2009年2月17日 星期二

Lucky Seven 過程版本

image

Public Class Form1
    Dim acc, s7
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Randomize()
        acc = 1000
        Label4.Text = "$" & acc
        Label1.Text = 1
        Label2.Text = 2
        Label3.Text = 3
        With Label4
            .ForeColor = Color.Red
            .Font = New Font("impact", 20, FontStyle.Regular)
        End With

        With Label1
            .ForeColor = Color.Yellow
            .BackColor = Color.Blue
            .Font = New Font("impact", 50, FontStyle.Bold)
        End With
        With Label2
            .ForeColor = Color.Yellow
            .BackColor = Color.Blue
            .Font = New Font("impact", 50, FontStyle.Bold)
        End With
        With Label3
            .ForeColor = Color.Yellow
            .BackColor = Color.Blue
            .Font = New Font("impact", 50, FontStyle.Bold)
        End With
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        play()

        'If acc <= 0 Then
        '    Label4.Text = "$" & acc & Space(5) & "您輸光了!"
        '    Button2.Visible = False
        'End If
    End Sub

    Sub play()
        Label1.Text = Int(Rnd() * 10)
        Label2.Text = Int(Rnd() * 10)
        Label3.Text = Int(Rnd() * 10)

        s7 = 0
        If Label1.Text = 7 Then s7 = s7 + 1
        If Label2.Text = 7 Then s7 = s7 + 1
        If Label3.Text = 7 Then s7 = s7 + 1

        If s7 = 1 Then acc = acc + 60
        If s7 = 2 Then acc = acc + 600
        If s7 = 3 Then acc = acc + 6000

        acc = acc - 50
        Label4.Text = "$" & acc
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i
        For i = 1 To 10000
            play()
        Next
    End Sub
End Class

1 則留言: