mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ 1 new game
+ new option: `Enable shuffle' git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@200 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
7096a96d59
commit
3319f877a1
6 changed files with 91 additions and 7 deletions
|
@ -198,7 +198,8 @@ class PysolMenubarActions:
|
||||||
if game.gameinfo.si.game_type == GI.GT_CUSTOM:
|
if game.gameinfo.si.game_type == GI.GT_CUSTOM:
|
||||||
ms.custom_game = 1
|
ms.custom_game = 1
|
||||||
if game.canShuffle():
|
if game.canShuffle():
|
||||||
ms.shuffle = 1
|
if opt.shuffle:
|
||||||
|
ms.shuffle = 1
|
||||||
|
|
||||||
# update menu items and toolbar
|
# update menu items and toolbar
|
||||||
def _updateMenus(self):
|
def _updateMenus(self):
|
||||||
|
@ -492,8 +493,9 @@ class PysolMenubarActions:
|
||||||
|
|
||||||
def mShuffle(self, *args):
|
def mShuffle(self, *args):
|
||||||
if self._cancelDrag(): return
|
if self._cancelDrag(): return
|
||||||
if self.game.canShuffle():
|
if self.menustate.shuffle:
|
||||||
self.game._mahjonggShuffle()
|
if self.game.canShuffle():
|
||||||
|
self.game._mahjonggShuffle()
|
||||||
|
|
||||||
def mStatus(self, *args):
|
def mStatus(self, *args):
|
||||||
if self._cancelDrag(break_pause=False): return
|
if self._cancelDrag(break_pause=False): return
|
||||||
|
|
|
@ -133,11 +133,11 @@ class Strata(Game):
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
s.foundations.append(DieRussische_Foundation(x, y, self,
|
s.foundations.append(DieRussische_Foundation(x, y, self,
|
||||||
suit=i%4, max_cards=8))
|
suit=i%4, max_cards=8))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
x, y, = l.XM+l.XS, l.YM+l.YS
|
x, y, = l.XM+l.XS, l.YM+l.YS
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
s.rows.append(AC_RowStack(x, y, self, max_move=1, max_accept=1))
|
s.rows.append(AC_RowStack(x, y, self, max_move=1, max_accept=1))
|
||||||
x = x + l.XS
|
x += l.XS
|
||||||
s.talon = RedealTalonStack(l.XM, l.YM+l.YS/2, self, max_rounds=3)
|
s.talon = RedealTalonStack(l.XM, l.YM+l.YS/2, self, max_rounds=3)
|
||||||
l.createRoundText(s.talon, 'nn')
|
l.createRoundText(s.talon, 'nn')
|
||||||
|
|
||||||
|
@ -177,6 +177,67 @@ class Fifteen(Capricieuse):
|
||||||
return cards
|
return cards
|
||||||
|
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // Choice
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
class Choice_Foundation(RK_FoundationStack):
|
||||||
|
def acceptsCards(self, from_stack, cards):
|
||||||
|
if not RK_FoundationStack.acceptsCards(self, from_stack, cards):
|
||||||
|
return False
|
||||||
|
# check the suit
|
||||||
|
num_cards = len(self.cards)
|
||||||
|
for f in self.game.s.foundations:
|
||||||
|
if len(f.cards) > num_cards:
|
||||||
|
suit = f.cards[num_cards].suit
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
return cards[0].suit == suit
|
||||||
|
|
||||||
|
|
||||||
|
class Choice(Game):
|
||||||
|
|
||||||
|
def createGame(self, rows=8, playcards=16):
|
||||||
|
# create layout
|
||||||
|
l, s = Layout(self), self.s
|
||||||
|
|
||||||
|
# set window
|
||||||
|
decks = self.gameinfo.decks
|
||||||
|
max_rows = max(8, rows)
|
||||||
|
self.setSize(l.XM + max_rows*l.XS,
|
||||||
|
l.YM + 2*l.YS + (playcards+4*decks)*l.YOFFSET)
|
||||||
|
|
||||||
|
# create stacks
|
||||||
|
x, y = l.XM + (max_rows-8)*l.XS/2, l.YM
|
||||||
|
for i in range(8):
|
||||||
|
stack = Choice_Foundation(x, y, self, base_rank=(i+5), dir=0,
|
||||||
|
suit=ANY_SUIT, max_cards=(4*decks) )
|
||||||
|
stack.CARD_YOFFSET = l.YOFFSET
|
||||||
|
s.foundations.append(stack)
|
||||||
|
x += l.XS
|
||||||
|
|
||||||
|
x, y = l.XM + (max_rows-rows)*l.XS/2, l.YM + l.YS + (4*decks)*l.YOFFSET
|
||||||
|
for i in range(rows):
|
||||||
|
s.rows.append(AC_RowStack(x, y, self))
|
||||||
|
x += l.XS
|
||||||
|
|
||||||
|
x, y = self.width - l.XS, self.height - l.YS
|
||||||
|
s.talon = InitialDealTalonStack(x, y, self)
|
||||||
|
|
||||||
|
# define stack-groups
|
||||||
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
|
||||||
|
def startGame(self):
|
||||||
|
for i in range(11):
|
||||||
|
self.s.talon.dealRowAvail(frames=0)
|
||||||
|
self.startDealSample()
|
||||||
|
self.s.talon.dealRowAvail()
|
||||||
|
|
||||||
|
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# register the game
|
# register the game
|
||||||
registerGame(GameInfo(292, Capricieuse, "Capricieuse",
|
registerGame(GameInfo(292, Capricieuse, "Capricieuse",
|
||||||
|
@ -190,4 +251,7 @@ registerGame(GameInfo(606, Strata, "Strata",
|
||||||
altnames=('Persian Patience',) ))
|
altnames=('Persian Patience',) ))
|
||||||
registerGame(GameInfo(673, Fifteen, "Fifteen",
|
registerGame(GameInfo(673, Fifteen, "Fifteen",
|
||||||
GI.GT_BAKERS_DOZEN | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_BAKERS_DOZEN | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||||
|
registerGame(GameInfo(755, Choice, "Choice",
|
||||||
|
GI.GT_3DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 3, 0, GI.SL_MOSTLY_SKILL,
|
||||||
|
ranks=(5, 6, 7, 8, 9, 10, 11, 12) ))
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ autofaceup = boolean
|
||||||
autodrop = boolean
|
autodrop = boolean
|
||||||
autodeal = boolean
|
autodeal = boolean
|
||||||
quickplay = boolean
|
quickplay = boolean
|
||||||
|
shuffle = boolean
|
||||||
undo = boolean
|
undo = boolean
|
||||||
bookmarks = boolean
|
bookmarks = boolean
|
||||||
hint = boolean
|
hint = boolean
|
||||||
|
@ -174,6 +175,7 @@ class Options:
|
||||||
('autodrop', 'bool'),
|
('autodrop', 'bool'),
|
||||||
('autodeal', 'bool'),
|
('autodeal', 'bool'),
|
||||||
('quickplay', 'bool'),
|
('quickplay', 'bool'),
|
||||||
|
('shuffle', 'bool'),
|
||||||
('undo', 'bool'),
|
('undo', 'bool'),
|
||||||
('bookmarks', 'bool'),
|
('bookmarks', 'bool'),
|
||||||
('hint', 'bool'),
|
('hint', 'bool'),
|
||||||
|
@ -243,6 +245,7 @@ class Options:
|
||||||
self.autodrop = False
|
self.autodrop = False
|
||||||
self.autodeal = True
|
self.autodeal = True
|
||||||
self.quickplay = True
|
self.quickplay = True
|
||||||
|
self.shuffle = True
|
||||||
self.undo = True
|
self.undo = True
|
||||||
self.bookmarks = True
|
self.bookmarks = True
|
||||||
self.hint = True
|
self.hint = True
|
||||||
|
|
|
@ -217,6 +217,7 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
undo = Tkinter.BooleanVar(),
|
undo = Tkinter.BooleanVar(),
|
||||||
bookmarks = Tkinter.BooleanVar(),
|
bookmarks = Tkinter.BooleanVar(),
|
||||||
hint = Tkinter.BooleanVar(),
|
hint = Tkinter.BooleanVar(),
|
||||||
|
shuffle = Tkinter.BooleanVar(),
|
||||||
highlight_piles = Tkinter.BooleanVar(),
|
highlight_piles = Tkinter.BooleanVar(),
|
||||||
highlight_cards = Tkinter.BooleanVar(),
|
highlight_cards = Tkinter.BooleanVar(),
|
||||||
highlight_samerank = Tkinter.BooleanVar(),
|
highlight_samerank = Tkinter.BooleanVar(),
|
||||||
|
@ -263,6 +264,7 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
tkopt.quickplay.set(opt.quickplay)
|
tkopt.quickplay.set(opt.quickplay)
|
||||||
tkopt.undo.set(opt.undo)
|
tkopt.undo.set(opt.undo)
|
||||||
tkopt.hint.set(opt.hint)
|
tkopt.hint.set(opt.hint)
|
||||||
|
tkopt.shuffle.set(opt.shuffle)
|
||||||
tkopt.bookmarks.set(opt.bookmarks)
|
tkopt.bookmarks.set(opt.bookmarks)
|
||||||
tkopt.highlight_piles.set(opt.highlight_piles)
|
tkopt.highlight_piles.set(opt.highlight_piles)
|
||||||
tkopt.highlight_cards.set(opt.highlight_cards)
|
tkopt.highlight_cards.set(opt.highlight_cards)
|
||||||
|
@ -446,6 +448,7 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
submenu.add_checkbutton(label=n_("Enable &undo"), variable=self.tkopt.undo, command=self.mOptEnableUndo)
|
submenu.add_checkbutton(label=n_("Enable &undo"), variable=self.tkopt.undo, command=self.mOptEnableUndo)
|
||||||
submenu.add_checkbutton(label=n_("Enable &bookmarks"), variable=self.tkopt.bookmarks, command=self.mOptEnableBookmarks)
|
submenu.add_checkbutton(label=n_("Enable &bookmarks"), variable=self.tkopt.bookmarks, command=self.mOptEnableBookmarks)
|
||||||
submenu.add_checkbutton(label=n_("Enable &hint"), variable=self.tkopt.hint, command=self.mOptEnableHint)
|
submenu.add_checkbutton(label=n_("Enable &hint"), variable=self.tkopt.hint, command=self.mOptEnableHint)
|
||||||
|
submenu.add_checkbutton(label=n_("Enable shu&ffle"), variable=self.tkopt.shuffle, command=self.mOptEnableShuffle)
|
||||||
submenu.add_checkbutton(label=n_("Enable highlight p&iles"), variable=self.tkopt.highlight_piles, command=self.mOptEnableHighlightPiles)
|
submenu.add_checkbutton(label=n_("Enable highlight p&iles"), variable=self.tkopt.highlight_piles, command=self.mOptEnableHighlightPiles)
|
||||||
submenu.add_checkbutton(label=n_("Enable highlight &cards"), variable=self.tkopt.highlight_cards, command=self.mOptEnableHighlightCards)
|
submenu.add_checkbutton(label=n_("Enable highlight &cards"), variable=self.tkopt.highlight_cards, command=self.mOptEnableHighlightCards)
|
||||||
submenu.add_checkbutton(label=n_("Enable highlight same &rank"), variable=self.tkopt.highlight_samerank, command=self.mOptEnableHighlightSameRank)
|
submenu.add_checkbutton(label=n_("Enable highlight same &rank"), variable=self.tkopt.highlight_samerank, command=self.mOptEnableHighlightSameRank)
|
||||||
|
@ -1076,6 +1079,11 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
self.app.opt.hint = self.tkopt.hint.get()
|
self.app.opt.hint = self.tkopt.hint.get()
|
||||||
self.game.updateMenus()
|
self.game.updateMenus()
|
||||||
|
|
||||||
|
def mOptEnableShuffle(self, *args):
|
||||||
|
if self._cancelDrag(break_pause=False): return
|
||||||
|
self.app.opt.shuffle = self.tkopt.shuffle.get()
|
||||||
|
self.game.updateMenus()
|
||||||
|
|
||||||
def mOptEnableHighlightPiles(self, *args):
|
def mOptEnableHighlightPiles(self, *args):
|
||||||
if self._cancelDrag(break_pause=False): return
|
if self._cancelDrag(break_pause=False): return
|
||||||
self.app.opt.highlight_piles = self.tkopt.highlight_piles.get()
|
self.app.opt.highlight_piles = self.tkopt.highlight_piles.get()
|
||||||
|
|
|
@ -216,6 +216,7 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
undo = Tkinter.BooleanVar(),
|
undo = Tkinter.BooleanVar(),
|
||||||
bookmarks = Tkinter.BooleanVar(),
|
bookmarks = Tkinter.BooleanVar(),
|
||||||
hint = Tkinter.BooleanVar(),
|
hint = Tkinter.BooleanVar(),
|
||||||
|
shuffle = Tkinter.BooleanVar(),
|
||||||
highlight_piles = Tkinter.BooleanVar(),
|
highlight_piles = Tkinter.BooleanVar(),
|
||||||
highlight_cards = Tkinter.BooleanVar(),
|
highlight_cards = Tkinter.BooleanVar(),
|
||||||
highlight_samerank = Tkinter.BooleanVar(),
|
highlight_samerank = Tkinter.BooleanVar(),
|
||||||
|
@ -261,6 +262,7 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
tkopt.quickplay.set(opt.quickplay)
|
tkopt.quickplay.set(opt.quickplay)
|
||||||
tkopt.undo.set(opt.undo)
|
tkopt.undo.set(opt.undo)
|
||||||
tkopt.hint.set(opt.hint)
|
tkopt.hint.set(opt.hint)
|
||||||
|
tkopt.shuffle.set(opt.shuffle)
|
||||||
tkopt.bookmarks.set(opt.bookmarks)
|
tkopt.bookmarks.set(opt.bookmarks)
|
||||||
tkopt.highlight_piles.set(opt.highlight_piles)
|
tkopt.highlight_piles.set(opt.highlight_piles)
|
||||||
tkopt.highlight_cards.set(opt.highlight_cards)
|
tkopt.highlight_cards.set(opt.highlight_cards)
|
||||||
|
@ -451,6 +453,7 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
submenu.add_checkbutton(label=n_("Enable &undo"), variable=self.tkopt.undo, command=self.mOptEnableUndo)
|
submenu.add_checkbutton(label=n_("Enable &undo"), variable=self.tkopt.undo, command=self.mOptEnableUndo)
|
||||||
submenu.add_checkbutton(label=n_("Enable &bookmarks"), variable=self.tkopt.bookmarks, command=self.mOptEnableBookmarks)
|
submenu.add_checkbutton(label=n_("Enable &bookmarks"), variable=self.tkopt.bookmarks, command=self.mOptEnableBookmarks)
|
||||||
submenu.add_checkbutton(label=n_("Enable &hint"), variable=self.tkopt.hint, command=self.mOptEnableHint)
|
submenu.add_checkbutton(label=n_("Enable &hint"), variable=self.tkopt.hint, command=self.mOptEnableHint)
|
||||||
|
submenu.add_checkbutton(label=n_("Enable shu&ffle"), variable=self.tkopt.shuffle, command=self.mOptEnableShuffle)
|
||||||
submenu.add_checkbutton(label=n_("Enable highlight p&iles"), variable=self.tkopt.highlight_piles, command=self.mOptEnableHighlightPiles)
|
submenu.add_checkbutton(label=n_("Enable highlight p&iles"), variable=self.tkopt.highlight_piles, command=self.mOptEnableHighlightPiles)
|
||||||
submenu.add_checkbutton(label=n_("Enable highlight &cards"), variable=self.tkopt.highlight_cards, command=self.mOptEnableHighlightCards)
|
submenu.add_checkbutton(label=n_("Enable highlight &cards"), variable=self.tkopt.highlight_cards, command=self.mOptEnableHighlightCards)
|
||||||
submenu.add_checkbutton(label=n_("Enable highlight same &rank"), variable=self.tkopt.highlight_samerank, command=self.mOptEnableHighlightSameRank)
|
submenu.add_checkbutton(label=n_("Enable highlight same &rank"), variable=self.tkopt.highlight_samerank, command=self.mOptEnableHighlightSameRank)
|
||||||
|
@ -1077,6 +1080,11 @@ class PysolMenubar(PysolMenubarActions):
|
||||||
self.app.opt.hint = self.tkopt.hint.get()
|
self.app.opt.hint = self.tkopt.hint.get()
|
||||||
self.game.updateMenus()
|
self.game.updateMenus()
|
||||||
|
|
||||||
|
def mOptEnableShuffle(self, *args):
|
||||||
|
if self._cancelDrag(break_pause=False): return
|
||||||
|
self.app.opt.shuffle = self.tkopt.shuffle.get()
|
||||||
|
self.game.updateMenus()
|
||||||
|
|
||||||
def mOptEnableHighlightPiles(self, *args):
|
def mOptEnableHighlightPiles(self, *args):
|
||||||
if self._cancelDrag(break_pause=False): return
|
if self._cancelDrag(break_pause=False): return
|
||||||
self.app.opt.highlight_piles = self.tkopt.highlight_piles.get()
|
self.app.opt.highlight_piles = self.tkopt.highlight_piles.get()
|
||||||
|
|
|
@ -674,8 +674,7 @@ class StackDesc:
|
||||||
text = stack.getHelp()+'\n'+stack.getBaseCard()
|
text = stack.getHelp()+'\n'+stack.getBaseCard()
|
||||||
text = text.strip()
|
text = text.strip()
|
||||||
if text:
|
if text:
|
||||||
frame = Tkinter.Frame(self.canvas, highlightthickness=1,
|
frame = Tkinter.Frame(self.canvas)
|
||||||
highlightbackground='black')
|
|
||||||
self.frame = frame
|
self.frame = frame
|
||||||
label = Tkinter.Message(frame, font=font, text=text,
|
label = Tkinter.Message(frame, font=font, text=text,
|
||||||
width=cardw-8, relief='solid',
|
width=cardw-8, relief='solid',
|
||||||
|
|
Loading…
Add table
Reference in a new issue