Re: Programming a Poker Game
Enumerate suits as 0-3 and ranks as 0-12. Then represent each card as an integer, where:
- ID = suit * 13 + rank
Then for card 'c':
- suit of c = c / 13
- rank of c = c % 13
The deck can now be a one-dimensional array. If you order suits Clubs, Hearts, Spades, Diamonds (0-3), then 0 is the 2[img]/images/graemlins/club.gif[/img] and 51 is the A[img]/images/graemlins/diamond.gif[/img].
|