beginning implementations of CardCollection and some of its subclasses
This commit is contained in:
25
BearOnline/cards/_card.py
Normal file
25
BearOnline/cards/_card.py
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
Reference in New Issue
Block a user