26 lines
450 B
Python
26 lines
450 B
Python
import abc
|
|
from abc import ABC
|
|
from functools import total_ordering
|
|
|
|
@total_ordering
|
|
class Card(ABC):
|
|
def __init__(self, rank, suit):
|
|
self._rank = rank
|
|
self._suit = suit
|
|
|
|
@abc.abstractmethod
|
|
def __lt__(self, other):
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
def __eq__(self, other):
|
|
pass
|
|
|
|
@property
|
|
def rank(self):
|
|
return self._rank
|
|
|
|
@property
|
|
def suit(self):
|
|
return self._suit
|