mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8 - games/o*
This commit is contained in:
parent
bbc2af7c59
commit
2cd0df484d
2 changed files with 30 additions and 18 deletions
|
@ -24,21 +24,30 @@
|
|||
__all__ = []
|
||||
|
||||
# imports
|
||||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mygettext import _
|
||||
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.util import ANY_RANK, ANY_SUIT, UNLIMITED_REDEALS
|
||||
|
||||
from pysollib.stack import \
|
||||
AbstractFoundationStack, \
|
||||
BasicRowStack, \
|
||||
FullStackWrapper, \
|
||||
InitialDealTalonStack, \
|
||||
OpenStack, \
|
||||
WasteStack, \
|
||||
WasteTalonStack, \
|
||||
ReserveStack
|
||||
|
||||
# ************************************************************************
|
||||
# * Osmosis
|
||||
# ************************************************************************
|
||||
|
||||
|
||||
class Osmosis_Foundation(AbstractFoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
|
@ -49,7 +58,8 @@ class Osmosis_Foundation(AbstractFoundationStack):
|
|||
for s in self.game.s.foundations:
|
||||
if len(s.cards) > max_cards:
|
||||
max_s, max_cards = s, len(s.cards)
|
||||
# if we have less cards, then rank must match the card in this foundation
|
||||
# if we have less cards, then rank must match the card in this
|
||||
# foundation
|
||||
if len(self.cards) < max_cards:
|
||||
if cards[0].rank != max_s.cards[len(self.cards)].rank:
|
||||
return False
|
||||
|
@ -161,8 +171,8 @@ class OsmosisII_Foundation(AbstractFoundationStack):
|
|||
|
||||
|
||||
class OsmosisII(Osmosis):
|
||||
Foundation_Class = FullStackWrapper(OsmosisII_Foundation,
|
||||
base_rank=ANY_RANK, suit=ANY_SUIT, max_move=0)
|
||||
Foundation_Class = FullStackWrapper(
|
||||
OsmosisII_Foundation, base_rank=ANY_RANK, suit=ANY_SUIT, max_move=0)
|
||||
|
||||
def createGame(self, max_rounds=-1, num_deal=3):
|
||||
Osmosis.createGame(self, num_deal=3)
|
||||
|
@ -211,7 +221,8 @@ class OpenPeek(Game):
|
|||
y += l.YS
|
||||
x, y, = 2*l.XM+l.XS+5*l.XOFFSET, l.YM
|
||||
for i in range(4):
|
||||
stack = Osmosis_Foundation(x, y, self, i, base_rank=ANY_RANK, max_move=0)
|
||||
stack = Osmosis_Foundation(
|
||||
x, y, self, i, base_rank=ANY_RANK, max_move=0)
|
||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
||||
s.foundations.append(stack)
|
||||
y += l.YS
|
||||
|
@ -257,7 +268,8 @@ class Genesis(Game):
|
|||
# create stacks
|
||||
x, y, = l.XM+(rows-4)*l.XS/2, l.YM
|
||||
for i in range(4):
|
||||
stack = Osmosis_Foundation(x, y, self, i, base_rank=ANY_RANK, max_move=0)
|
||||
stack = Osmosis_Foundation(
|
||||
x, y, self, i, base_rank=ANY_RANK, max_move=0)
|
||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
|
||||
s.foundations.append(stack)
|
||||
x += l.XS
|
||||
|
@ -326,10 +338,9 @@ class Bridesmaids(Game):
|
|||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
||||
def startGame(self, flip=0):
|
||||
# deal first card to foundation
|
||||
base_card = self.s.talon.getCard()
|
||||
self.s.talon.getCard()
|
||||
to_stack = self.s.foundations[0]
|
||||
self.startDealSample()
|
||||
self.flipMove(self.s.talon)
|
||||
|
@ -337,18 +348,20 @@ class Bridesmaids(Game):
|
|||
self.s.talon.dealCards() # deal first card to WasteStack
|
||||
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(59, Osmosis, "Osmosis",
|
||||
GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK))
|
||||
registerGame(GameInfo(60, Peek, "Peek",
|
||||
GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK))
|
||||
registerGame(GameInfo(298, OpenPeek, "Open Peek",
|
||||
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))
|
||||
registerGame(GameInfo(370, Genesis, "Genesis",
|
||||
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))
|
||||
registerGame(GameInfo(371, GenesisPlus, "Genesis +",
|
||||
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))
|
||||
registerGame(GameInfo(409, Bridesmaids, "Bridesmaids",
|
||||
GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK))
|
||||
registerGame(GameInfo(715, OsmosisII, "Treasure Trove",
|
||||
|
@ -356,4 +369,3 @@ registerGame(GameInfo(715, OsmosisII, "Treasure Trove",
|
|||
registerGame(GameInfo(716, PeekII, "Peek II",
|
||||
GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK,
|
||||
rules_filename='treasuretrove.html'))
|
||||
|
||||
|
|
|
@ -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-ny-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-oy-z]*.py') );
|
||||
|
||||
# TEST
|
||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||
|
|
Loading…
Add table
Reference in a new issue