1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-03-12 04:07:01 -04:00

Fix highlight match logic for Nines/Tens/Elevens

This commit is contained in:
Joe R 2025-03-01 22:24:17 -05:00
parent 52e2ffc58f
commit 04b7eacfcb

View file

@ -583,8 +583,8 @@ class Elevens(Pyramid):
self.leaveState(old_state)
def shallHighlightMatch(self, stack1, card1, stack2, card2):
# FIXME
return False
return (card1.rank + card2.rank == 9 or
(9 < card1.rank != card2.rank > 9))
class ElevensToo(Elevens):
@ -633,6 +633,11 @@ class SuitElevens(Elevens):
def createGame(self):
Elevens.createGame(self, rows=3, cols=5)
def shallHighlightMatch(self, stack1, card1, stack2, card2):
return (Elevens.shallHighlightMatch(self, stack1, card1,
stack2, card2)
and card1.suit == card2.suit)
# ************************************************************************
# * Tens
@ -665,6 +670,10 @@ class Tens(ElevensToo):
def createGame(self):
Elevens.createGame(self, rows=2, cols=7, maxpiles=13, reserves=4)
def shallHighlightMatch(self, stack1, card1, stack2, card2):
return (card1.rank + card2.rank == 8 or
(8 < card1.rank == card2.rank > 8))
class Nines_RowStack(Elevens_RowStack):
ACCEPTED_SUM = 7
@ -709,6 +718,10 @@ class Nines(Tens):
def createGame(self):
Elevens.createGame(self, rows=3, cols=3, reserves=4)
def shallHighlightMatch(self, stack1, card1, stack2, card2):
return (card1.rank + card2.rank == 7 or
(8 < card1.rank != card2.rank > 8))
# ************************************************************************
# * The Lucky Number