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

+ 2 new games

* fixed MANIFEST.in: added AUTHORS, setup_osx.py


git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@214 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2007-10-08 21:20:23 +00:00
parent cc05937c71
commit b4b338706e
4 changed files with 136 additions and 2 deletions

View file

@ -3,7 +3,8 @@
##
## code
##
include pysol.py setup.py setup.cfg MANIFEST.in Makefile COPYING README
include pysol.py setup.py setup_osx.py setup.cfg MANIFEST.in Makefile
include COPYING README AUTHORS
#recursive-include pysollib *.py
include pysollib/*.py pysollib/macosx/*.py pysollib/configobj/*.py
include pysollib/winsystems/*.py

View file

@ -866,11 +866,13 @@ class RightAndLeft(Game):
x, y = l.XM+l.XS, l.YM+2*l.YS
s.talon = RightAndLeft_Talon(x, y, self, max_rounds=UNLIMITED_REDEALS)
l.createText(s.talon, 'se')
x, y = l.XM+0.5*l.XS, l.YM
for i in range(2):
stack = Nestor_RowStack(x, y, self, max_move=1, max_accept=1,
dir=0, base_rank=NO_RANK)
stack.CARD_YOFFSET = 0
l.createText(stack, 's')
s.rows.append(stack)
x += l.XS
@ -878,7 +880,7 @@ class RightAndLeft(Game):
s.foundations.append(AbstractFoundationStack(x, y, self, suit=ANY_SUIT,
max_move=0, max_cards=104,
max_accept=0, base_rank=ANY_RANK))
l.createText(s.foundations[0], 'nw')
l.createText(s.foundations[0], 's')
# define stack-groups
l.defaultStackGroups()

View file

@ -926,6 +926,55 @@ class Amphibian(Game):
self.leaveState(old_state)
# /***********************************************************************
# // Aglet
# ************************************************************************/
class Aglet(Game):
def createGame(self, playcards=20, rows=8, reserves=1):
decks = self.gameinfo.decks
l, s = Layout(self), self.s
self.setSize(l.XM+(reserves+0.5+rows)*l.XS,
l.YM+max(2*l.YS+7*l.YOFFSET, l.YS+playcards*l.YOFFSET))
x, y = self.width-l.XS, self.height-l.YS
s.talon = InitialDealTalonStack(x, y, self)
x, y = l.XM, l.YM
for i in range(reserves):
stack = ReserveStack(x, y, self, max_cards=UNLIMITED_CARDS)
stack.CARD_YOFFSET = l.YOFFSET
s.reserves.append(stack)
x += l.XS
x, y = l.XM + (reserves+0.5+(rows-decks*4)/2.0)*l.XS, l.YM
for i in range(4):
s.foundations.append(RK_FoundationStack(x, y, self, suit=ANY_SUIT))
x += l.XS
x, y = l.XM+(reserves+0.5)*l.XS, l.YM+l.YS
for i in range(rows):
s.rows.append(BasicRowStack(x, y, self, base_rank=NO_RANK))
x += l.XS
l.defaultStackGroups()
def _shuffleHook(self, cards):
# move Aces to top of the Talon (i.e. first cards to be dealt)
return self._shuffleHookMoveToTop(cards,
lambda c: (c.rank == ACE, c.suit))
def startGame(self):
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
for i in range(4):
self.s.talon.dealRow(frames=0)
self.startDealSample()
self.s.talon.dealRowAvail()
self.s.talon.dealRowAvail()
# register the game
registerGame(GameInfo(257, Numerica, "Numerica",
@ -970,4 +1019,6 @@ registerGame(GameInfo(644, DoubleMeasure, "Double Measure",
GI.GT_NUMERICA | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(754, Amphibian, "Amphibian",
GI.GT_NUMERICA | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(760, Aglet, "Aglet",
GI.GT_1DECK_TYPE | GI.GT_ORIGINAL, 1, 0, GI.SL_MOSTLY_SKILL))

View file

@ -1263,6 +1263,84 @@ class DesertIsland(Game):
return True
# /***********************************************************************
# // Catherine the Great
# ************************************************************************/
class CatherineTheGreat(Game):
Hint_Class = CautiousDefaultHint
def createGame(self, reserves=6):
l, s = Layout(self), self.s
w, h = 3*l.XM+5*l.XS, l.YM+5*l.YS
self.setSize(w, h)
lay = ((0,2,0,QUEEN,-1),
(0,1,0,QUEEN,-1),
(0,0,1,QUEEN,-1),
(2,0,1,QUEEN,-1),
(1,0,2,QUEEN,-1),
(2,1,3,QUEEN,-1),
(2,2,3,QUEEN,-1),
(1,1,2,KING,1),
)
for xx, yy, suit, base_rank, dir in lay:
x, y = 2*l.XM+l.XS+xx*l.XS, l.YM+yy*l.YS
stack = SS_FoundationStack(x, y, self, suit=suit,
max_move=0, base_rank=base_rank,
dir=dir, mod=13)
s.foundations.append(stack)
for x, y in ((l.XM, l.YM),
(3*l.XM+4*l.XS, l.YM)):
for i in range(5):
stack = RK_RowStack(x, y, self, dir=1,
base_rank=NO_RANK,
max_move=1, mod=13)
stack.CARD_YOFFSET = 0
s.rows.append(stack)
y += l.YS
x, y = 2*l.XM+1.5*l.XS, l.YM+4*l.YS
s.talon = WasteTalonStack(x, y, self, max_rounds=1)
l.createText(s.talon, 'n')
x += l.XS
s.waste = WasteStack(x, y, self)
l.createText(s.waste, 'n')
l.defaultStackGroups()
def _shuffleHook(self, cards):
def select_func(card):
if card.rank == KING and card.suit == 2 and card.deck == 0:
return (True, 999)
if card.rank == QUEEN:
if card.suit == 2 and card.deck == 0:
return (False, 0)
return (True, card.suit)
return (False, 0)
cards = self._shuffleHookMoveToTop(cards, select_func)
return cards
def startGame(self):
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
self.startDealSample()
self.s.talon.dealRow()
self.s.talon.dealCards() # deal first card to WasteStack
def fillStack(self, stack):
if stack in self.s.rows and not stack.cards:
old_state = self.enterState(self.S_FILL)
if not self.s.waste.cards:
self.s.talon.dealCards()
if self.s.waste.cards:
self.s.waste.moveMove(1, stack)
self.leaveState(old_state)
shallHighlightMatch = Game._shallHighlightMatch_RKW
# register the game
registerGame(GameInfo(330, Sultan, "Sultan",
@ -1317,3 +1395,5 @@ registerGame(GameInfo(744, Voracious, "Voracious",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(745, DesertIsland, "Desert Island",
GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(761, CatherineTheGreat, "Catherine the Great",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))