From 2fea6652429231534a44038c2023f9852a02b5aa Mon Sep 17 00:00:00 2001 From: lufebe16 <lufebe16@bluewin.ch> Date: Mon, 10 Feb 2020 18:01:20 +0100 Subject: [PATCH] Corrections on game 'pyramid' - For TypeError reported with #147. (clickhandler failed to return a value) - For index out of range (in pyramid.y) --- pysollib/games/pyramid.py | 6 ++++-- pysollib/stack.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pysollib/games/pyramid.py b/pysollib/games/pyramid.py index 2b49cbfa..0cc86032 100644 --- a/pysollib/games/pyramid.py +++ b/pysollib/games/pyramid.py @@ -82,8 +82,10 @@ class Pyramid_StackMethods: def _dropPairMove(self, n, other_stack, frames=-1, shadow=-1): if not self.game.demo: self.game.playSample("droppair", priority=200) - assert n == 1 and self.acceptsCards( - other_stack, [other_stack.cards[-1]]) + if not (n == 1 + and other_stack.cards + and self.acceptsCards(other_stack, [other_stack.cards[-1]])): + return old_state = self.game.enterState(self.game.S_FILL) f = self.game.s.foundations[0] self.game.moveMove(n, self, f, frames=frames, shadow=shadow) diff --git a/pysollib/stack.py b/pysollib/stack.py index e34e7ca4..1ec6d66c 100644 --- a/pysollib/stack.py +++ b/pysollib/stack.py @@ -2935,9 +2935,10 @@ class FaceUpWasteTalonStack(WasteTalonStack): self.game.fillStack(self) def dealCards(self, sound=False): - WasteTalonStack.dealCards(self, sound=sound) + retval = WasteTalonStack.dealCards(self, sound=sound) if self.canFlipCard(): self.flipMove() + return retval class OpenTalonStack(TalonStack, OpenStack):