Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a0dc1c4

Browse files
committed
Actually, *this* fixes the last bug.
1 parent 1b2b53a commit a0dc1c4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Demo/tkinter/guido/solitaire.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ def randperm(n):
446446

447447
class OpenStack(Stack):
448448

449+
def acceptable(self, cards):
450+
return 0
451+
449452
def usermovehandler(self, cards):
450453
card = cards[0]
451454
stack = self.game.closeststack(card)
@@ -561,6 +564,8 @@ def __init__(self, master):
561564
for i in range(NROWS):
562565
self.rows.append(RowStack(x, y, self))
563566
x = x + XSPACING
567+
568+
self.openstacks = [self.opendeck] + self.suits + self.rows
564569

565570
self.deck.fill()
566571
self.deal()
@@ -591,7 +596,7 @@ def closeststack(self, card):
591596
cdist = 999999999
592597
# Since we only compare distances,
593598
# we don't bother to take the square root.
594-
for stack in self.rows + self.suits:
599+
for stack in self.openstacks:
595600
dist = (stack.x - card.x)**2 + (stack.y - card.y)**2
596601
if dist < cdist:
597602
closest = stack
@@ -609,7 +614,7 @@ def deal(self):
609614
r.showtop()
610615

611616
def reset(self):
612-
for stack in [self.opendeck] + self.suits + self.rows:
617+
for stack in self.openstacks:
613618
while 1:
614619
card = stack.deal()
615620
if not card:

0 commit comments

Comments
 (0)