I am working on creating a king-of-the-hill that involves using playing cards, but I am not sure what the best way to represent them textually is.
Here are some alternatives I have considered:
Note, the samples show a hand consisting of the Ace of Clubs, Ten of Clubs, Five of Hearts, Five of Spades, and Queen of Spades.
Represent rank with digits
1
-9
and10
, and thenJ
,Q
, andK
, and suit withS
(spades),C
(clubs),D
(diamonds), andH
(hearts):1C 10C 5H 5S QS
Use
0
to represent a ten:1C 0C 5H 5S QS
- Each card is represented by the same number of characters.
- Somewhat less readable.
Use numbers to represent all ranks:
1C 10C 5H 5S 12S
- Might be easier to parse, somehow.
Use
♠
.♣
,♦
, and♥
to represent suit:1♣ 10♣ 5♥ 5♠ Q♠
- Much easier to read.
- Might be more difficult for languages that have problems with extended charsets.
Use
A
instead of1
, for an ace:A♣ 10♣ 5♥ 5♠ Q♠
- Makes it a little bit prettier.
Some combination of these alternatives.
Use a custom character set to encode the cards.
- Much more efficient.
- Can't view it very easily.
I am rather partial to formatting them like A♣ 10♣ 5♥ 5♠ Q♠
, but I would like to see what others think about this issue.