Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--card.py2
-rw-r--r--deck.py26
2 files changed, 14 insertions, 14 deletions
diff --git a/card.py b/card.py
index aeb0369..2c5665c 100644
--- a/card.py
+++ b/card.py
@@ -71,7 +71,7 @@ class Card:
self.spr.set_layer(CARDS)
self.spr.draw()
- def hide_card(self):
+ def hide(self):
self.spr.move((-self.spr.images[0].get_width(),0))
diff --git a/deck.py b/deck.py
index 182f468..4f5b320 100644
--- a/deck.py
+++ b/deck.py
@@ -93,8 +93,8 @@ class Deck:
''' Shuffle the deck (Knuth algorithm). '''
decksize = self.count()
# Hide all the cards and make sure they are back to orientation 0
- for c in self.cards:
- c.reset()
+ for card in self.cards:
+ card.reset()
# Randomize the card order.
for n in range(decksize):
i = randrange(decksize - n)
@@ -133,8 +133,8 @@ class Deck:
def clear(self):
''' Remove any highlight from the cards. '''
- for i in self.cards:
- i.reset()
+ for card in self.cards:
+ card.reset()
def swap_cards(self,i,j):
''' Swap the position of two cards in the deck. '''
@@ -145,16 +145,16 @@ class Deck:
def spr_to_card(self, spr):
''' Given a sprite, find the corresponding card in the deck. '''
- for c in self.cards:
- if c.spr == spr:
- return c
+ for card in self.cards:
+ if card.spr == spr:
+ return card
return None
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:
- return c
+ for card in self.cards:
+ if card.index == i:
+ return card
return None
def deal_next_card(self):
@@ -178,9 +178,9 @@ class Deck:
def hide(self):
''' Hide the deck. '''
- for c in self.cards:
- if c is not None:
- c.hide_card()
+ for card in self.cards:
+ if card is not None:
+ card.hide()
def count(self):
''' Return the length of the deck. '''