Microsoft Small Basic

Program Listing: VDW412
rey:

i=1
a=""

'this is to shufle a french deck
re:
card= Math.GetRandomNumber(52)
If Array.ContainsValue(a,card) Then
Goto re
EndIf

a[i]=card
i=i+1
If i>52 Then
Goto fin
EndIf
Goto re
fin:

' i pick the first 13 cards

bottom=1
top=52
' i start eleliminating cards from the top till i find a red ace(1 or 2))
restart:

If a[top]=1 Or a[top]= 2 Then
a[top]="*"
Goto break
EndIf
top=top-1
Goto restart
break:

'i bet as the monty hall that the red ace prize is not gonna be in my intitial pick
' the pot is the total cards left minus the ones left i pick
total=top
selecionados=13
For i= 1 To 13
If a[i]=1 Or a[i]=2 Then
bob=bob-(total-13)
Goto break2
Else
bob=bob+selecionados
Goto break2
EndIf
EndFor
break2:
TextWindow.WriteLine("wins "+bob)
Goto rey