rules might be wonky but works

This commit is contained in:
Jannes Höke
2016-02-29 12:16:12 +01:00
parent 5465fca34f
commit 0d381ddf4d
5 changed files with 138 additions and 61 deletions

17
card.py
View File

@ -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)