suits
['♣️', '♦️', '♥️', '♠️']
for example the suit ar index 0
:
for exampel the rank at index 1
(note no rank at index 1 so that 2 - 10 match)
Card (suit:int, rank:int)
A playing card
Type | Details | |
---|---|---|
suit | int | An index into suits |
rank | int | an index into ranks |
equality, less than, and greater than should work on rank and suit indicies
test_eq(Card(suit=1, rank=3), Card(suit=1, rank=3))
test_ne(Card(suit=1, rank=12), Card(suit=3, rank=12))
test_ne(Card(suit=1, rank=3), Card(suit=3, rank=3))
assert Card(suit=1, rank=3) < Card(suit=2, rank=3)
assert Card(suit=3, rank=3) > Card(suit=2, rank=3)
assert not Card(suit=1, rank=3) > Card(suit=2, rank=3)