RosettaCodeData/Task/Playing-cards/Yabasic/playing-cards.basic

27 lines
717 B
Plaintext

suite$ = "CDHS" //Club, Diamond, Heart, Spade
card$ = "A23456789TJQK" //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(ran(52)) + 1
i2 = int(ran(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 = mod(n(card), 4) + 1 //determine suite
c = mod(n(card), 13) + 1 //determine card
print mid$(card$,c,1),mid$(suite$,s,1)," "; //show the card
next deal
print
next hand
end