Changed Piece string repr
parent
f9431d8add
commit
d4a9528127
6
chess.py
6
chess.py
|
@ -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()
|
|
||||||
|
|
Loading…
Reference in New Issue