-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClickablePiece.py
44 lines (37 loc) · 1.34 KB
/
ClickablePiece.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
42
43
44
# Clickable Piece Class
# Represent a piece which can be selected and move by the user (or AI)
class ClickablePiece:
# Init Method
# Init Class variables
def __init__(self, pos, queen):
self.piecePosition = pos
self.possibilities = []
self.queen = queen
# Set Possibilities
# Setter for possibilities
def setPossibilities(self, possibilities):
self.possibilities = possibilities
# Append Possibilities
# Add a possibility to current possibilities
def appendPossibilites(self, possibility):
self.possibilities.append(possibility)
# Get Pos
# Return piece's position
def getPos(self):
return self.piecePosition
# Get Possibilitites
# Return the current possibilities
def getPossibilities(self):
return self.possibilities
# Get Nb Possibilities
# Return the number of current possibilities
def getNbPossibilities(self):
return len(self.possibilities)
# Has Possibilities
# Return true if there is at least one possibility in the current possibilities
def hasPossibilities(self):
return True if len(self.possibilities) > 0 else False
# Is Queen
# Return true if the piece is a queen, false otherwise
def isQueen(self):
return self.queen