RosettaCodeData/Task/Playing-cards/Run-BASIC/playing-cards.basic

26 lines
805 B
Plaintext

suite$ = "C,D,H,S" ' Club, Diamond, Heart, Spade
card$ = "A,2,3,4,5,6,7,8,9,T,J,Q,K" ' Cards Ace to King
dim n(55) ' make ordered deck
for i = 1 to 52 ' of 52 cards
n(i) = i
next i
for i = 1 to 52 * 3 ' shuffle deck 3 times
i1 = int(rnd(1)*52) + 1
i2 = int(rnd(1)*52) + 1
h2 = n(i1)
n(i1) = n(i2)
n(i2) = h2
next i
for hand = 1 to 4 ' 4 hands
for deal = 1 to 13 ' deal each 13 cards
card = card + 1 ' next card in deck
s = (n(card) mod 4) + 1 ' determine suite
c = (n(card) mod 13) + 1 ' determine card
print word$(card$,c,",");word$(suite$,s,",");" "; ' show the card
next deal
print
next hand