Changed Piece string repr

master
Tibor Bizjak 2019-09-10 18:47:34 +02:00
parent f9431d8add
commit d4a9528127
1 changed files with 4 additions and 2 deletions

View File

@ -103,10 +103,13 @@ class Piece:
def __repr__(self): def __repr__(self):
if None in (self.piece, self.color): if None in (self.piece, self.color):
return None return ""
name = self.color.upper() + " CHESS " + self.piece.upper() name = self.color.upper() + " CHESS " + self.piece.upper()
return lookup(name) return lookup(name)
def __str__(self):
return repr(self)
def __eq__(self, other): def __eq__(self, other):
if other == None: if other == None:
return None in (self.color, self.piece) return None in (self.color, self.piece)
@ -426,4 +429,3 @@ def test():
continue continue
print(game) print(game)
test()