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

+ 5 new games

git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@103 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2006-12-04 22:16:00 +00:00
parent be93eb00c0
commit 99296b9ad8
8 changed files with 221 additions and 5 deletions

View file

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PySol 0.0.1\n"
"POT-Creation-Date: Thu Nov 30 16:31:56 2006\n"
"PO-Revision-Date: 2006-11-30 16:06+0300\n"
"PO-Revision-Date: 2006-12-04 16:26+0300\n"
"Last-Translator: Скоморох <skomoroh@gmail.com>\n"
"Language-Team: Russian <ru@li.org>\n"
"MIME-Version: 1.0\n"
@ -3735,7 +3735,7 @@ msgid "Wheel of Fortune"
msgstr "Колесо фортуны"
msgid "Whitehead"
msgstr ""
msgstr "Уайтхэд"
#, fuzzy
msgid "Whitehorse"

View file

@ -495,8 +495,9 @@ class GameManager:
(gi.id, str(gi.gameclass),
str(self.__all_games[gi.id].gameclass))
if self.__all_gamenames.has_key(gi.name):
gameclass = self.__all_gamenames[gi.name].gameclass
raise GameInfoException, "duplicate game name %s: %s and %s" % \
(gi.id, gi.name, str(self.__all_games[gi.id].gameclass))
(gi.name, str(gi.gameclass), str(gameclass))
if 1:
for id, game in self.__all_games.items():
if gi.gameclass is game.gameclass:

View file

@ -539,6 +539,63 @@ class DoubleAcquaintance(AuldLangSyne):
AuldLangSyne.createGame(self, rows=8, texts=True)
# /***********************************************************************
# // Formic
# ************************************************************************/
class Formic_Foundation(AbstractFoundationStack):
def acceptsCards(self, from_stack, cards):
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
return 0
# check the rank
return ((self.cards[-1].rank+1) % 13 == cards[0].rank or
(self.cards[-1].rank-1) % 13 == cards[0].rank)
def getHelp(self):
return _('Foundation. Build up or down regardless of suit.')
class Formic(TamOShanter):
def createGame(self):
l, s = Layout(self), self.s
self.setSize(l.XM+6*l.XS, l.YM+2*l.YS+12*l.YOFFSET)
x, y, = l.XM, l.YM
s.talon = self.Talon_Class(x, y, self)
l.createText(s.talon, "s")
x, y = l.XM+2*l.XS, l.YM
for i in range(4):
s.foundations.append(Formic_Foundation(x, y, self,
suit=ANY_SUIT, base_rank=ANY_RANK,
max_cards=52, max_move=0))
x += l.XS
x, y = l.XM+2*l.XS, l.YM+l.YS
for i in range(4):
s.rows.append(BasicRowStack(x, y, self, max_move=1, max_accept=0))
x += l.XS
l.defaultStackGroups()
def _shuffleHook(self, cards):
suits = []
top_cards = []
for c in cards[:]:
if c.suit not in suits:
suits.append(c.suit)
top_cards.append(c)
cards.remove(c)
if len(suits) == 4:
break
top_cards.sort(lambda a, b: cmp(b.suit, a.suit)) # sort by suit
return cards+top_cards
def startGame(self):
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
self.startDealSample()
self.s.talon.dealRow()
# register the game
registerGame(GameInfo(172, TamOShanter, "Tam O'Shanter",
@ -565,4 +622,6 @@ registerGame(GameInfo(569, Primrose, "Primrose",
GI.GT_NUMERICA, 2, 8, GI.SL_BALANCED))
registerGame(GameInfo(636, StrategyPlus, "Strategy +",
GI.GT_NUMERICA, 1, 0, GI.SL_SKILL))
registerGame(GameInfo(688, Formic, "Formic",
GI.GT_NUMERICA, 1, 0, GI.SL_MOSTLY_SKILL))

View file

@ -240,6 +240,41 @@ class Mancunian(Realm):
shallHighlightMatch = Game._shallHighlightMatch_RK
# /***********************************************************************
# // Hospital Patience
# ************************************************************************/
class HospitalPatience(Game):
def createGame(self):
l, s = Layout(self), self.s
self.setSize(l.XM+6*l.XS, l.YM+2*l.YS)
x, y = l.XM, l.YM
s.talon = WasteTalonStack(x, y, self,
max_rounds=UNLIMITED_REDEALS, num_deal=3)
l.createText(s.talon, 'ne')
y += l.YS
s.waste = WasteStack(x, y, self)
l.createText(s.waste, 'ne')
x = l.XM+2*l.XS
for i in range(4):
y = l.YM
s.foundations.append(SS_FoundationStack(x, y, self, i, max_move=0))
y += l.YS
s.foundations.append(SS_FoundationStack(x, y, self, i,
base_rank=KING, max_move=0, dir=-1))
x += l.XS
l.defaultStackGroups()
def startGame(self, flip=0, reverse=1):
self.startDealSample()
self.s.talon.dealCards() # deal first card to WasteStack
# register the game
registerGame(GameInfo(290, Bisley, "Bisley",
GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
@ -251,4 +286,6 @@ registerGame(GameInfo(374, Realm, "Realm",
GI.GT_1DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(375, Mancunian, "Mancunian",
GI.GT_1DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(686, HospitalPatience, "Hospital Patience",
GI.GT_1DECK_TYPE, 1, -1, GI.SL_MOSTLY_LUCK))

View file

@ -411,6 +411,42 @@ class SweetSixteen(TrustyTwelve):
shallHighlightMatch = Game._shallHighlightMatch_AC
# /***********************************************************************
# // Glacier
# ************************************************************************/
class Glacier(Game):
def createGame(self, rows=12):
l, s = Layout(self), self.s
self.setSize(l.XM+rows*l.XS, l.YM+2*l.YS+l.TEXT_HEIGHT+20*l.YOFFSET)
x, y = l.XM+(rows-4)/2*l.XS, l.YM
for i in range(4):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
mod=13, max_cards=26))
x += l.XS
x, y = l.XM, l.YM+l.YS+l.TEXT_HEIGHT
for i in range(rows):
s.rows.append(RK_RowStack(x, y, self, mod=13))
x += l.XS
x, y = l.XM, l.YM
s.talon = WasteTalonStack(x, y, self, num_deal=2, max_rounds=1)
l.createText(s.talon, 's')
x = x + l.XS
s.waste = WasteStack(x, y, self, max_cards=2)
s.waste.CARD_XOFFSET = l.XOFFSET
l.defaultStackGroups()
def startGame(self):
self.startDealSample()
self.s.talon.dealRow()
self.s.talon.dealCards() # deal first card to WasteStack
shallHighlightMatch = Game._shallHighlightMatch_RKW
# register the game
registerGame(GameInfo(294, CurdsAndWhey, "Curds and Whey",
@ -439,5 +475,7 @@ registerGame(GameInfo(482, SweetSixteen, "Sweet Sixteen",
GI.GT_1DECK_TYPE, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(534, Harvestman, "Harvestman",
GI.GT_SPIDER | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(687, Glacier, "Glacier",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))

View file

@ -46,7 +46,7 @@ from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint
from pysollib.hint import KlondikeType_Hint
from pysollib.pysoltk import MfxCanvasText
from spider import Spider_Hint
from spider import Spider_RowStack, Spider_SS_Foundation, Spider_Hint
# /***********************************************************************
@ -313,6 +313,31 @@ class ThievesOfEgypt(DoubleKlondike):
self.s.talon.dealCards() # deal first card to WasteStack
# /***********************************************************************
# // Brush
# ************************************************************************/
class Brush(DoubleKlondike):
Layout_Method = Layout.klondikeLayout
Foundation_Class = Spider_SS_Foundation
RowStack_Class = Spider_SS_RowStack
Hint_Class = Spider_Hint
def createGame(self):
DoubleKlondike.createGame(self, rows=10, max_rounds=1)
def startGame(self):
for i in range(3):
self.s.talon.dealRow(frames=0)
self.startDealSample()
self.s.talon.dealRow()
self.s.talon.dealCards() # deal first card to WasteStack
shallHighlightMatch = Game._shallHighlightMatch_RK
getQuickPlayScore = Game._getSpiderQuickPlayScore
# register the game
registerGame(GameInfo(21, DoubleKlondike, "Double Klondike",
GI.GT_KLONDIKE, 2, -1, GI.SL_BALANCED))
@ -348,4 +373,6 @@ registerGame(GameInfo(668, DoubleKingsley, "Double Kingsley",
GI.GT_KLONDIKE, 2, 0, GI.SL_BALANCED))
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))

View file

@ -629,7 +629,7 @@ class Jane(Klondike):
s.talon = self.Talon_Class(x, y, self, max_rounds=max_rounds)
l.createText(s.talon, 's')
x += l.XS
s.waste = WasteStack(l.XM+l.XS, l.YM, self)
s.waste = WasteStack(x, y, self)
x += 2*l.XS
for i in range(4):

View file

@ -1143,6 +1143,58 @@ class Tarantula(Spider):
return 0
# /***********************************************************************
# // Fechter's Game
# ************************************************************************/
class FechtersGame_Talon(TalonStack):
def dealCards(self, sound=1):
if self.cards:
rows = []
for r in self.game.s.rows:
king_seq = False
for i in range(len(r.cards)):
if isAlternateColorSequence(r.cards[-i-1:]):
if r.cards[-i-1].rank == KING:
king_seq = True
break
else:
break
if not king_seq:
rows.append(r)
return self.dealRowAvail(rows=rows, sound=sound)
return 0
class FechtersGame_RowStack(AC_RowStack):
def canDropCards(self, stacks):
if len(self.cards) < 13:
return (None, 0)
cards = self.cards[-13:]
for s in stacks:
if s is not self and s.acceptsCards(self, cards):
return (s, 13)
return (None, 0)
class FechtersGame(RelaxedSpider):
Talon_Class = FechtersGame_Talon
Foundation_Class = StackWrapper(Spider_AC_Foundation, base_rank=KING, mod=13)
RowStack_Class = StackWrapper(FechtersGame_RowStack, base_rank=KING)
def createGame(self):
RelaxedSpider.createGame(self, rows=12)
def startGame(self):
self.s.talon.dealRow(flip=0, frames=0)
self.s.talon.dealRow(flip=1, frames=0)
self.s.talon.dealRow(flip=0, frames=0)
self.startDealSample()
self.s.talon.dealRow()
shallHighlightMatch = Game._shallHighlightMatch_AC
# register the game
registerGame(GameInfo(10, RelaxedSpider, "Relaxed Spider",
GI.GT_SPIDER | GI.GT_RELAXED, 2, 0, GI.SL_MOSTLY_SKILL))
@ -1260,4 +1312,6 @@ registerGame(GameInfo(672, ScorpionII, "Scorpion II",
GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(680, Tarantula, "Tarantula",
GI.GT_SPIDER, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(685, FechtersGame, "Fechter's Game",
GI.GT_SPIDER, 2, 0, GI.SL_MOSTLY_SKILL))