Skip to content

Commit

Permalink
Define canMoveCards() for Hanafuda sequence stacks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fbriere authored and shlomif committed Jul 28, 2019
1 parent 26631a7 commit 0abb801
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pysollib/games/ultra/hanafuda_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ def acceptsCards(self, from_stack, cards):
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):

Expand All @@ -298,6 +301,9 @@ def acceptsCards(self, from_stack, cards):
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):

Expand Down

0 comments on commit 0abb801

Please sign in to comment.