rules might be wonky but works
This commit is contained in:
17
card.py
17
card.py
@ -51,18 +51,7 @@ class Card(object):
|
||||
return '%s_%s' % (self.color, self.value)
|
||||
|
||||
def __repr__(self):
|
||||
if self.special:
|
||||
return self.special
|
||||
'''
|
||||
if self.special is CHOOSE:
|
||||
return "Colorchooser"
|
||||
elif self.special is DRAW_FOUR:
|
||||
return "Draw four"
|
||||
'''
|
||||
else:
|
||||
return self.color + " - " + self.value
|
||||
|
||||
return str(self)
|
||||
return ' '.join([s.capitalize() for s in str(self).split('_')])
|
||||
|
||||
def __eq__(self, other):
|
||||
return str(self) == str(other)
|
||||
@ -75,8 +64,8 @@ class Card(object):
|
||||
|
||||
|
||||
def from_str(string):
|
||||
if '_' in string:
|
||||
if string not in SPECIALS:
|
||||
color, value = string.split('_')
|
||||
return Card(color, value)
|
||||
else:
|
||||
return Card(None, None, string)
|
||||
return Card(None, None, string)
|
||||
|
Reference in New Issue
Block a user