Saturday, October 3, 2015

How the auto better works. Conclusion.

Okay so I kinda left you all hanging on the last post and didn't really explain anything. First of all sorry and second of all, I'll explain everything...

Lets bring up that code again...

It all is a bit messy and unorganized but the program is broken down into 3 functions. And the control on those functions all comes down to this piece of code:

  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim increase = txtbx_increasepercentage.Text
        If increase > 200 Then
            Call above200()
        ElseIf increase > 100 And increase < 200 Then
            Call between100and200()
        ElseIf increase < 180 Then
            Call below100()
        End If
    End Sub

This is for the main calculate button. It can invoke one of these 3 functions: below100, between100and200 and above200. Each one of these functions executes an algorithm that will display the output into the list box.

Example of function above200;

Private Sub above200()
        Dim n As Integer
        Dim sum = txtbx_basebet.Text
        Dim rolls = txtbx_rolls.Text
        Dim increase = txtbx_increasepercentage.Text
        Dim increasefinal, rolloutput, sumnew As Decimal
        Dim BillPlus As Decimal

        sumnew = 0
        ListBox1.Items.Add("Bet" & vbTab & "Sum")
        ListBox1.Items.Add("------------------")
        ListBox1.Items.Add("Basebet = " & sum)
        Do
            sumnew = sum * 10000
            increasefinal = increase * 0.01
            n += 1
            rolloutput = sumnew * increasefinal
            sum = rolloutput / 10000
            sumnew = sum
            BillPlus = Format$(sumnew, "0.00000000")
            ListBox1.Items.Add(n & vbTab & "%" & increase & vbTab & BillPlus)


            If n = rolls Then
                Exit Do
            End If
        Loop

    End Sub

Anyway there's how my program works, hope you enjoy.

No comments:

Post a Comment