diff --git a/html-src/wikipedia/osmosis_w.html b/html-src/wikipedia/treasuretrove.html similarity index 69% rename from html-src/wikipedia/osmosis_w.html rename to html-src/wikipedia/treasuretrove.html index 5211afb3..d14c1349 100644 --- a/html-src/wikipedia/osmosis_w.html +++ b/html-src/wikipedia/treasuretrove.html @@ -1,9 +1,9 @@

Osmosis

From Wikipedia, the free encyclopedia

-Osmosis is a solitaire game played with a deck of 52 playing cards where the -object, like many solitaire games, is to put the cards into foundations, -although not in numberical order. +Osmosis (also known as Treasure Trove) is a solitaire game played with a deck +of 52 playing cards where the object, like many solitaire games, is to put the +cards into foundations, although not in numerical order.

Game play consists of a tableau with four piles of four cards each (one face-up card on top of three face-down cards). A seventeenth card is put in @@ -22,24 +22,27 @@ possible moves from the stock or from the tableau to the foundations.

Here's an example (foundations only):

-hearts:    7 8 10 2 4 9 K A
-spades:    7 A 8 K 9
-diamonds:  7 8 K
+ 7 8 10 2 4 9 K A
+ 7 A 8 K 9
+ 7 8 K
 

Suppose that from the example above, any heart card can be moved to the top -foundation. One can also place 10 of spades into its foundation, but one -cannot put 2 of diamonds yet into its foundation because 2 of spades hasn't -turned up yet in its foundation. No club cannot be placed at this time as the -7 of clubs hasn't appeared. +foundation. One can also place 10 into its +foundation, but one cannot put 2 yet into its +foundation because 2 hasn't turned up yet in its +foundation. No club cannot be placed at this time as the 7 hasn't appeared.

The game is won when all cards have been moved to the foundations. But winning any game can rely on where certain cards are placed in the either one of the piles in the tableau or in the stock pile. Because of this, finishing a game of Osmosis is slim if not rare. + +

Peek

Peek is another solitaire card game using a deck of 52 playing cards. It is -played exactly as Osmosis except all the cards on the this game's tableau are +played exactly as Osmosis except all the cards on this game's tableau are face-up.

(Retrieved from http://en.wikipedia.org/wiki/Osmosis_(solitaire)) diff --git a/pysollib/games/klondike.py b/pysollib/games/klondike.py index 4d96ac4f..f1790b9e 100644 --- a/pysollib/games/klondike.py +++ b/pysollib/games/klondike.py @@ -1364,7 +1364,7 @@ registerGame(GameInfo(18, KlondikeByThrees, "Klondike by Threes", registerGame(GameInfo(58, ThumbAndPouch, "Thumb and Pouch", GI.GT_KLONDIKE, 1, 0, GI.SL_MOSTLY_LUCK)) registerGame(GameInfo(67, Whitehead, "Whitehead", - GI.GT_KLONDIKE, 1, 0, GI.SL_MOSTLY_LUCK)) + GI.GT_KLONDIKE, 1, 0, GI.SL_MOSTLY_SKILL)) registerGame(GameInfo(39, SmallHarp, "Small Harp", GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED, altnames=("Die kleine Harfe",) )) diff --git a/pysollib/games/osmosis.py b/pysollib/games/osmosis.py index f30b928b..5ce8f96a 100644 --- a/pysollib/games/osmosis.py +++ b/pysollib/games/osmosis.py @@ -63,8 +63,12 @@ class Osmosis_Foundation(AbstractFoundationStack): # return 1 + def getHelp(self): + return _('Build in suit regardless of rank.') + class Osmosis(Game): + Foundation_Class = Osmosis_Foundation # # game layout @@ -87,12 +91,14 @@ class Osmosis(Game): y = y + l.YS x, y, = 2*l.XM+l.XS+4*l.XOFFSET, l.YM for i in range(4): - stack = Osmosis_Foundation(x, y, self, i, base_rank=ANY_RANK, max_move=0) + stack = self.Foundation_Class(x, y, self, suit=i, + base_rank=ANY_RANK, max_move=0) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 s.foundations.append(stack) y = y + l.YS x, y, = self.width - l.XS, l.YM + l.YS - s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds, num_deal=num_deal) + s.talon = WasteTalonStack(x, y, self, + max_rounds=max_rounds, num_deal=num_deal) l.createText(s.talon, "sw") y = y + l.YS s.waste = WasteStack(x, y, self) @@ -128,6 +134,63 @@ class Peek(Osmosis): def startGame(self): Osmosis.startGame(self, flip=1) + +# /*********************************************************************** +# // Treasure Trove +# // Peek II +# ************************************************************************/ + +class OsmosisII_Foundation(AbstractFoundationStack): + def acceptsCards(self, from_stack, cards): + if not AbstractFoundationStack.acceptsCards(self, from_stack, cards): + return False + assert len(cards) == 1 + indx = list(self.game.s.foundations).index(self) + c0 = cards[0] + below_found = self.game.s.foundations[indx-1] + if indx == 0: + if not self.cards: + return True + return c0.suit == self.cards[0].suit + if not below_found.cards: + return False + if not self.cards: + return c0.rank == below_found.cards[0].rank + if c0.suit != self.cards[0].suit: + return False + for c1 in below_found.cards: + if c0.rank == c1.rank: + return True + return False + + def getHelp(self): + return _('Build in suit regardless of rank.') + + +class OsmosisII(Osmosis): + 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) + + def startGame(self, flip=0): + self.startDealSample() + # deal cards + for i in range(3): + self.s.talon.dealRow(flip=flip) + self.s.talon.dealRow() + # deal one card to foundation + self.s.talon.dealRow(rows=self.s.foundations[:1]) + # deal cards to WasteStack + self.s.talon.dealCards() + + +class PeekII(OsmosisII): + def startGame(self): + OsmosisII.startGame(self, flip=1) + + # /*********************************************************************** # // Open Peek # ************************************************************************/ @@ -283,12 +346,9 @@ class Bridesmaids(Game): - - # register the game registerGame(GameInfo(59, Osmosis, "Osmosis", - GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK, - altnames=("Treasure Trove",) )) + 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", @@ -299,4 +359,9 @@ registerGame(GameInfo(371, GenesisPlus, "Genesis +", 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", + GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK)) +registerGame(GameInfo(716, PeekII, "Peek II", + GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK, + rules_filename='treasuretrove.html')) diff --git a/pysollib/tile/menubar.py b/pysollib/tile/menubar.py index 67c785f9..78f0541d 100644 --- a/pysollib/tile/menubar.py +++ b/pysollib/tile/menubar.py @@ -416,7 +416,7 @@ class PysolMenubar(PysolMenubarActions): menu.add_command(label=n_("&Statistics..."), command=self.mPlayerStats) menu.add_command(label=n_("Log..."), command=lambda self=self: self.mPlayerStats(mode=103)) menu.add_separator() - menu.add_command(label=n_("D&emo statistics"), command=lambda self=self: self.mPlayerStats(mode=1102)) + menu.add_command(label=n_("D&emo statistics"), command=lambda self=self: self.mPlayerStats(mode=1101)) menu = MfxMenu(self.__menubar, label=n_("&Assist")) menu.add_command(label=n_("&Hint"), command=self.mHint, accelerator="H")