Possibly an array of types?
after that you would do something to shuffle the deck, then deal the cards using something like
basically, t is the player (0-4 so 5 players total) and j is the card (5 cards).
Then after the player chooses which cards to discard, you deal the player some more always updating cardcount each time one is dealt. Also some betting mechanism and so forth. Then when it's time to check the hands:
Now this method assumes that ace is high. If you're playing Ace as either high or low, then you need to make provisions for that when you check for the straight.
Edited because I realized my code example would check for a flush and straight flush, but not a straight. :-)
Type cards Field value field suit end type dim deck(51).cards dim hands(4,4).cards for t = 0 to 51 deck(t).cards = new cards deck(t).value = t mod 13 + 2 deck(t).suit = Floor(t / 13) next cardcount = 0
after that you would do something to shuffle the deck, then deal the cards using something like
for t = 0 to 4 for j = 0 to 4 hands(t,j).cards = new cards hands(t,j)/value = deck(cardcount)/value hands(t.j)/suit = deck(cardcount)/suit cardcount = cardcount + 1 next next
basically, t is the player (0-4 so 5 players total) and j is the card (5 cards).
Then after the player chooses which cards to discard, you deal the player some more always updating cardcount each time one is dealt. Also some betting mechanism and so forth. Then when it's time to check the hands:
for t = 0 to 4 suit = hands(t,0)/suit flush = true for j = 1 to 4; check for flush if (hands(t,j)/suit <> suit then flush = false next low = 13 ;check for straight high = 0 for j = 0 to 4 if hands(t,j) < low then low = hands(t,j) if hands(t,j) > high then high = hands(t,j) next if (high - low) = 4; straight straight = true else straight = false end if ... check for other hands. next
Now this method assumes that ace is high. If you're playing Ace as either high or low, then you need to make provisions for that when you check for the straight.
Edited because I realized my code example would check for a flush and straight flush, but not a straight. :-)