Bug#859047: pysolfc: Any stack of Hanafuda cards is always movable

Frédéric Brière fbriere at fbriere.net
Wed Mar 29 18:49:27 UTC 2017


Package: pysolfc
Version: 2.0-4
Severity: normal
Tags: patch

Any stack of Hanafuda cards is always deemed movable, even if it is out
of sequence.  The effect can easily be seen a game such as Firecracker,
where:

 - Any stack can be dragged as a whole (but not released)
 - "Highlight piles" will highlight everything
 - Asking for a hint will ignore most valid moves

This is due to Hanafuda_SequenceStack lacking a canMoveCards() method.


-- System Information:
Debian Release: 9.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-2-amd64 (SMP w/3 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
-------------- next part --------------
>From 51d19eb99dc138549a0cb3b32c1e8983fe43d26a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= <fbriere at fbriere.net>
Date: Wed, 29 Mar 2017 13:02:38 -0400
Subject: [PATCH] Define canMoveCards() for Hanafuda sequence stacks

---
 pysollib/games/ultra/hanafuda_common.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pysollib/games/ultra/hanafuda_common.py b/pysollib/games/ultra/hanafuda_common.py
index b4b9541..27d28b6 100644
--- a/pysollib/games/ultra/hanafuda_common.py
+++ b/pysollib/games/ultra/hanafuda_common.py
@@ -310,6 +310,9 @@ class Hanafuda_SequenceStack(Flower_OpenStack):
             return cards[0].rank == 0 or self.cap.base_rank == ANY_RANK
         return self.isHanafudaSequence([stackcards[-1], cards[0]])
 
+    def canMoveCards(self, cards):
+        return self.basicCanMoveCards(cards) and self.isHanafudaSequence(cards)
+
 
 class Oonsoo_SequenceStack(Flower_OpenStack):
 
@@ -322,6 +325,9 @@ class Oonsoo_SequenceStack(Flower_OpenStack):
             return cards[0].rank == 0 or self.cap.base_rank == ANY_RANK
         return self.isHanafudaSequence([stackcards[-1], cards[0]], 0)
 
+    def canMoveCards(self, cards):
+        return self.basicCanMoveCards(cards) and self.isHanafudaSequence(cards, 0)
+
 
 class FlowerClock_RowStack(Flower_OpenStack):
 
-- 
2.11.0



More information about the Pkg-games-devel mailing list