suits['♣️', '♦️', '♥️', '♠️']
We will be using numbers to represent playing card clubs and ranks. These are the suits:
For instance the suit at index 0:
These are the ranks
For instance the rank at index ‘1’ (not that there isn’t a playing card at position ‘0’, since we want the ranks to match the indices where possible)
Card (suit:int, rank:int)
A playing card, created by passing in ‘rank’ from ‘ranks’ and ‘suit’ from ‘suits’
| Type | Details | |
|---|---|---|
| suit | int | An index into ’suits |
| rank | int | An index into ‘ranks’ |
Here is an example:
Equality, less than, and greater than work on the rank and suit indices:
For instance here are a test for quality…
… and a test of ‘<’
…and finally of >: