1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

flake8 - games/m*

This commit is contained in:
Shlomi Fish 2017-04-18 00:54:51 +03:00
parent d572d2921d
commit 231d370000
4 changed files with 140 additions and 83 deletions

View file

@ -24,23 +24,28 @@
__all__ = [] __all__ = []
# imports # imports
import sys
# PySol imports # PySol imports
from pysollib.mygettext import _, n_ from pysollib.mygettext import _
from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *
from pysollib.game import Game from pysollib.game import Game
from pysollib.layout import Layout from pysollib.layout import Layout
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint from pysollib.hint import CautiousDefaultHint
from pysollib.pysoltk import MfxCanvasText from pysollib.pysoltk import MfxCanvasText
from pysollib.util import KING, QUEEN, VARIABLE_REDEALS
from pysollib.stack import \
Stack, \
WasteStack, \
WasteTalonStack, \
SS_RowStack
# ************************************************************************ # ************************************************************************
# * Talon # * Talon
# ************************************************************************ # ************************************************************************
class Matriarchy_Waste(WasteStack): class Matriarchy_Waste(WasteStack):
def updateText(self): def updateText(self):
WasteStack.updateText(self) WasteStack.updateText(self)
@ -121,7 +126,7 @@ class Matriarchy_Talon(WasteTalonStack):
if self.game.preview > 1: if self.game.preview > 1:
return return
WasteTalonStack.updateText(self, update_rounds=0) WasteTalonStack.updateText(self, update_rounds=0)
## t = "Round %d" % self.round # t = "Round %d" % self.round
t = _("Round %d/%d") % (self.round, self.max_rounds) t = _("Round %d/%d") % (self.round, self.max_rounds)
self.texts.rounds.config(text=t) self.texts.rounds.config(text=t)
t = _("Deal %d") % self.DEAL[self.round-1] t = _("Deal %d") % self.DEAL[self.round-1]
@ -172,7 +177,7 @@ class Matriarchy(Game):
self.setSize(10*l.XS+l.XM, h + l.YM + h) self.setSize(10*l.XS+l.XM, h + l.YM + h)
# create stacks # create stacks
##center, c1, c2 = self.height / 2, h, self.height - h # center, c1, c2 = self.height / 2, h, self.height - h
center = self.height / 2 center = self.height / 2
c1, c2 = center-l.TEXT_HEIGHT/2, center+l.TEXT_HEIGHT/2 c1, c2 = center-l.TEXT_HEIGHT/2, center+l.TEXT_HEIGHT/2
x, y = l.XM, c1 - l.CH x, y = l.XM, c1 - l.CH
@ -191,7 +196,8 @@ class Matriarchy(Game):
s.talon = Matriarchy_Talon(x, y, self, max_rounds=VARIABLE_REDEALS) s.talon = Matriarchy_Talon(x, y, self, max_rounds=VARIABLE_REDEALS)
l.createText(s.talon, "n") l.createText(s.talon, "n")
l.createRoundText(s.talon, 'ss') l.createRoundText(s.talon, 'ss')
s.talon.texts.misc = MfxCanvasText(self.canvas, s.talon.texts.misc = MfxCanvasText(
self.canvas,
tx, center, anchor="center", tx, center, anchor="center",
font=self.app.getFont("canvas_large")) font=self.app.getFont("canvas_large"))
@ -204,7 +210,8 @@ class Matriarchy(Game):
def _shuffleHook(self, cards): def _shuffleHook(self, cards):
# move Queens to top of the Talon (i.e. first cards to be dealt) # move Queens to top of the Talon (i.e. first cards to be dealt)
return self._shuffleHookMoveToTop(cards, lambda c: (c.rank == 11, c.suit), 8) return self._shuffleHookMoveToTop(
cards, lambda c: (c.rank == 11, c.suit), 8)
def startGame(self): def startGame(self):
self.startDealSample() self.startDealSample()
@ -218,10 +225,10 @@ class Matriarchy(Game):
if card1.rank + card2.rank == QUEEN + KING: if card1.rank + card2.rank == QUEEN + KING:
return False return False
return (card1.suit == card2.suit and return (card1.suit == card2.suit and
((card1.rank + 1) % 13 == card2.rank or (card2.rank + 1) % 13 == card1.rank)) ((card1.rank + 1) % 13 == card2.rank or
(card2.rank + 1) % 13 == card1.rank))
# register the game # register the game
registerGame(GameInfo(17, Matriarchy, "Matriarchy", registerGame(GameInfo(17, Matriarchy, "Matriarchy",
GI.GT_2DECK_TYPE, 2, VARIABLE_REDEALS, GI.SL_BALANCED)) GI.GT_2DECK_TYPE, 2, VARIABLE_REDEALS, GI.SL_BALANCED))

View file

@ -24,24 +24,34 @@
__all__ = [] __all__ = []
# imports # imports
import sys
# PySol imports # PySol imports
from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *
from pysollib.game import Game from pysollib.game import Game
from pysollib.layout import Layout from pysollib.layout import Layout
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint from pysollib.hint import DefaultHint
from pysollib.util import ACE, NO_SUIT
from pysollib.stack import \
BasicRowStack, \
InitialDealTalonStack, \
InvisibleStack, \
Stack, \
StackWrapper, \
TalonStack, \
WasteStack, \
WasteTalonStack
# ************************************************************************ # ************************************************************************
# * # *
# ************************************************************************ # ************************************************************************
class Montana_Hint(DefaultHint): class Montana_Hint(DefaultHint):
def computeHints(self): def computeHints(self):
game = self.game game = self.game
RLEN, RSTEP, RBASE = game.RLEN, game.RSTEP, game.RBASE RSTEP, RBASE = game.RSTEP, game.RBASE
freerows = [s for s in game.s.rows if not s.cards] freerows = [s for s in game.s.rows if not s.cards]
# for each stack # for each stack
for r in game.s.rows: for r in game.s.rows:
@ -54,7 +64,8 @@ class Montana_Hint(DefaultHint):
else: else:
left = None left = None
if c.rank == RBASE: if c.rank == RBASE:
# do not move the leftmost card of a row if the rank is correct # do not move the leftmost card of a row if the
# rank is correct
continue continue
for t in freerows: for t in freerows:
if self.shallMovePile(r, t, pile, rpile): if self.shallMovePile(r, t, pile, rpile):
@ -82,7 +93,7 @@ class Montana_Talon(TalonStack):
# move cards to the Talon, shuffle and redeal # move cards to the Talon, shuffle and redeal
game = self.game game = self.game
decks = game.gameinfo.decks decks = game.gameinfo.decks
RLEN, RSTEP, RBASE = game.RLEN, game.RSTEP, game.RBASE RSTEP, RBASE = game.RSTEP, game.RBASE
num_cards = 0 num_cards = 0
assert len(self.cards) == 0 assert len(self.cards) == 0
rows = game.s.rows rows = game.s.rows
@ -121,7 +132,7 @@ class Montana_Talon(TalonStack):
game.nextRoundMove(self) game.nextRoundMove(self)
spaces = self.getRedealSpaces(stacks, gaps) spaces = self.getRedealSpaces(stacks, gaps)
for r in stacks: for r in stacks:
if not r in spaces: if r not in spaces:
self.game.moveMove(1, self, r, frames=4) self.game.moveMove(1, self, r, frames=4)
# done # done
assert len(self.cards) == 0 assert len(self.cards) == 0
@ -141,7 +152,8 @@ class Montana_RowStack(BasicRowStack):
if self.id % self.game.RSTEP == 0: if self.id % self.game.RSTEP == 0:
return cards[0].rank == self.game.RBASE return cards[0].rank == self.game.RBASE
left = self.game.s.rows[self.id - 1] left = self.game.s.rows[self.id - 1]
return left.cards and left.cards[-1].suit == cards[0].suit and left.cards[-1].rank + 1 == cards[0].rank return left.cards and left.cards[-1].suit == cards[0].suit \
and left.cards[-1].rank + 1 == cards[0].rank
def clickHandler(self, event): def clickHandler(self, event):
if not self.cards: if not self.cards:
@ -196,7 +208,6 @@ class Montana(Game):
# define stack-groups # define stack-groups
l.defaultStackGroups() l.defaultStackGroups()
# #
# game overrides # game overrides
# #
@ -221,7 +232,8 @@ class Montana(Game):
suit = rows[i].cards[-1].suit suit = rows[i].cards[-1].suit
for j in range(self.RSTEP - 1): for j in range(self.RSTEP - 1):
r = rows[i + j] r = rows[i + j]
if not r.cards or r.cards[-1].rank != self.RBASE + j or r.cards[-1].suit != suit: if not r.cards or r.cards[-1].rank != self.RBASE + j \
or r.cards[-1].suit != suit:
return False return False
return True return True
@ -235,7 +247,8 @@ class Montana(Game):
def getQuickPlayScore(self, ncards, from_stack, to_stack): def getQuickPlayScore(self, ncards, from_stack, to_stack):
if from_stack.cards: if from_stack.cards:
if from_stack.id % self.RSTEP == 0 and from_stack.cards[-1].rank == self.RBASE: if from_stack.id % self.RSTEP == 0 and \
from_stack.cards[-1].rank == self.RBASE:
# do not move the leftmost card of a row if the rank is correct # do not move the leftmost card of a row if the rank is correct
return -1 return -1
return 1 return 1
@ -252,10 +265,11 @@ class Spaces_Talon(Montana_Talon):
spaces = [] spaces = []
while len(spaces) != 4: while len(spaces) != 4:
r = self.game.random.choice(stacks) r = self.game.random.choice(stacks)
if not r in spaces: if r not in spaces:
spaces.append(r) spaces.append(r)
return spaces return spaces
class Spaces(Montana): class Spaces(Montana):
Talon_Class = StackWrapper(Spaces_Talon, max_rounds=3) Talon_Class = StackWrapper(Spaces_Talon, max_rounds=3)
@ -276,7 +290,8 @@ class BlueMoon(Montana):
if i % self.RSTEP == 0: # left column if i % self.RSTEP == 0: # left column
continue continue
self.s.talon.dealRow(rows=(self.s.rows[i],), frames=frames) self.s.talon.dealRow(rows=(self.s.rows[i],), frames=frames)
ace_rows = [r for r in self.s.rows if r.cards and r.cards[-1].rank == ACE] ace_rows = [r for r in self.s.rows
if r.cards and r.cards[-1].rank == ACE]
j = 0 j = 0
for r in ace_rows: for r in ace_rows:
self.moveMove(1, r, self.s.rows[j]) self.moveMove(1, r, self.s.rows[j])
@ -290,7 +305,8 @@ class BlueMoon(Montana):
class RedMoon(BlueMoon): class RedMoon(BlueMoon):
def _shuffleHook(self, cards): def _shuffleHook(self, cards):
# move Aces to top of the Talon (i.e. first cards to be dealt) # move Aces to top of the Talon (i.e. first cards to be dealt)
return self._shuffleHookMoveToTop(cards, lambda c: (c.rank == 0, c.suit)) return self._shuffleHookMoveToTop(
cards, lambda c: (c.rank == 0, c.suit))
def startGame(self): def startGame(self):
decks = self.gameinfo.decks decks = self.gameinfo.decks
@ -312,7 +328,8 @@ class RedMoon(BlueMoon):
class Galary_Hint(Montana_Hint): class Galary_Hint(Montana_Hint):
def shallMovePile(self, from_stack, to_stack, pile, rpile): def shallMovePile(self, from_stack, to_stack, pile, rpile):
if from_stack is to_stack or not to_stack.acceptsCards(from_stack, pile): if from_stack is to_stack or \
not to_stack.acceptsCards(from_stack, pile):
return False return False
# now check for loops # now check for loops
rr = self.ClonedStack(from_stack, stackcards=rpile) rr = self.ClonedStack(from_stack, stackcards=rpile)
@ -369,6 +386,7 @@ class Jungle_RowStack(Montana_RowStack):
left = self.game.s.rows[self.id - 1] left = self.game.s.rows[self.id - 1]
return left.cards and left.cards[-1].rank + 1 == cards[0].rank return left.cards and left.cards[-1].rank + 1 == cards[0].rank
class Jungle(BlueMoon): class Jungle(BlueMoon):
Talon_Class = StackWrapper(Montana_Talon, max_rounds=2) Talon_Class = StackWrapper(Montana_Talon, max_rounds=2)
RowStack_Class = Jungle_RowStack RowStack_Class = Jungle_RowStack
@ -386,7 +404,8 @@ class SpacesAndAces_RowStack(Montana_RowStack):
if self.id % self.game.RSTEP == 0: if self.id % self.game.RSTEP == 0:
return cards[0].rank == self.game.RBASE return cards[0].rank == self.game.RBASE
left = self.game.s.rows[self.id - 1] left = self.game.s.rows[self.id - 1]
return left.cards and left.cards[-1].suit == cards[0].suit and left.cards[-1].rank < cards[0].rank return left.cards and left.cards[-1].suit == cards[0].suit \
and left.cards[-1].rank < cards[0].rank
class SpacesAndAces(BlueMoon): class SpacesAndAces(BlueMoon):
@ -411,6 +430,7 @@ class SpacesAndAces(BlueMoon):
# * Paganini # * Paganini
# ************************************************************************ # ************************************************************************
class Paganini_Talon(Montana_Talon): class Paganini_Talon(Montana_Talon):
def _inSequence(self, card, suit, rank): def _inSequence(self, card, suit, rank):
card_rank = card.rank card_rank = card.rank
@ -418,6 +438,7 @@ class Paganini_Talon(Montana_Talon):
card_rank -= 4 card_rank -= 4
return card.suit == suit and card_rank == rank return card.suit == suit and card_rank == rank
class Paganini_RowStack(Montana_RowStack): class Paganini_RowStack(Montana_RowStack):
def acceptsCards(self, from_stack, cards): def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards): if not BasicRowStack.acceptsCards(self, from_stack, cards):
@ -433,6 +454,7 @@ class Paganini_RowStack(Montana_RowStack):
return cards[0].rank == 5 return cards[0].rank == 5
return left.cards[-1].rank+1 == cards[0].rank return left.cards[-1].rank+1 == cards[0].rank
class Paganini(BlueMoon): class Paganini(BlueMoon):
RLEN, RSTEP, RBASE = 40, 10, 0 RLEN, RSTEP, RBASE = 40, 10, 0
@ -589,17 +611,21 @@ class DoubleMontana(Montana):
continue continue
self.s.talon.dealRow(rows=(self.s.rows[i],), frames=frames) self.s.talon.dealRow(rows=(self.s.rows[i],), frames=frames)
class DoubleBlueMoon(DoubleMontana, BlueMoon): class DoubleBlueMoon(DoubleMontana, BlueMoon):
Talon_Class = StackWrapper(Montana_Talon, max_rounds=3) Talon_Class = StackWrapper(Montana_Talon, max_rounds=3)
RLEN, RSTEP, RBASE = 112, 14, 0 RLEN, RSTEP, RBASE = 112, 14, 0
def createGame(self): def createGame(self):
BlueMoon.createGame(self, round_text=True) BlueMoon.createGame(self, round_text=True)
startGame = BlueMoon.startGame startGame = BlueMoon.startGame
class DoubleRedMoon(DoubleMontana, RedMoon): class DoubleRedMoon(DoubleMontana, RedMoon):
Talon_Class = StackWrapper(Montana_Talon, max_rounds=3) Talon_Class = StackWrapper(Montana_Talon, max_rounds=3)
RLEN, RROWS = 112, 8 RLEN, RROWS = 112, 8
_shuffleHook = RedMoon._shuffleHook _shuffleHook = RedMoon._shuffleHook
def createGame(self): def createGame(self):
RedMoon.createGame(self, round_text=True) RedMoon.createGame(self, round_text=True)
startGame = RedMoon.startGame startGame = RedMoon.startGame
@ -618,9 +644,11 @@ registerGame(GameInfo(63, BlueMoon, "Blue Moon",
registerGame(GameInfo(117, RedMoon, "Red Moon", registerGame(GameInfo(117, RedMoon, "Red Moon",
GI.GT_MONTANA | GI.GT_OPEN, 1, 2, GI.SL_MOSTLY_SKILL)) GI.GT_MONTANA | GI.GT_OPEN, 1, 2, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(275, Galary, "Galary", registerGame(GameInfo(275, Galary, "Galary",
GI.GT_MONTANA | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 2, GI.SL_MOSTLY_SKILL)) GI.GT_MONTANA | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 2,
GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(276, Moonlight, "Moonlight", registerGame(GameInfo(276, Moonlight, "Moonlight",
GI.GT_MONTANA | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 2, GI.SL_MOSTLY_SKILL, GI.GT_MONTANA | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 2,
GI.SL_MOSTLY_SKILL,
si={"ncards": 48})) si={"ncards": 48}))
registerGame(GameInfo(380, Jungle, "Jungle", registerGame(GameInfo(380, Jungle, "Jungle",
GI.GT_MONTANA | GI.GT_OPEN, 1, 1, GI.SL_MOSTLY_SKILL)) GI.GT_MONTANA | GI.GT_OPEN, 1, 1, GI.SL_MOSTLY_SKILL))
@ -640,5 +668,3 @@ registerGame(GameInfo(770, DoubleBlueMoon, "Double Blue Moon",
GI.GT_MONTANA | GI.GT_OPEN, 2, 2, GI.SL_MOSTLY_SKILL)) GI.GT_MONTANA | GI.GT_OPEN, 2, 2, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(771, DoubleRedMoon, "Double Red Moon", registerGame(GameInfo(771, DoubleRedMoon, "Double Red Moon",
GI.GT_MONTANA | GI.GT_OPEN, 2, 2, GI.SL_MOSTLY_SKILL)) GI.GT_MONTANA | GI.GT_OPEN, 2, 2, GI.SL_MOSTLY_SKILL))

View file

@ -24,20 +24,31 @@
__all__ = [] __all__ = []
# imports # imports
import sys
# PySol imports # PySol imports
from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *
from pysollib.game import Game from pysollib.game import Game
from pysollib.layout import Layout from pysollib.layout import Layout
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint from pysollib.hint import DefaultHint
from pysollib.util import ANY_RANK, ANY_SUIT, KING, NO_RANK, UNLIMITED_REDEALS
from pysollib.stack import \
AbstractFoundationStack, \
BasicRowStack, \
DealRowRedealTalonStack, \
InitialDealTalonStack, \
OpenStack, \
ReserveStack, \
StackWrapper, \
TalonStack, \
SS_FoundationStack
# ************************************************************************ # ************************************************************************
# * # *
# ************************************************************************ # ************************************************************************
class MonteCarlo_Hint(DefaultHint): class MonteCarlo_Hint(DefaultHint):
# FIXME: demo is not too clever in this game # FIXME: demo is not too clever in this game
pass pass
@ -80,7 +91,8 @@ class MonteCarlo_RowStack(BasicRowStack):
if to_stack.cards: if to_stack.cards:
self._dropPairMove(ncards, to_stack, frames=-1, shadow=shadow) self._dropPairMove(ncards, to_stack, frames=-1, shadow=shadow)
else: else:
BasicRowStack.moveMove(self, ncards, to_stack, frames=frames, shadow=shadow) BasicRowStack.moveMove(
self, ncards, to_stack, frames=frames, shadow=shadow)
def _dropPairMove(self, n, other_stack, frames=-1, shadow=-1): def _dropPairMove(self, n, other_stack, frames=-1, shadow=-1):
game = self.game game = self.game
@ -101,7 +113,8 @@ class MonteCarlo_RowStack(BasicRowStack):
class MonteCarlo(Game): class MonteCarlo(Game):
Talon_Class = MonteCarlo_Talon Talon_Class = MonteCarlo_Talon
Foundation_Class = StackWrapper(AbstractFoundationStack, max_accept=0) Foundation_Class = StackWrapper(
AbstractFoundationStack, max_accept=0)
RowStack_Class = MonteCarlo_RowStack RowStack_Class = MonteCarlo_RowStack
Hint_Class = MonteCarlo_Hint Hint_Class = MonteCarlo_Hint
@ -151,7 +164,6 @@ class MonteCarlo(Game):
def shallHighlightMatch(self, stack1, card1, stack2, card2): def shallHighlightMatch(self, stack1, card1, stack2, card2):
return card1.rank == card2.rank return card1.rank == card2.rank
# #
# game extras # game extras
# #
@ -328,9 +340,11 @@ class Neighbour_RowStack(MonteCarlo_RowStack):
assert ncards == 1 assert ncards == 1
if self.cards[-1].rank == KING: if self.cards[-1].rank == KING:
assert to_stack in self.game.s.foundations assert to_stack in self.game.s.foundations
BasicRowStack.moveMove(self, ncards, to_stack, frames=frames, shadow=shadow) BasicRowStack.moveMove(
self, ncards, to_stack, frames=frames, shadow=shadow)
else: else:
MonteCarlo_RowStack.moveMove(self, ncards, to_stack, frames=frames, shadow=shadow) MonteCarlo_RowStack.moveMove(
self, ncards, to_stack, frames=frames, shadow=shadow)
def _dropKingClickHandler(self, event): def _dropKingClickHandler(self, event):
if not self.cards: if not self.cards:
@ -552,7 +566,6 @@ class Vertical(Nestor):
# define stack-groups # define stack-groups
l.defaultStackGroups() l.defaultStackGroups()
def startGame(self): def startGame(self):
self.s.talon.dealRow(frames=0) self.s.talon.dealRow(frames=0)
for i in range(4): for i in range(4):
@ -562,7 +575,6 @@ class Vertical(Nestor):
self.s.talon.dealRow(rows=[self.s.rows[3]]) self.s.talon.dealRow(rows=[self.s.rows[3]])
# ************************************************************************ # ************************************************************************
# * The Wish # * The Wish
# ************************************************************************ # ************************************************************************
@ -590,7 +602,9 @@ class TheWish(Game):
s.talon = InitialDealTalonStack(x, y, self) s.talon = InitialDealTalonStack(x, y, self)
x, y = self.width - l.XS, self.height - l.YS x, y = self.width - l.XS, self.height - l.YS
s.foundations.append(AbstractFoundationStack(x, y, self, suit=ANY_SUIT, s.foundations.append(
AbstractFoundationStack(
x, y, self, suit=ANY_SUIT,
max_move=0, max_cards=32, max_accept=0, base_rank=ANY_RANK)) max_move=0, max_cards=32, max_accept=0, base_rank=ANY_RANK))
l.createText(s.foundations[0], "n") l.createText(s.foundations[0], "n")
@ -617,9 +631,11 @@ class TheWish(Game):
def shallHighlightMatch(self, stack1, card1, stack2, card2): def shallHighlightMatch(self, stack1, card1, stack2, card2):
return card1.rank == card2.rank return card1.rank == card2.rank
class TheWishOpen(TheWish): class TheWishOpen(TheWish):
def fillStack(self, stack): def fillStack(self, stack):
pass pass
def startGame(self): def startGame(self):
for i in range(3): for i in range(3):
self.s.talon.dealRow(frames=0) self.s.talon.dealRow(frames=0)
@ -630,11 +646,13 @@ class TheWishOpen(TheWish):
# * Der letzte Monarch (The last Monarch) # * Der letzte Monarch (The last Monarch)
# ************************************************************************ # ************************************************************************
class DerLetzteMonarch_Foundation(SS_FoundationStack): class DerLetzteMonarch_Foundation(SS_FoundationStack):
def acceptsCards(self, from_stack, cards): def acceptsCards(self, from_stack, cards):
if cards is None: if cards is None:
# special hack for _getDropStack() below # special hack for _getDropStack() below
return SS_FoundationStack.acceptsCards(self, from_stack, from_stack.cards) return SS_FoundationStack.acceptsCards(
self, from_stack, from_stack.cards)
# #
if not SS_FoundationStack.acceptsCards(self, from_stack, cards): if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
return False return False
@ -714,10 +732,14 @@ class DerLetzteMonarch(Game):
for i in range(4): for i in range(4):
for j in range(13): for j in range(13):
x, y, = dx + l.XM + j*l.XS, l.YM + (i+1)*l.YS x, y, = dx + l.XM + j*l.XS, l.YM + (i+1)*l.YS
s.rows.append(DerLetzteMonarch_RowStack(x, y, self, max_accept=1, max_cards=2)) s.rows.append(
DerLetzteMonarch_RowStack(
x, y, self, max_accept=1, max_cards=2))
for i in range(4): for i in range(4):
x, y, = l.XM + (i+2)*l.XS, l.YM x, y, = l.XM + (i+2)*l.XS, l.YM
s.reserves.append(DerLetzteMonarch_ReserveStack(x, y, self, max_accept=0)) s.reserves.append(
DerLetzteMonarch_ReserveStack(
x, y, self, max_accept=0))
for i in range(4*decks): for i in range(4*decks):
x, y, = l.XM + (i+7)*l.XS, l.YM x, y, = l.XM + (i+7)*l.XS, l.YM
s.foundations.append(DerLetzteMonarch_Foundation(x, y, self, s.foundations.append(DerLetzteMonarch_Foundation(x, y, self,
@ -753,7 +775,6 @@ class DerLetzteMonarch(Game):
def getDemoInfoText(self): def getDemoInfoText(self):
return "Der letzte\nMonarch" return "Der letzte\nMonarch"
# #
# game extras # game extras
# #
@ -882,7 +903,6 @@ class RightAndLeft(Game):
self.s.talon.dealRow() self.s.talon.dealRow()
# register the game # register the game
registerGame(GameInfo(89, MonteCarlo, "Monte Carlo", registerGame(GameInfo(89, MonteCarlo, "Monte Carlo",
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK, GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK,
@ -899,9 +919,11 @@ registerGame(GameInfo(91, SimplePairs, "Simple Pairs",
registerGame(GameInfo(92, Neighbour, "Neighbour", registerGame(GameInfo(92, Neighbour, "Neighbour",
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK)) GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(96, Fourteen, "Fourteen", registerGame(GameInfo(96, Fourteen, "Fourteen",
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_LUCK)) GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0,
GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(235, Nestor, "Nestor", registerGame(GameInfo(235, Nestor, "Nestor",
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_LUCK)) GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0,
GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(152, DerLetzteMonarch, "The Last Monarch", registerGame(GameInfo(152, DerLetzteMonarch, "The Last Monarch",
GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL, GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
altnames=("Der letzte Monarch",))) altnames=("Der letzte Monarch",)))
@ -909,14 +931,16 @@ registerGame(GameInfo(328, TheWish, "The Wish",
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK, GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK,
ranks=(0, 6, 7, 8, 9, 10, 11, 12))) ranks=(0, 6, 7, 8, 9, 10, 11, 12)))
registerGame(GameInfo(329, TheWishOpen, "The Wish (open)", registerGame(GameInfo(329, TheWishOpen, "The Wish (open)",
GI.GT_PAIRING_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0, GI.SL_MOSTLY_SKILL, GI.GT_PAIRING_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0,
GI.SL_MOSTLY_SKILL,
ranks=(0, 6, 7, 8, 9, 10, 11, 12))) ranks=(0, 6, 7, 8, 9, 10, 11, 12)))
registerGame(GameInfo(368, Vertical, "Vertical", registerGame(GameInfo(368, Vertical, "Vertical",
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_LUCK)) GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0,
GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(649, DoubletsII, "Doublets II", registerGame(GameInfo(649, DoubletsII, "Doublets II",
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK)) GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(663, TheLastMonarchII, "The Last Monarch II", registerGame(GameInfo(663, TheLastMonarchII, "The Last Monarch II",
GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL)) GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0,
GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(727, RightAndLeft, "Right and Left", registerGame(GameInfo(727, RightAndLeft, "Right and Left",
GI.GT_PAIRING_TYPE, 2, -1, GI.SL_LUCK)) GI.GT_PAIRING_TYPE, 2, -1, GI.SL_LUCK))

View file

@ -10,7 +10,7 @@ use String::ShellQuote qw/ shell_quote /;
# my $cmd = shell_quote( 'flake8', '.' ); # my $cmd = shell_quote( 'flake8', '.' );
my $cmd = shell_quote( 'flake8', my $cmd = shell_quote( 'flake8',
grep { not($_ eq './pysollib/pysoltk.py' or $_ eq './pysollib/tile/ttk.py') } glob('./pysollib/*.py ./pysollib/[cmpuw]*/*.py ./pysollib/tile/*.py ./pysollib/ui/tktile/*.py ./pysollib/games/[a-ly-z]*.py') ); grep { not($_ eq './pysollib/pysoltk.py' or $_ eq './pysollib/tile/ttk.py') } glob('./pysollib/*.py ./pysollib/[cmpuw]*/*.py ./pysollib/tile/*.py ./pysollib/ui/tktile/*.py ./pysollib/games/[a-my-z]*.py') );
# TEST # TEST
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." ); eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );