Here are some basic card game routines
Only shuffle has been tested, so please tell me if there are any bugs.
Shuffle:
randomize timer()
for d = 0 to rndmnes
cardA = rnd(num)
cardB = rnd(num)
card$ = deck$(cardB)
deck$(cardB) = deck$(cardA)
deck$(cardA) = card$
next d
return
AddToBack:
deck$(num+1) = newcard$
return
AddToFront:
for d = num to 0 step -1
deck$(d+1) = deck$(d)
next d
deck$(0) = newcard$
return
InsertCard:
for d = num to insertpos step -1
deck$(d+1) = deck$(d)
next d
deck$(insertpos) = newcard$
return
TakeCard:
takecard$ = deck$(takepos)
dec num
for d = takepos to num
deck$(d) = deck$(d+1)
next d
deck$(num+1) = ""
return
num = number of cards in deck
deck$() = array with a string for each card
newcard$ = the card you want to add to the pack
takepos = the position in the deck from where you want to take a card
insertpos = the position in the deck where you want to insert a card
rndmnes = how random you want the pack - the smaller the faster, but less random, the larger the slower, but more random.
There are three types of people, those that can count and those that can't.