Card games...

Blitz3D Forums/Blitz3D Beginners Area/Card games...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Sorry about that po. Should have been:

global kind$=""
global name$=""
global amount=0

global no_suits=4; set up number of suits
global no_cards_suit=13; number of cards in each suit
dim cards(no_suits,no_cards_suit); dim the array

dim suit_name$(no_suits) ; set up the suits array, so you can easily pull names from it
suit_name$(1)="Spades"
suit_name$(2)="Clubs"
suit_name$(3)="Hearts"
suit_name$(4)="Diamonds"

repeat
   suit=rand(1,4) ; generate a random suit
   card=rand(1,13) ; generate a random card number
until cards(suit,card)=1 ; keep looping till you find a card that is 'there'

cards(suit,card)=0

if card=1 then
   name$="Ace":kind$=suit_name$(suit):amount=11
elseif card=11 then
   name$="Jack":kind$=suit_name$(suit):amount=10
elseif card=12 then
   name$="Queen":kind$=suit_name$(suit):amount=10
elseif card=13 then
   name$="King":kind$=suit_name$(suit):amount=10
else
   name$=card:kind$=suit_name$(suit):amount=card
end if