Szachy/piece.py

17 lines
543 B
Python
Raw Permalink Normal View History

2023-06-08 16:02:55 +02:00
class Piece:
def __init__(self, name, color):
self.name = name
self.color = color
2023-06-22 23:51:41 +02:00
self.valid_moves = [] #dostępne ruchy dla figury
self.moved = False #informacja czy figura wykonała już swój pierwszy ruch, potrzebne do policzenia ruchow pawn
2023-06-08 16:02:55 +02:00
if color == 'white':
self.pawn_direction = -1
else:
self.pawn_direction = 1
def add_moves(self, move):
self.valid_moves.append(move)
def delete_moves(self):
self.valid_moves = []
2023-06-15 16:22:32 +02:00
2023-06-13 16:17:23 +02:00