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__ = []
|
__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.mfxutil import kwdefault
|
|
||||||
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.util import ANY_RANK
|
||||||
|
|
||||||
|
from pysollib.stack import \
|
||||||
|
AC_RowStack, \
|
||||||
|
InitialDealTalonStack, \
|
||||||
|
OpenStack, \
|
||||||
|
isAlternateColorSequence, \
|
||||||
|
isSameSuitSequence, \
|
||||||
|
SS_RowStack
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Wave Motion
|
# * Wave Motion
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
class WaveMotion(Game):
|
class WaveMotion(Game):
|
||||||
RowStack_Class = SS_RowStack
|
RowStack_Class = SS_RowStack
|
||||||
|
|
||||||
|
@ -116,9 +121,9 @@ class Flourish(WaveMotion):
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# register the game
|
# register the game
|
||||||
registerGame(GameInfo(314, WaveMotion, "Wave Motion",
|
registerGame(GameInfo(314, WaveMotion, "Wave Motion",
|
||||||
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))
|
||||||
registerGame(GameInfo(753, Flourish, "Flourish",
|
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__ = []
|
__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 CautiousDefaultHint
|
||||||
|
|
||||||
from golf import BlackHole_Foundation
|
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):
|
class Windmill_Foundation(RK_FoundationStack):
|
||||||
def getBottomImage(self):
|
def getBottomImage(self):
|
||||||
if self.cap.base_rank == ACE:
|
if self.cap.base_rank == ACE:
|
||||||
|
@ -70,7 +81,8 @@ class Windmill(Game):
|
||||||
RowStack_Class = Windmill_RowStack
|
RowStack_Class = Windmill_RowStack
|
||||||
|
|
||||||
FOUNDATIONS_LAYOUT = ((1, 0.6), (3, 0.6), (1, 3.4), (3, 3.4))
|
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
|
FILL_STACK = True
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -230,7 +242,6 @@ class NapoleonsTomb(Game):
|
||||||
# define stack-groups
|
# define stack-groups
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# game overrides
|
# game overrides
|
||||||
#
|
#
|
||||||
|
@ -280,7 +291,6 @@ class Corners(Game):
|
||||||
# define stack-groups
|
# define stack-groups
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
|
||||||
def fillStack(self, stack):
|
def fillStack(self, stack):
|
||||||
if len(stack.cards) == 0:
|
if len(stack.cards) == 0:
|
||||||
if stack is self.s.waste and self.s.talon.cards:
|
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:
|
elif stack in self.s.rows and self.s.waste.cards:
|
||||||
self.s.waste.moveMove(1, stack)
|
self.s.waste.moveMove(1, stack)
|
||||||
|
|
||||||
|
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
suits = []
|
suits = []
|
||||||
top_cards = []
|
top_cards = []
|
||||||
|
@ -299,10 +308,9 @@ class Corners(Game):
|
||||||
top_cards.append(c)
|
top_cards.append(c)
|
||||||
if len(suits) == 4:
|
if len(suits) == 4:
|
||||||
break
|
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
|
return cards+top_cards
|
||||||
|
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow(rows=self.s.foundations)
|
self.s.talon.dealRow(rows=self.s.foundations)
|
||||||
|
@ -363,6 +371,7 @@ class FourSeasons(Czarina):
|
||||||
def fillStack(self, stack):
|
def fillStack(self, stack):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FlorentinePatience(FourSeasons):
|
class FlorentinePatience(FourSeasons):
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
Czarina.createGame(self, max_rounds=2)
|
Czarina.createGame(self, max_rounds=2)
|
||||||
|
@ -388,7 +397,8 @@ class Simplicity(Game):
|
||||||
(l.XM, l.YM+3*l.YS),
|
(l.XM, l.YM+3*l.YS),
|
||||||
(l.XM+7*l.XS, 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
|
i += 1
|
||||||
y = l.YM+l.YS
|
y = l.YM+l.YS
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
|
@ -408,7 +418,6 @@ class Simplicity(Game):
|
||||||
|
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
# deal base_card to Foundations, update foundations cap.base_rank
|
# deal base_card to Foundations, update foundations cap.base_rank
|
||||||
|
@ -420,10 +429,8 @@ class Simplicity(Game):
|
||||||
self.s.talon.dealRow()
|
self.s.talon.dealRow()
|
||||||
self.s.talon.dealCards()
|
self.s.talon.dealCards()
|
||||||
|
|
||||||
|
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_ACW
|
shallHighlightMatch = Game._shallHighlightMatch_ACW
|
||||||
|
|
||||||
|
|
||||||
def _restoreGameHook(self, game):
|
def _restoreGameHook(self, game):
|
||||||
self.base_card = self.cards[game.loadinfo.base_card_id]
|
self.base_card = self.cards[game.loadinfo.base_card_id]
|
||||||
for s in self.s.foundations:
|
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))
|
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(696, FlorentinePatience, "Florentine Patience",
|
registerGame(GameInfo(696, FlorentinePatience, "Florentine Patience",
|
||||||
GI.GT_1DECK_TYPE, 1, 1, GI.SL_MOSTLY_LUCK))
|
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', '.' );
|
||||||
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
|
# TEST
|
||||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||||
|
|
Loading…
Add table
Reference in a new issue