From de714447b6e5bf35440ea3bf25d4d4627e1f2b4a Mon Sep 17 00:00:00 2001 From: skomoroh Date: Thu, 13 Sep 2007 21:20:38 +0000 Subject: [PATCH] + 3 new games * bugfixes git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@211 efabe8c0-fbe8-4139-b769-b5e6d273206e --- html-src/rules/bigdivorce.html | 2 +- ...radivorce.html => groundsforadivorce.html} | 2 +- pysollib/gamedb.py | 2 +- pysollib/games/mahjongg/shisensho.py | 49 +++++++++++++++---- pysollib/mfxutil.py | 3 +- pysollib/pysolrandom.py | 6 +-- pysollib/settings.py | 4 +- pysollib/wizardutil.py | 4 +- 8 files changed, 49 insertions(+), 23 deletions(-) rename html-src/rules/{groundforadivorce.html => groundsforadivorce.html} (97%) diff --git a/html-src/rules/bigdivorce.html b/html-src/rules/bigdivorce.html index a6ee42b9..398bd416 100644 --- a/html-src/rules/bigdivorce.html +++ b/html-src/rules/bigdivorce.html @@ -8,7 +8,7 @@ Move all cards to the foundations.

Quick Description

-Like Ground for a Divorce, +Like Grounds for a Divorce, but with three decks and 13 playing piles.

Rules

diff --git a/html-src/rules/groundforadivorce.html b/html-src/rules/groundsforadivorce.html similarity index 97% rename from html-src/rules/groundforadivorce.html rename to html-src/rules/groundsforadivorce.html index 45e3f744..a11b1398 100644 --- a/html-src/rules/groundforadivorce.html +++ b/html-src/rules/groundsforadivorce.html @@ -1,4 +1,4 @@ -

Ground for a Divorce

+

Grounds for a Divorce

Spider type. 2 decks. No redeal. diff --git a/pysollib/gamedb.py b/pysollib/gamedb.py index 5e46a579..d2b46c76 100644 --- a/pysollib/gamedb.py +++ b/pysollib/gamedb.py @@ -360,7 +360,7 @@ class GI: ('fc-0.9.3', tuple(range(466, 661))), ('fc-0.9.4', tuple(range(661, 671))), ('fc-1.0', tuple(range(671, 711))), - ('fc-1.1', tuple(range(711, 756))), + ('fc-1.1', tuple(range(711, 759))), ) # deprecated - the correct way is to or a GI.GT_XXX flag diff --git a/pysollib/games/mahjongg/shisensho.py b/pysollib/games/mahjongg/shisensho.py index 57eb180a..0e4f15a5 100644 --- a/pysollib/games/mahjongg/shisensho.py +++ b/pysollib/games/mahjongg/shisensho.py @@ -209,8 +209,6 @@ class Shisen_RowStack(Mahjongg_RowStack): #print res_path return res_path - return a[x2][y2] < 4 - def fillStack(self): self.game.fillStack(self) @@ -353,7 +351,6 @@ class AbstractShisenGame(AbstractMahjonggGame): self.cols[col].append(stack) #from pprint import pprint #pprint(self.cols) - self.cols_len = [rows]*cols # create other stacks y = l.YM + dyy @@ -454,13 +451,41 @@ class Shisen_24x12_NoGravity(AbstractShisenGame): NCARDS = 288 GRAVITY = False + +# /*********************************************************************** +# // Not Shisen-Sho +# ************************************************************************/ + +class NotShisen_RowStack(Shisen_RowStack): + def acceptsCards(self, from_stack, cards): + if not self.game.cardsMatch(self.cards[0], cards[-1]): + return 0 + if self.coln != from_stack.coln and self.rown != from_stack.rown: + return 0 + return [(self.coln+1, self.rown+1), + (from_stack.coln+1, from_stack.rown+1)] + + +class NotShisen_14x6(AbstractShisenGame): + RowStack_Class = NotShisen_RowStack + L = (14, 6) + NCARDS = 84 + +class NotShisen_18x8(AbstractShisenGame): + RowStack_Class = NotShisen_RowStack + L = (18, 8) + +class NotShisen_24x12(AbstractShisenGame): + RowStack_Class = NotShisen_RowStack + L = (24, 12) + NCARDS = 288 + + # /*********************************************************************** # // register a Shisen-Sho type game # ************************************************************************/ -def r(id, gameclass, short_name, name=None, decks=1, ranks=10, trumps=12): - if not name: - name = short_name +def r(id, gameclass, name, rules_filename="shisensho.html"): decks, ranks, trumps = comp_cardset(gameclass.NCARDS) gi = GameInfo(id, gameclass, name, GI.GT_SHISEN_SHO, 4*decks, 0, GI.SL_MOSTLY_SKILL, @@ -468,15 +493,19 @@ def r(id, gameclass, short_name, name=None, decks=1, ranks=10, trumps=12): suits=range(3), ranks=range(ranks), trumps=range(trumps), si={"decks": decks, "ncards": gameclass.NCARDS}) gi.ncards = gameclass.NCARDS - gi.rules_filename = "shisensho.html" + gi.rules_filename = rules_filename registerGame(gi) return gi r(11001, Shisen_14x6, "Shisen-Sho 14x6") r(11002, Shisen_18x8, "Shisen-Sho 18x8") r(11003, Shisen_24x12, "Shisen-Sho 24x12") -r(11004, Shisen_14x6_NoGravity, "Shisen-Sho (No Gra) 14x6") -r(11005, Shisen_18x8_NoGravity, "Shisen-Sho (No Gra) 18x8") -r(11006, Shisen_24x12_NoGravity, "Shisen-Sho (No Gra) 24x12") +r(11004, Shisen_14x6_NoGravity, "Shisen-Sho (No Gravity) 14x6") +r(11005, Shisen_18x8_NoGravity, "Shisen-Sho (No Gravity) 18x8") +r(11006, Shisen_24x12_NoGravity, "Shisen-Sho (No Gravity) 24x12") +r(11011, NotShisen_14x6, "Not Shisen-Sho 14x6", "notshisensho.html") +r(11012, NotShisen_18x8, "Not Shisen-Sho 18x8", "notshisensho.html") +r(11013, NotShisen_24x12, "Not Shisen-Sho 24x12", "notshisensho.html") + del r diff --git a/pysollib/mfxutil.py b/pysollib/mfxutil.py index 85058e92..70bc58cb 100644 --- a/pysollib/mfxutil.py +++ b/pysollib/mfxutil.py @@ -225,8 +225,7 @@ class Struct: self.__dict__[key] = None def copy(self): - c = Struct() - c.__class__ = self.__class__ + c = self.__class__() c.__dict__.update(self.__dict__) return c diff --git a/pysollib/pysolrandom.py b/pysollib/pysolrandom.py index 67d3bc44..b639bfab 100644 --- a/pysollib/pysolrandom.py +++ b/pysollib/pysolrandom.py @@ -73,8 +73,7 @@ class SysRandom(random.Random): self.setstate(self.initial_state) def copy(self): - random = PysolRandom(0L) - random.__class__ = self.__class__ + random = self.__class__(0L) random.__dict__.update(self.__dict__) return random @@ -135,8 +134,7 @@ class MFXRandom: self.seed = state def copy(self): - random = PysolRandom(0L) - random.__class__ = self.__class__ + random = self.__class__(0L) random.__dict__.update(self.__dict__) return random diff --git a/pysollib/settings.py b/pysollib/settings.py index 194cf1ac..7836b229 100644 --- a/pysollib/settings.py +++ b/pysollib/settings.py @@ -28,8 +28,8 @@ PACKAGE = 'PySolFC' TITLE = 'PySol' PACKAGE_URL = 'http://pysolfc.sourceforge.net/' -VERSION = '1.1' -VERSION_TUPLE = (1, 1) +VERSION = '1.1.1' +VERSION_TUPLE = (1, 1, 1) # Tk windowing system (auto set up in init.py) WIN_SYSTEM = 'x11' # win32, x11, aqua, classic diff --git a/pysollib/wizardutil.py b/pysollib/wizardutil.py index 5a5fc404..454a1b27 100644 --- a/pysollib/wizardutil.py +++ b/pysollib/wizardutil.py @@ -38,7 +38,7 @@ class WizSetting: self.values_map = values_map self.default = default ##self.values_dict = dict(self.values_map) - self.translation_map = {} + self.translation_map = {} # for backward translation if widget == 'menu': self.values = [] for k, v in self.values_map: @@ -216,7 +216,7 @@ RowsBaseCard = WizSetting( values_map = ((n_('Ace'), ACE), (n_('King'), KING), (n_('Any'), ANY_RANK), - (n_('None'), NO_RANK), + (n_('None'), NO_RANK), ), default = n_('Any'), label = _('Base card:'),