-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiece.py
41 lines (31 loc) · 962 Bytes
/
Piece.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from BoardColor import *
class Piece:
# definition of piece dimensions, moves, kings, colors
def __init__(self, row, column, color):
self.row = row
self.column = column
self.color = color
self.king = False
self.previousPosition = [0, 0]
def move(self, row, column):
self.previousPosition[self.row, self.column]
self.row = row
self.column = column
def isKing(self):
return self.king
def makeKing(self):
self.king = True
def getCurrentPosition(self):
return self.row, self.column
def setCurrentPosition(self, row, column):
self.row = row
self.column = column
def getColor(self):
return self.color
def setColor(self, color):
self.color = color
def __repr__(self) -> str:
if self.color == AI_COLOR:
return "AI"
elif self.color == PLAYER_COLOR:
return "PL"