24 lines
646 B
Python
24 lines
646 B
Python
class Piece:
|
|
def __init__(self, name, color):
|
|
self.name = name
|
|
self.color = color
|
|
self.valid_moves = []
|
|
self.moved = False
|
|
if color == 'white':
|
|
if (self.name=='king'):
|
|
self.where_king=(3,7)
|
|
self.pawn_direction = -1
|
|
else:
|
|
self.pawn_direction = 1
|
|
if (self.name=='king'):
|
|
self.where_king=(3,7)
|
|
def add_moves(self, move):
|
|
self.valid_moves.append(move)
|
|
|
|
def delete_moves(self):
|
|
self.valid_moves = []
|
|
def change_where_king(self, move):
|
|
self.where_king = move
|
|
|
|
|