git.ucc.asn.au
/
progcomp2013.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Actually commit stuff from ages ago
[progcomp2013.git]
/
qchess
/
src
/
piece.py
diff --git
a/qchess/src/piece.py
b/qchess/src/piece.py
index
d9acef2
..
162e82e
100644
(file)
--- a/
qchess/src/piece.py
+++ b/
qchess/src/piece.py
@@
-13,13
+13,13
@@
class Piece():
self.types = types # List of possible types the piece can be (should just be two)
self.current_type = "unknown" # Current type
self.choice = -1 # Index of the current type in self.types (-1 = unknown type)
self.types = types # List of possible types the piece can be (should just be two)
self.current_type = "unknown" # Current type
self.choice = -1 # Index of the current type in self.types (-1 = unknown type)
- self.types_revealed = [True, False] # Whether the types are known (by default the first type is always known at game start)
-
- #
+
self.last_state = None
self.last_state = None
+
self.move_pattern = None
self.move_pattern = None
-
+ self.coverage = None
+ self.possible_moves = None
def init_from_copy(self, c):
def init_from_copy(self, c):
@@
-29,8
+29,7
@@
class Piece():
self.types = c.types[:]
self.current_type = c.current_type
self.choice = c.choice
self.types = c.types[:]
self.current_type = c.current_type
self.choice = c.choice
- self.types_revealed = c.types_revealed[:]
-
+
self.last_state = None
self.move_pattern = None
self.last_state = None
self.move_pattern = None
@@
-38,7
+37,7
@@
class Piece():
# Make a string for the piece (used for debug)
def __str__(self):
# Make a string for the piece (used for debug)
def __str__(self):
- return str(self.current_type) + " " + str(self.types) + " at " + str(self.x) + ","+str(self.y)
+ return str(self.c
olour) + " " + str(self.c
urrent_type) + " " + str(self.types) + " at " + str(self.x) + ","+str(self.y)
# Draw the piece in a pygame surface
def draw(self, window, grid_sz = [80,80], style="quantum"):
# Draw the piece in a pygame surface
def draw(self, window, grid_sz = [80,80], style="quantum"):
@@
-58,7
+57,7
@@
class Piece():
# Draw the two possible types underneath the current_type image
for i in range(len(self.types)):
# Draw the two possible types underneath the current_type image
for i in range(len(self.types)):
- if
self.types_revealed[i] == True
:
+ if
always_reveal_states == True or self.types[i][0] != '?'
:
img = small_images[self.colour][self.types[i]]
else:
img = small_images[self.colour]["unknown"] # If the type hasn't been revealed, show a placeholder
img = small_images[self.colour][self.types[i]]
else:
img = small_images[self.colour]["unknown"] # If the type hasn't been revealed, show a placeholder
@@
-76,17
+75,18
@@
class Piece():
# Collapses the wave function!
def select(self):
# Collapses the wave function!
def select(self):
- if self.current_type == "unknown":
+ if self.current_type == "unknown"
or not self.choice in [0,1]
:
self.choice = random.randint(0,1)
self.choice = random.randint(0,1)
+ if self.types[self.choice][0] == '?':
+ self.types[self.choice] = self.types[self.choice][1:]
self.current_type = self.types[self.choice]
self.current_type = self.types[self.choice]
- self.types_revealed[self.choice] = True
return self.choice
# Uncollapses (?) the wave function!
def deselect(self):
#print "Deselect called"
if (self.x + self.y) % 2 != 0:
return self.choice
# Uncollapses (?) the wave function!
def deselect(self):
#print "Deselect called"
if (self.x + self.y) % 2 != 0:
- if (self.types[0] != self.types[1]) or (self.types
_revealed[0] == False or self.types_revealed[1] == False
):
+ if (self.types[0] != self.types[1]) or (self.types
[0][0] == '?' or self.types[1][0] == '?'
):
self.current_type = "unknown"
self.choice = -1
else:
self.current_type = "unknown"
self.choice = -1
else:
UCC
git Repository :: git.ucc.asn.au