diff options
author | Guido van Rossum <guido@python.org> | 1996-12-30 02:37:07 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-12-30 02:37:07 (GMT) |
commit | a0dc1c4a613f11e1b6e20fa25658823533ca201b (patch) | |
tree | 0c33ff112bc160bc0ae33c204f6ac085162c9f24 /Demo/tkinter | |
parent | 1b2b53a25d27d96f60926802226dd375767cb3b2 (diff) | |
download | cpython-a0dc1c4a613f11e1b6e20fa25658823533ca201b.zip cpython-a0dc1c4a613f11e1b6e20fa25658823533ca201b.tar.gz cpython-a0dc1c4a613f11e1b6e20fa25658823533ca201b.tar.bz2 |
Actually, *this* fixes the last bug.
Diffstat (limited to 'Demo/tkinter')
-rwxr-xr-x | Demo/tkinter/guido/solitaire.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Demo/tkinter/guido/solitaire.py b/Demo/tkinter/guido/solitaire.py index 4c1bb78..361eb6b 100755 --- a/Demo/tkinter/guido/solitaire.py +++ b/Demo/tkinter/guido/solitaire.py @@ -446,6 +446,9 @@ def randperm(n): class OpenStack(Stack): + def acceptable(self, cards): + return 0 + def usermovehandler(self, cards): card = cards[0] stack = self.game.closeststack(card) @@ -561,6 +564,8 @@ class Solitaire: for i in range(NROWS): self.rows.append(RowStack(x, y, self)) x = x + XSPACING + + self.openstacks = [self.opendeck] + self.suits + self.rows self.deck.fill() self.deal() @@ -591,7 +596,7 @@ class Solitaire: cdist = 999999999 # Since we only compare distances, # we don't bother to take the square root. - for stack in self.rows + self.suits: + for stack in self.openstacks: dist = (stack.x - card.x)**2 + (stack.y - card.y)**2 if dist < cdist: closest = stack @@ -609,7 +614,7 @@ class Solitaire: r.showtop() def reset(self): - for stack in [self.opendeck] + self.suits + self.rows: + for stack in self.openstacks: while 1: card = stack.deal() if not card: |