Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/deck.py
diff options
context:
space:
mode:
Diffstat (limited to 'deck.py')
-rw-r--r--deck.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/deck.py b/deck.py
index 4cae052..d423d8f 100644
--- a/deck.py
+++ b/deck.py
@@ -43,9 +43,9 @@ class Deck:
# Initialize the deck of cards by looping through all the patterns
i = 0
for shape in range(0, shape_range):
- for color in range(0, color_range):
- for num in range(0, number_range):
- for fill in range(0, fill_range):
+ for fill in range(0, fill_range):
+ for color in range(0, color_range):
+ for num in range(0, number_range):
i = self._make(sprites, card_type, numbers_type, i,
lists, scale, shape, color, num, fill)
@@ -61,9 +61,13 @@ class Deck:
self.cards.append(Card(sprites, generate_number_card(shape, color,
num, fill, numbers_type, scale), [shape, color, num, fill]))
elif card_type == 'custom':
- self.cards.append(Card(sprites, generate_word_card(color, shape,
- num, fill, scale), [shape, color, num, fill],
- file_path=lists[i], scale=scale))
+ if len(lists) == 9:
+ index = shape * 3 + num
+ else:
+ index = i
+ self.cards.append(Card(sprites, generate_word_card(shape, color,
+ num, fill, scale), [shape, color, num, fill],
+ file_path=lists[index], scale=scale))
i += 1
else:
self.cards.append(Card(sprites, generate_word_card(shape, color,
@@ -127,7 +131,7 @@ class Deck:
def index_to_card(self, i):
""" Given a card index, find the corresponding card in the deck. """
for c in self.cards:
- if c.index == i:
+ if c is not None and c.index == i:
return c
return None