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

+ 2 games

git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@149 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2007-03-10 22:51:56 +00:00
parent 85c0b50f5c
commit 4533357d05
4 changed files with 87 additions and 19 deletions

View file

@ -1,9 +1,9 @@
<h1>Osmosis</h1>
<h3>From Wikipedia, the free encyclopedia</h3>
<p>
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.
<p>
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.
<p>
Here's an example (foundations only):
<pre>
hearts: 7 8 10 2 4 9 K A
spades: 7 A 8 K 9
diamonds: 7 8 K
<img src="../images/h.gif"> 7 8 10 2 4 9 K A
<img src="../images/s.gif"> 7 A 8 K 9
<img src="../images/d.gif"> 7 8 K
</pre>
<p>
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<img src="../images/s.gif"> into its
foundation, but one cannot put 2<img src="../images/d.gif"> yet into its
foundation because 2<img src="../images/s.gif"> hasn't turned up yet in its
foundation. No club cannot be placed at this time as the 7<img
src="../images/c.gif"> hasn't appeared.
<p>
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.
<h3>Peek</h3>
<p>
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.
<p>
<i>(Retrieved from <a href="http://en.wikipedia.org/wiki/Osmosis_%28solitaire%29">http://en.wikipedia.org/wiki/Osmosis_(solitaire)</a>)</i>

View file

@ -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",) ))

View file

@ -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'))

View file

@ -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")