Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Checking if certain dice come on the board?

$
0
0
I did do my homework on this problem, but I couldn't find anything. I was wondering how to check to see if certain dice, like a 3-of-a-kind, or a straight, come on the board? This is the only way I know how, but it's really redundant:

 Private Sub ThreeOfAKind1Dice(ByVal Dice1 As Integer, ByVal Dice2 As Integer, ByVal Dice3 As Integer)

        If n1 = 1 And n2 = 1 And n3 = 1 Then 'Enables the first, second and third dice buttons if they come up as 1
            Dice1 = 1
            Dice2 = 1
            Dice3 = 1
        End If

        If n1 = 1 And n2 = 1 And n4 = 1 Then 'Enables the first, second and fourth dice buttons if they come up as 1
            Dice1 = 2
            Dice2 = 2
            Dice3 = 2
        End If

        If n1 = 1 And n2 = 1 And n5 = 1 Then 'Enables the first, second and fifth dice buttons if they come up as 1
            Dice1 = 3
            Dice2 = 3
            Dice3 = 3
        End If




Is there anyway to shorten this code to make it more manageable and less redundant?

Viewing all articles
Browse latest Browse all 51036

Trending Articles