I am doing a game in which I need the computer to select two random cards, for some reason I always get a "Computer POINT" match and the randomCard never changes
Dim flipped As Boolean
Dim counter As Integer = 0
Dim rnd = New Random()
randomCard = cardList(rnd.Next(0, cardList.Count))
While counter < 2
'counter is 2 because the computer has to make two moves
flipped = randomCard.IsFlipped
If counter = 0 And flipped <> True Then
'First move
firstCard = randomCard
Dim nLabel As Integer = randomCard.PairType
counter += 1
ElseIf counter = 1 And flipped <> True Then
'Second move
secCard = randomCard
If firstCard.PairType = secCard.PairType And firstCard IsNot secCard Then
'If the two random cards are from the same type
MsgBox("Computer match. ONE POINT!")
cardList.Remove(firstCard)
cardList.Remove(secCard)
counter += 1
Else
MsgBox("Computer NO match!")
counter += 1
End If
End If
'Next random to keep loop going
rnd = New Random()
randomCard = cardList(rnd.Next(0, cardList.Count))
End While