I have a class that describe chess pieces. I make for all type piece in the Board a class for example Pawn, Queen, keen, etc... I have a trouble in Pawn class I want to convert to Queen or other object that has a class (when pawn goto 8th row then convert to something another) how can I do this ?
class Pawn:
def __init__(self ,x ,y):
self.x = x
self.y = y
def move(self ,unit=1):
if self.y ==7 :
self.y += 1
what = raw_input("queen/rook/knight/bishop/(Q,R,K,B)?")
# There is most be changed that may be convert to:
# Queen ,knight ,bishop ,rook
if self.y != 2 and unit == 2:
print ("not accesible!!")
elif self.y ==2 and unit == 2:
self.y += 2
elif unit == 1:
self.y += 1
else:
print("can`t move over there")