Sub Globals
dim cards(52)
End Sub
Sub App_Start
setuporder
order
filllist
Form1.show
num1.minimum=-50
num1.maximum=50
End Sub
Sub Button1_Click
shuffle
filllist
End Sub
sub filllist
listbox1.clear
for i = 0 to arraylist1.count-1
listbox1.add(arraylist1.item(i))
next
listbox1.refresh
end sub
sub order
arraylist1.clear
for I= 0 to 51
arraylist1.add(cards(i))
next
end sub
sub copyarraylist
arraylist2.clear
for I=0 to arraylist1.count-1
arraylist2.add(arraylist1.item(i))
next
arraylist1.clear
end sub
sub shuffle
copyarraylist
do while arraylist2.count >0
I=rnd(0,arraylist2.count-1)
arraylist1.add(arraylist2.item(i))
arraylist2.removeat(i)
loop
end sub
Sub setuporder
arraylist1.clear
s="HCDS"
r=0
suit=0
for I=0 to 51
r=r+1
cards(i)=substring("0"&r,strlength("0"&r)-2,2)&substring(s,suit,1)
if r=13 then
R=0
suit=suit+1
end if
next
end sub
Sub Button2_Click
order
filllist
End Sub
Sub Button3_Click
arraylist1.sort(cCaseSensitive)
filllist
End Sub
Sub FilterButton_Click
filterout
filllist
end sub
sub filterout
if num1.value <>0 then
copyarraylist
arraylist2.sort(cCaseSensitive)
t=round(arraylist2.count/2)
b=0
if num1.value >0 then b=t
iterations=round(t-(abs(num1.value)*2*t/100))
'msgbox(t&" "&b&" "&iterations&" "&(b+t-1))
for i = (b+t-1) to b step -1
arraylist1.add(arraylist2.item(i))
arraylist2.remove(arraylist2.item(i))
next
do while iterations >0
p=rnd(0,arraylist2.count-1)
arraylist1.add(arraylist2.item(p))
arraylist2.removeat(p)
iterations = iterations -1
loop
end if
End Sub