Hi: I have been trying to create an eight deck card "shoe" (as used in casino games such as Blackjack and Baccarat), but have run into some problems. I do not have much programming experience, and so I tried the following rather inefficient code using multi-dimensional arrays. Each hand in baccarat contains between 4 and 6 cards, so if 410 cards is reached or exceeded, the program attempts to reshuffle all cards. The problem is duplicate cards for some ranks and an insufficient number for others on all runs. Suits are irrelevant in baccarat and so weren't addressed. Any ideas on whether the following code is fixable, or do I need to start again with a whole new algorithm? OS is Win2000. Many thanks! -Gambler.

[code]

55 dim card(52,8)

60 dim value(52,8)

65 for x = 1 to 52

70 for y = 1 to 8

75 card(x,y) = x

84 next y

85 next x

90 for x = 1 to 52

100 for y = 1 to 8

110 c = int(rnd(52)*100)

115 d = int(rnd(8)*100)

120 if d > 8 or d = 0 then 115

125 if c > 52 or c = 0 then 110

130 GOSUB [assigncardvalues]

135 card(c,d) = 0

140 next y

145 next x

150 GOSUB [dealhand]

155 GOSUB [displayhands] 'not shown

160 GOSUB [printcount] 'not shown

165 GOSUB [handoutcome] 'not shown

170 if cardnum >= 410 then goto 55 'variable initialized in [dealhands]

[assigncardvalues]

if c mod 13 = 1 then value(x,y) = 2

if c mod 13 = 2 then value(x,y) = 3

if c mod 13 = 3 then value(x,y) = 4

if c mod 13 = 4 then value(x,y) = 5

if c mod 13 = 5 then value(x,y) = 6

if c mod 13 = 6 then value(x,y) = 7

if c mod 13 = 7 then value(x,y) = 8

if c mod 13 = 8 then value(x,y) = 9

if c mod 13 = 9 then value(x,y) = 10

if c mod 13 = 10 then value(x,y) = 10

if c mod 13 = 11 then value(x,y) = 10

if c mod 13 = 12 then value(x,y) = 10

if c mod 13 = 0 then value(x,y) = 1

RETURN

[code]