mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8 - games/w*
This commit is contained in:
parent
118a8391e1
commit
35c6287cd7
3 changed files with 41 additions and 30 deletions
|
@ -24,22 +24,27 @@
|
|||
__all__ = []
|
||||
|
||||
# imports
|
||||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
from pysollib.stack import *
|
||||
from pysollib.game import Game
|
||||
from pysollib.layout import Layout
|
||||
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint
|
||||
|
||||
from pysollib.util import ANY_RANK
|
||||
|
||||
from pysollib.stack import \
|
||||
AC_RowStack, \
|
||||
InitialDealTalonStack, \
|
||||
OpenStack, \
|
||||
isAlternateColorSequence, \
|
||||
isSameSuitSequence, \
|
||||
SS_RowStack
|
||||
|
||||
# ************************************************************************
|
||||
# * Wave Motion
|
||||
# ************************************************************************
|
||||
|
||||
|
||||
class WaveMotion(Game):
|
||||
RowStack_Class = SS_RowStack
|
||||
|
||||
|
@ -116,9 +121,9 @@ class Flourish(WaveMotion):
|
|||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(314, WaveMotion, "Wave Motion",
|
||||
GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(753, Flourish, "Flourish",
|
||||
GI.GT_1DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
GI.GT_1DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0,
|
||||
GI.SL_MOSTLY_SKILL))
|
||||
|
|
|
@ -24,23 +24,34 @@
|
|||
__all__ = []
|
||||
|
||||
# imports
|
||||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
from pysollib.game import Game
|
||||
from pysollib.layout import Layout
|
||||
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint
|
||||
from pysollib.hint import CautiousDefaultHint
|
||||
|
||||
from golf import BlackHole_Foundation
|
||||
|
||||
from pysollib.util import ACE, ANY_SUIT, KING, UNLIMITED_CARDS
|
||||
|
||||
from pysollib.stack import \
|
||||
AC_RowStack, \
|
||||
RK_FoundationStack, \
|
||||
RK_RowStack, \
|
||||
ReserveStack, \
|
||||
SS_FoundationStack, \
|
||||
Stack, \
|
||||
UD_RK_RowStack, \
|
||||
WasteStack, \
|
||||
WasteTalonStack, \
|
||||
StackWrapper
|
||||
|
||||
# ************************************************************************
|
||||
# *
|
||||
# ************************************************************************
|
||||
|
||||
|
||||
class Windmill_Foundation(RK_FoundationStack):
|
||||
def getBottomImage(self):
|
||||
if self.cap.base_rank == ACE:
|
||||
|
@ -70,7 +81,8 @@ class Windmill(Game):
|
|||
RowStack_Class = Windmill_RowStack
|
||||
|
||||
FOUNDATIONS_LAYOUT = ((1, 0.6), (3, 0.6), (1, 3.4), (3, 3.4))
|
||||
ROWS_LAYOUT = ((2,0), (2,1), (0,2), (1,2), (3,2), (4,2), (2,3), (2,4))
|
||||
ROWS_LAYOUT = ((2, 0), (2, 1), (0, 2), (1, 2), (3, 2), (4, 2),
|
||||
(2, 3), (2, 4))
|
||||
FILL_STACK = True
|
||||
|
||||
#
|
||||
|
@ -230,7 +242,6 @@ class NapoleonsTomb(Game):
|
|||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
||||
#
|
||||
# game overrides
|
||||
#
|
||||
|
@ -280,7 +291,6 @@ class Corners(Game):
|
|||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
||||
def fillStack(self, stack):
|
||||
if len(stack.cards) == 0:
|
||||
if stack is self.s.waste and self.s.talon.cards:
|
||||
|
@ -288,7 +298,6 @@ class Corners(Game):
|
|||
elif stack in self.s.rows and self.s.waste.cards:
|
||||
self.s.waste.moveMove(1, stack)
|
||||
|
||||
|
||||
def _shuffleHook(self, cards):
|
||||
suits = []
|
||||
top_cards = []
|
||||
|
@ -299,10 +308,9 @@ class Corners(Game):
|
|||
top_cards.append(c)
|
||||
if len(suits) == 4:
|
||||
break
|
||||
top_cards.sort(lambda a, b: cmp(b.suit, a.suit))
|
||||
top_cards = sorted(top_cards, key=lambda x: -x.suit)
|
||||
return cards+top_cards
|
||||
|
||||
|
||||
def startGame(self):
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow(rows=self.s.foundations)
|
||||
|
@ -363,6 +371,7 @@ class FourSeasons(Czarina):
|
|||
def fillStack(self, stack):
|
||||
pass
|
||||
|
||||
|
||||
class FlorentinePatience(FourSeasons):
|
||||
def createGame(self):
|
||||
Czarina.createGame(self, max_rounds=2)
|
||||
|
@ -388,7 +397,8 @@ class Simplicity(Game):
|
|||
(l.XM, l.YM+3*l.YS),
|
||||
(l.XM+7*l.XS, l.YM+3*l.YS),
|
||||
):
|
||||
s.foundations.append(SS_FoundationStack(x, y, self, suit=i, mod=13))
|
||||
s.foundations.append(
|
||||
SS_FoundationStack(x, y, self, suit=i, mod=13))
|
||||
i += 1
|
||||
y = l.YM+l.YS
|
||||
for i in range(2):
|
||||
|
@ -408,7 +418,6 @@ class Simplicity(Game):
|
|||
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
||||
def startGame(self):
|
||||
self.startDealSample()
|
||||
# deal base_card to Foundations, update foundations cap.base_rank
|
||||
|
@ -420,10 +429,8 @@ class Simplicity(Game):
|
|||
self.s.talon.dealRow()
|
||||
self.s.talon.dealCards()
|
||||
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_ACW
|
||||
|
||||
|
||||
def _restoreGameHook(self, game):
|
||||
self.base_card = self.cards[game.loadinfo.base_card_id]
|
||||
for s in self.s.foundations:
|
||||
|
@ -458,4 +465,3 @@ registerGame(GameInfo(561, DutchSolitaire, "Dutch Solitaire",
|
|||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(696, FlorentinePatience, "Florentine Patience",
|
||||
GI.GT_1DECK_TYPE, 1, 1, GI.SL_MOSTLY_LUCK))
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use String::ShellQuote qw/ shell_quote /;
|
|||
|
||||
# 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-uy-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-wy-z]*.py') );
|
||||
|
||||
# TEST
|
||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||
|
|
Loading…
Add table
Reference in a new issue