1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00
This commit is contained in:
Shlomi Fish 2017-04-17 23:33:30 +03:00
parent e76ddb8a13
commit 6bac87f644
3 changed files with 43 additions and 20 deletions

View file

@ -24,25 +24,35 @@
__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.hint import CautiousDefaultHint
from pysollib.hint import KlondikeType_Hint
from spider import Spider_RowStack, Spider_SS_Foundation, Spider_Hint
from pysollib.util import ACE, KING
from pysollib.stack import \
AC_RowStack, \
BO_RowStack, \
KingAC_RowStack, \
SS_FoundationStack, \
Spider_SS_RowStack, \
StackWrapper, \
WasteStack, \
WasteTalonStack, \
SS_RowStack
# ************************************************************************
# * Double Klondike (Klondike with 2 decks and 9 rows)
# ************************************************************************
class DoubleKlondike(Game):
Layout_Method = Layout.harpLayout
Foundation_Class = SS_FoundationStack
@ -60,7 +70,8 @@ class DoubleKlondike(Game):
max_rounds=max_rounds, num_deal=num_deal)
s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self)
for r in l.s.foundations:
s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=r.suit))
s.foundations.append(
self.Foundation_Class(r.x, r.y, self, suit=r.suit))
for r in l.s.rows:
s.rows.append(self.RowStack_Class(r.x, r.y, self))
# default
@ -101,8 +112,10 @@ class Gargantua(DoubleKlondike):
def createGame(self):
DoubleKlondike.createGame(self, max_rounds=2)
class Pantagruel(DoubleKlondike):
RowStack_Class = AC_RowStack
def createGame(self):
DoubleKlondike.createGame(self, max_rounds=1)
@ -110,6 +123,7 @@ class Pantagruel(DoubleKlondike):
# * Harp (Double Klondike with 10 non-king rows and no redeal)
# ************************************************************************
class BigHarp(DoubleKlondike):
RowStack_Class = AC_RowStack
@ -159,6 +173,7 @@ class TripleKlondikeByThrees(DoubleKlondike):
class ChineseKlondike(DoubleKlondike):
RowStack_Class = StackWrapper(BO_RowStack, base_rank=KING)
def createGame(self):
DoubleKlondike.createGame(self, rows=12)
@ -174,6 +189,7 @@ class LadyJane(DoubleKlondike):
def createGame(self):
DoubleKlondike.createGame(self, rows=10, max_rounds=2, num_deal=3)
def startGame(self):
DoubleKlondike.startGame(self, flip=1)
@ -186,6 +202,7 @@ class Inquisitor(DoubleKlondike):
def createGame(self):
DoubleKlondike.createGame(self, rows=10, max_rounds=3, num_deal=3)
def startGame(self):
DoubleKlondike.startGame(self, flip=1)
shallHighlightMatch = Game._shallHighlightMatch_SS
@ -201,6 +218,7 @@ class Arabella(DoubleKlondike):
def createGame(self):
DoubleKlondike.createGame(self, rows=13, max_rounds=1, playcards=24)
def startGame(self):
DoubleKlondike.startGame(self, flip=1)
@ -225,7 +243,8 @@ class BigDeal(DoubleKlondike):
for i in range(2):
y = l.YM
for j in range(8):
s.foundations.append(SS_FoundationStack(x, y, self, suit=j%4))
s.foundations.append(
SS_FoundationStack(x, y, self, suit=j % 4))
y += l.YS
x += l.XS
x, y = l.XM, self.height-l.YS
@ -289,7 +308,7 @@ class ThievesOfEgypt(DoubleKlondike):
def startGame(self):
# rows: 1 3 5 7 9 10 8 6 4 2
row = 0
for i in (0,2,4,6,8,9,7,5,3,1):
for i in (0, 2, 4, 6, 8, 9, 7, 5, 3, 1):
for j in range(i):
self.s.talon.dealRow(rows=[self.s.rows[row]], frames=0)
row += 1
@ -322,7 +341,6 @@ class Brush(DoubleKlondike):
getQuickPlayScore = Game._getSpiderQuickPlayScore
# register the game
registerGame(GameInfo(21, DoubleKlondike, "Double Klondike",
GI.GT_KLONDIKE, 2, -1, GI.SL_BALANCED))
@ -347,10 +365,11 @@ registerGame(GameInfo(497, Arabella, "Arabella",
registerGame(GameInfo(545, BigDeal, "Big Deal",
GI.GT_KLONDIKE | GI.GT_ORIGINAL, 4, 1, GI.SL_BALANCED))
registerGame(GameInfo(562, Delivery, "Delivery",
GI.GT_FORTY_THIEVES | GI.GT_ORIGINAL, 4, 0, GI.SL_BALANCED))
GI.GT_FORTY_THIEVES | GI.GT_ORIGINAL, 4, 0,
GI.SL_BALANCED))
registerGame(GameInfo(590, ChineseKlondike, "Chinese Klondike",
GI.GT_KLONDIKE, 3, -1, GI.SL_BALANCED,
suits=(0, 1, 2) ))
suits=(0, 1, 2)))
registerGame(GameInfo(591, Pantagruel, "Pantagruel",
GI.GT_KLONDIKE, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(668, DoubleKingsley, "Double Kingsley",
@ -358,5 +377,5 @@ registerGame(GameInfo(668, DoubleKingsley, "Double Kingsley",
registerGame(GameInfo(678, ThievesOfEgypt, "Thieves of Egypt",
GI.GT_KLONDIKE, 2, 1, GI.SL_BALANCED))
registerGame(GameInfo(689, Brush, "Brush",
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))

View file

@ -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.hint import CautiousDefaultHint
from pysollib.util import KING
from pysollib.stack import \
AC_RowStack, \
InitialDealTalonStack, \
OpenStack, \
SS_FoundationStack, \
SS_RowStack
# ************************************************************************
# * Heads and Tails
# ************************************************************************
class HeadsAndTails_Reserve(OpenStack):
def canFlipCard(self):
return False
@ -109,7 +114,7 @@ class HeadsAndTails(Game):
def fillStack(self, stack):
if stack in self.s.rows and not stack.cards:
reserves = self.s.reserves
si = list(self.s.rows).index(stack)%8
si = list(self.s.rows).index(stack) % 8
from_stack = None
if reserves[si].cards:
from_stack = reserves[si]
@ -209,4 +214,3 @@ registerGame(GameInfo(307, HeadsAndTails, "Heads and Tails",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(708, Barrier, "Barrier",
GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0, GI.SL_BALANCED))

View file

@ -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-gy-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-hy-z]*.py') );
# TEST
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );