From 48bb9d650bc2b7a319f2461b843a9afc63c56470 Mon Sep 17 00:00:00 2001 From: Joe R Date: Wed, 8 Sep 2021 21:18:11 -0400 Subject: [PATCH] Fixed Decade hints. --- pysollib/games/pushpin.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pysollib/games/pushpin.py b/pysollib/games/pushpin.py index 48531efa..2de5e491 100644 --- a/pysollib/games/pushpin.py +++ b/pysollib/games/pushpin.py @@ -389,6 +389,23 @@ class AccordionsRevenge(Accordion2): # ************************************************************************ +# Hint should reveal a valid move, but some intelligence should be added. +class Decade_Hint(AbstractHint): + + def computeHints(self): + game = self.game + rows = game.s.rows + for i in range(len(rows)): + for j in range(i + 1, len(rows)): + total = 0 + count = 0 + for k in range(i, j): + total += min(self.game.s.rows[k].cards[0].rank + 1, 10) + count += 1 + if total in [10, 20, 30] and count > 1: + self.addHint(5000, 1, rows[i], rows[j - 1]) + + class Decade_RowStack(PushPin_RowStack): def acceptsCards(self, from_stack, cards): @@ -426,6 +443,7 @@ class Decade_RowStack(PushPin_RowStack): class Decade(PushPin): + Hint_Class = Decade_Hint RowStack_Class = Decade_RowStack def isGameWon(self):