Microsoft Small Basic

Program Listing: SJD119
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 3 cards from the top and one from the bottom till i find a red ace(1 or 2))
restart:
For i=1 To 3
If a[i]=1 Or a[i]=2 Then
a[bottom]="*"
Goto break
EndIf
bottom=bottom+1
EndFor
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-bottom
selecionados=13-bottom
For i= bottom To 13
If a[i]=1 Or a[i]=2 Then
bob=bob-(total-selecionados)
Goto break2
Else
bob=bob+selecionados
Goto break2
EndIf
EndFor
break2:
TextWindow.WriteLine("wins "+bob)
Goto rey