# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/card.ipynb. # %% auto 0 __all__ = ['suits', 'ranks', 'Card'] # %% ../nbs/card.ipynb 3 from fastcore.test import * from fastcore.utils import * from . import * # %% ../nbs/card.ipynb 5 suits = ["♦️", "♣️", "♥️", "♣️"] ranks = [None, "A"] + [str(x) for x in range(2, 11)] + ["J", "Q", "K"] # %% ../nbs/card.ipynb 11 class Card: def __init__( self, suit: int, rank: int # An index to the `suits` # An index to the `ranks` ): self.suit = suit self.rank = rank def __str__(self): return f"{ranks[self.rank]}{suits[self.suit]}" __repr__ = __str__ # %% ../nbs/card.ipynb 16 @patch def __eq__(self: Card, other: Card): return (self.suit, self.rank) == (other.suit, other.rank) # %% ../nbs/card.ipynb 17 @patch def __lt__(self: Card, other: Card): return (self.suit, self.rank) < (other.suit, other.rank) # %% ../nbs/card.ipynb 18 @patch def __gt__(self: Card, other: Card): return (self.suit, self.rank) > (other.suit, other.rank)