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

flake8 - games/special

This commit is contained in:
Shlomi Fish 2017-04-18 15:12:41 +03:00
parent 2505afdb68
commit 0d63e5d559
6 changed files with 157 additions and 102 deletions

View file

@ -24,20 +24,23 @@
__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 pysollib.stack import \
InitialDealTalonStack, \
isRankSequence, \
BasicRowStack
# ************************************************************************
# * Tower of Hanoy
# ************************************************************************
class TowerOfHanoy_Hint(CautiousDefaultHint):
# FIXME: demo is completely clueless
pass
@ -75,7 +78,8 @@ class TowerOfHanoy(Game):
# create stacks
for i in range(3):
x, y, = l.XM + (i+1)*l.XS, l.YM
s.rows.append(self.RowStack_Class(x, y, self, max_accept=1, max_move=1))
s.rows.append(
self.RowStack_Class(x, y, self, max_accept=1, max_move=1))
s.talon = InitialDealTalonStack(l.XM, self.height-l.YS, self)
# define stack-groups
@ -149,6 +153,7 @@ class HanoiSequence(TowerOfHanoy):
return 1
return 0
# register the game
registerGame(GameInfo(124, TowerOfHanoy, "Tower of Hanoy",
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
@ -168,4 +173,3 @@ registerGame(GameInfo(209, HanoiPuzzle6, "Hanoi Puzzle 6",
registerGame(GameInfo(769, HanoiSequence, "Hanoi Sequence",
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
suits=(2,), ranks=range(9)))

View file

@ -24,23 +24,26 @@
__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.pysoltk import MfxCanvasText
# from pysollib.util import ANY_SUIT
from pysollib.stack import \
InitialDealTalonStack, \
InvisibleStack, \
OpenStack
# ************************************************************************
# *
# ************************************************************************
class Memory_RowStack(OpenStack):
def clickHandler(self, event):
game = self.game
@ -51,7 +54,8 @@ class Memory_RowStack(OpenStack):
self.flipMove()
game.other_stack = self
else:
assert len(game.other_stack.cards) == 1 and game.other_stack.cards[-1].face_up
assert len(game.other_stack.cards) == 1 and \
game.other_stack.cards[-1].face_up
c1, c2 = self.cards[-1], game.other_stack.cards[0]
self.flipMove()
if self.game.cardsMatch(c1, c2):
@ -59,7 +63,7 @@ class Memory_RowStack(OpenStack):
else:
game.playSample("flip", priority=5)
game.score = game.score - 1
game.updateStatus(moves=game.moves.index+1) # update moves now
game.updateStatus(moves=game.moves.index+1) # update moves now
game.updateText()
game.canvas.update_idletasks()
game.sleep(0.5)
@ -83,6 +87,7 @@ class Memory_RowStack(OpenStack):
def controlclickHandler(self, event):
return 0
def shiftclickHandler(self, event):
return 0
@ -115,8 +120,9 @@ class Memory24(Game):
# create text
x, y = l.XM, self.ROWS*l.YS
if self.preview <= 1:
self.texts.score = MfxCanvasText(self.canvas, x, y, anchor="sw",
font=self.app.getFont("canvas_large"))
self.texts.score = MfxCanvasText(
self.canvas, x, y, anchor="sw",
font=self.app.getFont("canvas_large"))
x = self.texts.score.bbox()[1][0] + 16
# set window
@ -128,7 +134,7 @@ class Memory24(Game):
for j in range(self.COLUMNS):
x, y = l.XM + w + j*l.XS, l.YM + i*l.YS
s.rows.append(Memory_RowStack(x, y, self,
max_move=0, max_accept=0, max_cards=1))
max_move=0, max_accept=0, max_cards=1))
x, y = l.XM, l.YM
s.talon = InitialDealTalonStack(x, y, self)
l.createText(s.talon, anchor="n", text_format="%D")
@ -280,7 +286,7 @@ class Concentration(Memory24):
for j in range(self.COLUMNS):
x, y = l.XM + j*l.XS, l.YM + i*l.YS
s.rows.append(Concentration_RowStack(x, y, self,
max_move=0, max_accept=0, max_cards=1))
max_move=0, max_accept=0, max_cards=1))
x, y = l.XM + self.COLUMNS*l.XS/2, self.height - l.YS
s.talon = InitialDealTalonStack(x, y, self)
l.createText(s.talon, dx=-10, anchor="sw", text_format="%D")
@ -288,9 +294,10 @@ class Concentration(Memory24):
# create text
x, y = l.XM, self.height - l.YM
if self.preview <= 1:
self.texts.score = MfxCanvasText(self.canvas, x, y,
anchor="sw",
font=self.app.getFont("canvas_large"))
self.texts.score = MfxCanvasText(
self.canvas, x, y,
anchor="sw",
font=self.app.getFont("canvas_large"))
# define stack-groups
l.defaultStackGroups()
@ -306,13 +313,12 @@ class Concentration(Memory24):
# register the game
registerGame(GameInfo(176, Memory24, "Memory 24",
GI.GT_MEMORY | GI.GT_SCORE, 2, 0, GI.SL_SKILL,
suits=(0,2), ranks=(0,8,9,10,11,12)))
suits=(0, 2), ranks=(0, 8, 9, 10, 11, 12)))
registerGame(GameInfo(219, Memory30, "Memory 30",
GI.GT_MEMORY | GI.GT_SCORE, 2, 0, GI.SL_SKILL,
suits=(0,2,3), ranks=(0,9,10,11,12)))
suits=(0, 2, 3), ranks=(0, 9, 10, 11, 12)))
registerGame(GameInfo(177, Memory40, "Memory 40",
GI.GT_MEMORY | GI.GT_SCORE, 2, 0, GI.SL_SKILL,
suits=(0,2), ranks=(0,4,5,6,7,8,9,10,11,12)))
suits=(0, 2), ranks=(0, 4, 5, 6, 7, 8, 9, 10, 11, 12)))
registerGame(GameInfo(178, Concentration, "Concentration",
GI.GT_MEMORY | GI.GT_SCORE, 1, 0, GI.SL_SKILL))

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------##
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
@ -19,25 +19,31 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# ---------------------------------------------------------------------------##
# ---------------------------------------------------------------------------
__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 AbstractHint
from pysollib.util import ANY_SUIT
from pysollib.stack import \
AbstractFoundationStack, \
InitialDealTalonStack, \
InvisibleStack, \
ReserveStack
# ************************************************************************
# *
# ************************************************************************
class Pegged_Hint(AbstractHint):
# FIXME: no intelligence whatsoever is implemented here
def computeHints(self):
@ -80,7 +86,8 @@ class Pegged_RowStack(ReserveStack):
other_stack.fillStack()
def _getMiddleStack(self, from_stack):
dx, dy = from_stack.pos[0] - self.pos[0], from_stack.pos[1] - self.pos[1]
dx, dy = from_stack.pos[0] - self.pos[0], \
from_stack.pos[1] - self.pos[1]
if not self.game.STEP_MAP.get((dx, dy)):
return None
s = self.game.map.get((self.pos[0] + dx/2, self.pos[1] + dy/2))
@ -129,11 +136,14 @@ class Pegged(Game):
x, y = l.XM + d*l.XS/2, l.YM + i*l.YS
stack = Pegged_RowStack(x, y, self)
stack.pos = (d, 2*i)
##print stack.id, stack.pos
# print stack.id, stack.pos
s.rows.append(stack)
self.map[stack.pos] = stack
x, y = self.width - l.XS, l.YM
s.foundations.append(AbstractFoundationStack(x, y, self, ANY_SUIT, max_move=0, max_accept=0, max_cards=self.gameinfo.ncards))
s.foundations.append(
AbstractFoundationStack(
x, y, self, ANY_SUIT, max_move=0, max_accept=0,
max_cards=self.gameinfo.ncards))
l.createText(s.foundations[0], "s")
y = self.height - l.YS
s.talon = InitialDealTalonStack(x, y, self)
@ -149,7 +159,6 @@ class Pegged(Game):
# Define stack groups
l.defaultStackGroups()
#
# game overrides
#
@ -210,13 +219,16 @@ class Pegged(Game):
class PeggedCross1(Pegged):
ROWS = (3, 3, 7, 7, 7, 3, 3)
class PeggedCross2(Pegged):
ROWS = (3, 3, 3, 9, 9, 9, 3, 3, 3)
class Pegged6x6(Pegged):
EMPTY_STACK_ID = 14
ROWS = (6, 6, 6, 6, 6, 6)
class Pegged7x7(Pegged):
ROWS = (7, 7, 7, 7, 7, 7, 7)
@ -230,11 +242,11 @@ class PeggedTriangle1(Pegged):
ROWS = (1, 2, 3, 4, 5)
EMPTY_STACK_ID = 4
class PeggedTriangle2(PeggedTriangle1):
ROWS = (1, 2, 3, 4, 5, 6)
# ************************************************************************
# * register the games
# ************************************************************************
@ -248,11 +260,12 @@ def r(id, gameclass, name):
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
category=GI.GC_TRUMP_ONLY,
suits=(), ranks=(), trumps=range(ncards),
si = {"decks": 1, "ncards": ncards},
rules_filename = "pegged.html")
si={"decks": 1, "ncards": ncards},
rules_filename="pegged.html")
registerGame(gi)
return gi
r(180, Pegged, "Pegged")
r(181, PeggedCross1, "Pegged Cross 1")
r(182, PeggedCross2, "Pegged Cross 2")

View file

@ -24,23 +24,26 @@
__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.pysoltk import MfxCanvasText
from pysollib.stack import \
InitialDealTalonStack, \
InvisibleStack, \
OpenTalonStack, \
ReserveStack, \
StackWrapper
# ************************************************************************
# * Poker Square
# ************************************************************************
class PokerSquare_RowStack(ReserveStack):
def clickHandler(self, event):
if not self.cards:
@ -95,9 +98,10 @@ One Pair'''))
text="100\n75\n50\n25\n20\n15\n10\n5\n2")
self.texts.list.append(t)
x = t.bbox()[1][0] + 16
self.texts.misc = MfxCanvasText(self.canvas, x, y, anchor="nw",
font=self.app.getFont("canvas_default"),
text="0\n"*8+"0")
self.texts.misc = MfxCanvasText(
self.canvas, x, y, anchor="nw",
font=self.app.getFont("canvas_default"),
text="0\n"*8+"0")
x = self.texts.misc.bbox()[1][0] + 32
# set window
@ -127,8 +131,9 @@ One Pair'''))
t = MfxCanvasText(self.canvas, tx, ty, anchor=ta,
font=self.app.getFont("canvas_default"))
self.texts.list.append(t)
self.texts.score = MfxCanvasText(self.canvas, l.XM, 5*l.YS, anchor="sw",
font=self.app.getFont("canvas_large"))
self.texts.score = MfxCanvasText(
self.canvas, l.XM, 5*l.YS, anchor="sw",
font=self.app.getFont("canvas_large"))
# define hands for scoring
r = s.rows
@ -155,7 +160,8 @@ One Pair'''))
self.s.talon.fillStack()
def isGameWon(self):
return len(self.s.talon.cards) == 0 and self.getGameScore() >= self.WIN_SCORE
return len(self.s.talon.cards) == 0 and \
self.getGameScore() >= self.WIN_SCORE
def getAutoStacks(self, event=None):
return ((), (), ())
@ -260,14 +266,15 @@ class PokerShuffle_RowStack(ReserveStack):
class PokerShuffle(PokerSquare):
Talon_Class = InitialDealTalonStack
RowStack_Class = StackWrapper(PokerShuffle_RowStack, max_accept=1, max_cards=2)
RowStack_Class = StackWrapper(
PokerShuffle_RowStack, max_accept=1, max_cards=2)
WIN_SCORE = 200
def createGame(self):
l = PokerSquare.createGame(self)
PokerSquare.createGame(self)
if self.s.talon.texts.ncards:
self.s.talon.texts.ncards.text_format="%D"
self.s.talon.texts.ncards.text_format = "%D"
def startGame(self):
self.moveMove(27, self.s.talon, self.s.internals[0], frames=0)
@ -283,6 +290,6 @@ registerGame(GameInfo(139, PokerSquare, "Poker Square",
GI.GT_POKER_TYPE | GI.GT_SCORE, 1, 0, GI.SL_MOSTLY_SKILL,
si={"ncards": 25}))
registerGame(GameInfo(140, PokerShuffle, "Poker Shuffle",
GI.GT_POKER_TYPE | GI.GT_SCORE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
GI.GT_POKER_TYPE | GI.GT_SCORE | GI.GT_OPEN, 1, 0,
GI.SL_MOSTLY_SKILL,
si={"ncards": 25}))

View file

@ -24,28 +24,38 @@
__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.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.hint import CautiousDefaultHint
from pysollib.pysoltk import MfxCanvasText
from pysollib.games.braid import Braid_Foundation, Braid_BraidStack, \
Braid_RowStack, Braid_ReserveStack, Braid
from pysollib.games.bakersdozen import Cruel_Talon
from pysollib.util import ANY_RANK, NO_RANK, UNLIMITED_ACCEPTS, UNLIMITED_MOVES
from pysollib.stack import \
InitialDealTalonStack, \
OpenStack, \
RK_RowStack, \
ReserveStack, \
SS_FoundationStack, \
StackWrapper, \
WasteStack, \
WasteTalonStack, \
SS_RowStack
# ************************************************************************
# * Tarock Talon Stacks
# ************************************************************************
class Wicked_Talon(Cruel_Talon):
pass
@ -101,7 +111,8 @@ class Skiz_RowStack(RK_RowStack):
return cards[0].rank == len(self.game.gameinfo.trumps) - 1
else:
return cards[0].rank == len(self.game.gameinfo.ranks) - 1
return self.cards[-1].suit == cards[0].suit and self.cards[-1].rank - 1 == cards[0].rank
return self.cards[-1].suit == cards[0].suit and \
self.cards[-1].rank - 1 == cards[0].rank
class Pagat_RowStack(RK_RowStack):
@ -110,7 +121,8 @@ class Pagat_RowStack(RK_RowStack):
return 0
if not self.cards:
return 1
return self.cards[-1].suit == cards[0].suit and self.cards[-1].rank - 1 == cards[0].rank
return self.cards[-1].suit == cards[0].suit and \
self.cards[-1].rank - 1 == cards[0].rank
class TrumpWild_RowStack(Tarock_OpenStack):
@ -232,17 +244,16 @@ class WheelOfFortune(AbstractTarockGame):
def createGame(self):
l, s = Layout(self), self.s
font = self.app.getFont("canvas_default")
# Set window size
self.setSize(l.XM + l.XS * 11.5, l.YM + l.YS * 5.5)
# Create wheel
xoffset = (1, 2, 3, 3.9, 3, 2, 1, 0, -1, -2, -3,
-3.9, -3, -2, -1, 0, -2, -1, 0, 1, 2)
-3.9, -3, -2, -1, 0, -2, -1, 0, 1, 2)
yoffset = (0.2, 0.5, 1.1, 2.2, 3.3, 3.9, 4.2, 4.4,
4.2, 3.9, 3.3, 2.2, 1.1, 0.5, 0.2, 0,
1.8, 2.1, 2.2, 2.4, 2.6)
4.2, 3.9, 3.3, 2.2, 1.1, 0.5, 0.2, 0,
1.8, 2.1, 2.2, 2.4, 2.6)
x = l.XM + l.XS * 4
y = l.YM
for i in range(21):
@ -306,17 +317,16 @@ class ImperialTrumps(AbstractTarockGame):
def createGame(self):
l, s = Layout(self), self.s
font = self.app.getFont("canvas_default")
# Set window size
self.setSize(l.XM + l.XS * 8, l.YM + l.YS * 5)
# Create foundations
x = l.XM + l.XS * 3
y = l.YM
for i in range(4):
s.foundations.append(ImperialTrump_Foundation(x, y, self, i, max_cards=14))
s.foundations.append(
ImperialTrump_Foundation(x, y, self, i, max_cards=14))
x = x + l.XS
s.foundations.append(SS_FoundationStack(x, y, self, 4, max_cards=22))
@ -367,7 +377,6 @@ class Pagat(AbstractTarockGame):
def createGame(self):
l, s = Layout(self), self.s
font = self.app.getFont("canvas_default")
# Set window size
h = max(3 * l.YS, 20 * l.YOFFSET)
@ -424,7 +433,7 @@ class Pagat(AbstractTarockGame):
def shallHighlightMatch(self, stack1, card1, stack2, card2):
return (card1.suit == card2.suit and
(card1.rank + 1 == card2.rank
or card2.rank + 1 == card1.rank))
or card2.rank + 1 == card1.rank))
# ************************************************************************
@ -439,7 +448,6 @@ class Skiz(AbstractTarockGame):
def createGame(self):
l, s = Layout(self), self.s
font = self.app.getFont("canvas_default")
# Set window size
h = max(3 * l.YS, 20 * l.YOFFSET)
@ -496,7 +504,7 @@ class Skiz(AbstractTarockGame):
def shallHighlightMatch(self, stack1, card1, stack2, card2):
return (card1.suit == card2.suit and
(card1.rank + 1 == card2.rank
or card2.rank + 1 == card1.rank))
or card2.rank + 1 == card1.rank))
# ************************************************************************
@ -512,7 +520,6 @@ class FifteenPlus(AbstractTarockGame):
def createGame(self):
l, s = Layout(self), self.s
font = self.app.getFont("canvas_default")
# Set window size
h = max(5 * l.YS, 20 * l.YOFFSET)
@ -524,7 +531,8 @@ class FifteenPlus(AbstractTarockGame):
s.foundations.append(SS_FoundationStack(x, y, self, 4, max_cards=22))
y = y + l.YS
for i in range(4):
s.foundations.append(SS_FoundationStack(x, y, self, i, max_cards=14))
s.foundations.append(
SS_FoundationStack(x, y, self, i, max_cards=14))
y = y + l.YS
# Create rows
@ -532,7 +540,8 @@ class FifteenPlus(AbstractTarockGame):
y = l.YM
for j in range(2):
for i in range(8):
s.rows.append(Tarock_AC_RowStack(x, y, self, max_move=1, max_accept=1))
s.rows.append(
Tarock_AC_RowStack(x, y, self, max_move=1, max_accept=1))
x = x + l.XS
x = l.XM
y = y + l.YS * 3
@ -560,7 +569,7 @@ class FifteenPlus(AbstractTarockGame):
def shallHighlightMatch(self, stack1, card1, stack2, card2):
return (card1.suit == card2.suit and
(card1.rank + 1 == card2.rank
or card2.rank + 1 == card1.rank))
or card2.rank + 1 == card1.rank))
# ************************************************************************
@ -577,7 +586,6 @@ class Excuse(AbstractTarockGame):
def createGame(self):
l, s = Layout(self), self.s
font = self.app.getFont("canvas_default")
# Set window size
h = max(5 * l.YS, 20 * l.YOFFSET)
@ -589,7 +597,8 @@ class Excuse(AbstractTarockGame):
s.foundations.append(SS_FoundationStack(x, y, self, 4, max_cards=22))
y = y + l.YS
for i in range(4):
s.foundations.append(SS_FoundationStack(x, y, self, i, max_cards=14))
s.foundations.append(
SS_FoundationStack(x, y, self, i, max_cards=14))
y = y + l.YS
# Create rows
@ -617,7 +626,8 @@ class Excuse(AbstractTarockGame):
def _shuffleHook(self, cards):
# move Kings to bottom of each stack (see Baker's Dozen)
def isKing(c):
return (c.suit < 4 and c.rank == 13) or (c.suit == 4 and c.rank == 21)
return ((c.suit < 4 and c.rank == 13) or
(c.suit == 4 and c.rank == 21))
i, n = 0, len(self.s.rows)
kings = []
for c in cards:
@ -671,7 +681,8 @@ class Grasshopper(AbstractTarockGame):
# Create talon
x = l.XM
y = l.YM
s.talon = WasteTalonStack(x, y, self, num_deal=1, max_rounds=self.MAX_ROUNDS)
s.talon = WasteTalonStack(
x, y, self, num_deal=1, max_rounds=self.MAX_ROUNDS)
l.createText(s.talon, "s")
x = x + l.XS
s.waste = WasteStack(x, y, self)
@ -681,10 +692,12 @@ class Grasshopper(AbstractTarockGame):
x = x + l.XM + l.XS
for j in range(4):
for i in range(decks):
s.foundations.append(SS_FoundationStack(x, y, self, j, max_cards=14))
s.foundations.append(
SS_FoundationStack(x, y, self, j, max_cards=14))
x = x + l.XS
for i in range(decks):
s.foundations.append(SS_FoundationStack(x, y, self, 4, max_cards=22))
s.foundations.append(
SS_FoundationStack(x, y, self, 4, max_cards=22))
x = x + l.XS
# Create reserve
@ -717,7 +730,7 @@ class Grasshopper(AbstractTarockGame):
for i in range(14 * decks):
self.s.talon.dealRow(rows=self.s.reserves, flip=0, frames=4)
self.s.reserves[0].flipMove()
self.s.talon.dealRow(rows = self.s.rows[decks:])
self.s.talon.dealRow(rows=self.s.rows[decks:])
self.s.talon.dealCards() # deal first card to WasteStack
def fillStack(self, stack):
@ -753,7 +766,8 @@ class Ponytail(Tarock_GameMethods, Braid):
l, s = Layout(self), self.s
# set window
# (piles up to 20 cards are playable - needed for Ponytail_PonytailStack)
# (piles up to 20 cards are playable -
# needed for Ponytail_PonytailStack)
h = max(5*l.YS + l.TEXT_HEIGHT, l.YS+(self.BRAID_CARDS-1)*l.YOFFSET)
self.setSize(10*l.XS+l.XM, l.YM + h)
@ -785,26 +799,33 @@ class Ponytail(Tarock_GameMethods, Braid):
y = l.YM + 2*l.YS
s.talon = WasteTalonStack(x, y, self, max_rounds=3)
l.createText(s.talon, "s")
s.talon.texts.rounds = MfxCanvasText(self.canvas,
x + l.CW / 2, y - l.YM,
anchor="s",
font=self.app.getFont("canvas_default"))
s.talon.texts.rounds = MfxCanvasText(
self.canvas,
x + l.CW / 2, y - l.YM,
anchor="s",
font=self.app.getFont("canvas_default"))
x = x - l.XS
s.waste = WasteStack(x, y, self)
l.createText(s.waste, "s")
x = l.XM + 8 * l.XS
y = l.YM
for i in range(4):
s.foundations.append(Ponytail_Foundation(x, y, self, i, mod=14, max_cards=14))
s.foundations.append(Ponytail_Foundation(x + l.XS, y, self, i, mod=14, max_cards=14))
s.foundations.append(
Ponytail_Foundation(x, y, self, i, mod=14, max_cards=14))
s.foundations.append(
Ponytail_Foundation(
x + l.XS, y, self, i, mod=14, max_cards=14))
y = y + l.YS
s.foundations.append(Ponytail_Foundation(x, y, self, 4, mod=22, max_cards=22))
s.foundations.append(Ponytail_Foundation(x + l.XS, y, self, 4, mod=22, max_cards=22))
s.foundations.append(
Ponytail_Foundation(x, y, self, 4, mod=22, max_cards=22))
s.foundations.append(
Ponytail_Foundation(x + l.XS, y, self, 4, mod=22, max_cards=22))
# ???
self.texts.info = MfxCanvasText(self.canvas,
x + l.CW + l.XM / 2, y + l.YS,
anchor="n",
font=self.app.getFont("canvas_default"))
self.texts.info = MfxCanvasText(
self.canvas,
x + l.CW + l.XM / 2, y + l.YS,
anchor="n",
font=self.app.getFont("canvas_default"))
# define stack-groups
self.sg.openstacks = s.foundations + s.rows
@ -852,7 +873,6 @@ class Cavalier(AbstractTarockGame):
# Define stack groups
l.defaultAll()
#
# Game over rides
#
@ -878,7 +898,8 @@ class Cavalier(AbstractTarockGame):
class FiveAces(Cavalier):
def _shuffleHook(self, cards):
return self._shuffleHookMoveToBottom(cards, lambda c: (c.rank == 0, c.suit))
return self._shuffleHookMoveToBottom(
cards, lambda c: (c.rank == 0, c.suit))
def startGame(self):
Cavalier.startGame(self, foundations=1)
@ -886,7 +907,8 @@ class FiveAces(Cavalier):
class Wicked(FiveAces):
Talon_Class = StackWrapper(Wicked_Talon, max_rounds=-1)
RowStack_Class = StackWrapper(SS_RowStack, max_move=1, max_accept=1, base_rank=NO_RANK)
RowStack_Class = StackWrapper(
SS_RowStack, max_move=1, max_accept=1, base_rank=NO_RANK)
Hint_Class = CautiousDefaultHint
def startGame(self):
@ -899,7 +921,8 @@ class Wicked(FiveAces):
class Nasty(Wicked):
RowStack_Class = StackWrapper(Nasty_RowStack, max_move=1, max_accept=1, base_rank=ANY_RANK)
RowStack_Class = StackWrapper(
Nasty_RowStack, max_move=1, max_accept=1, base_rank=ANY_RANK)
# ************************************************************************
@ -913,6 +936,7 @@ def r(id, gameclass, name, game_type, decks, redeals, skill_level):
registerGame(gi)
return gi
r(157, WheelOfFortune, "Wheel of Fortune", GI.GT_TAROCK, 1, 0, GI.SL_BALANCED)
r(158, ImperialTrumps, "Imperial Trumps", GI.GT_TAROCK, 1, -1, GI.SL_BALANCED)
r(159, Pagat, "Pagat", GI.GT_TAROCK | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL)
@ -920,7 +944,8 @@ r(160, Skiz, "Skiz", GI.GT_TAROCK | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL)
r(161, FifteenPlus, "Fifteen plus", GI.GT_TAROCK, 1, 0, GI.SL_BALANCED)
r(162, Excuse, "Excuse", GI.GT_TAROCK | GI.GT_OPEN, 1, 0, GI.SL_BALANCED)
r(163, Grasshopper, "Grasshopper", GI.GT_TAROCK, 1, 1, GI.SL_MOSTLY_SKILL)
r(164, DoubleGrasshopper, "Double Grasshopper", GI.GT_TAROCK, 2, 1, GI.SL_MOSTLY_SKILL)
r(164, DoubleGrasshopper, "Double Grasshopper", GI.GT_TAROCK, 2, 1,
GI.SL_MOSTLY_SKILL)
r(179, Ponytail, "Ponytail", GI.GT_TAROCK, 2, 2, GI.SL_MOSTLY_SKILL)
r(202, Cavalier, "Cavalier", GI.GT_TAROCK, 1, 0, GI.SL_MOSTLY_SKILL)
r(203, FiveAces, "Five Aces", GI.GT_TAROCK, 1, 0, GI.SL_MOSTLY_SKILL)
@ -928,4 +953,3 @@ r(204, Wicked, "Wicked", GI.GT_TAROCK | GI.GT_OPEN, 1, -1, GI.SL_BALANCED)
r(205, Nasty, "Nasty", GI.GT_TAROCK | GI.GT_OPEN, 1, -1, GI.SL_BALANCED)
del r

View file

@ -17,6 +17,7 @@ my %skip =
./pysollib/games/mahjongg/mahjongg1.py
./pysollib/games/mahjongg/mahjongg2.py
./pysollib/games/mahjongg/mahjongg3.py
./pysollib/games/special/__init__.py
./pysollib/games/ultra/__init__.py
./pysollib/pysoltk.py
./pysollib/tile/ttk.py
@ -25,7 +26,7 @@ my %skip =
# my $cmd = shell_quote( 'flake8', '.' );
my $cmd = shell_quote( 'flake8',
grep { not exists $skip{$_} } glob('./pysollib/*.py ./pysollib/[cmpuw]*/*.py ./pysollib/tile/*.py ./pysollib/ui/tktile/*.py ./pysollib/games/*.py ./pysollib/games/[mu]*/*.py') );
grep { not exists $skip{$_} } glob('./pysollib/*.py ./pysollib/[cmpuw]*/*.py ./pysollib/tile/*.py ./pysollib/ui/tktile/*.py ./pysollib/games/*.py ./pysollib/games/*/*.py') );
# TEST
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );