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

+ 1 new game

* new category in gamedb: `GAMES_BY_INVENTORS'


git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@183 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2007-07-04 21:34:05 +00:00
parent 0f198dec99
commit cf787d633e
5 changed files with 85 additions and 11 deletions

View file

@ -274,6 +274,26 @@ class GI:
)), )),
) )
GAMES_BY_INVENTORS = (
("Paul Alfille", (8,)),
("C.L. Baker", (45,)),
("David Bernazzani", (314,)),
("Art Cabral", (9,)),
("Charles Jewell", (220, 309,)),
("Robert Harbin", (381,)),
("Michael Keller", (592,)),
("Fred Lunde", (459,)),
("Albert Morehead and Geoffrey Mott-Smith", (25, 42, 48, 173,
303, 547, 738)),
("David Parlett", (64, 98, 294, 338, 654, 674,)),
("Capt. Jeffrey T. Spaulding", (400,)),
("John Stoneham", (201,)),
("Bryan Stout", (655,)),
("Bill Taylor", (349,)),
("Thomas Warfield", (189, 264, 300, 320, 336, 337, 359,
415, 427, 458, 495, 496, 497, 508,)),
)
GAMES_BY_PYSOL_VERSION = ( GAMES_BY_PYSOL_VERSION = (
("1.00", (1, 2, 3, 4)), ("1.00", (1, 2, 3, 4)),
("1.01", (5, 6)), ("1.01", (5, 6)),

View file

@ -32,7 +32,6 @@
__all__ = [] __all__ = []
# imports # imports
import sys
# PySol imports # PySol imports
from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.gamedb import registerGame, GameInfo, GI
@ -50,7 +49,7 @@ from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint
class UnionSquare_Foundation(AbstractFoundationStack): class UnionSquare_Foundation(AbstractFoundationStack):
def acceptsCards(self, from_stack, cards): def acceptsCards(self, from_stack, cards):
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards): if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
return 0 return False
# check the rank # check the rank
if len(self.cards) > 12: if len(self.cards) > 12:
return cards[0].rank == 25 - len(self.cards) return cards[0].rank == 25 - len(self.cards)
@ -89,6 +88,7 @@ class UnionSquare_RowStack(OpenStack):
class UnionSquare(Game): class UnionSquare(Game):
Hint_Class = CautiousDefaultHint Hint_Class = CautiousDefaultHint
Foundation_Class = StackWrapper(UnionSquare_Foundation, max_cards=26)
RowStack_Class = UnionSquare_RowStack RowStack_Class = UnionSquare_RowStack
# #
@ -119,8 +119,8 @@ class UnionSquare(Game):
y = y + l.YS y = y + l.YS
x, y = self.width-l.XS, l.YM x, y = self.width-l.XS, l.YM
for i in range(4): for i in range(4):
stack = UnionSquare_Foundation(x, y, self, i, max_move=0, stack = self.Foundation_Class(x, y, self, suit=i,
dir=0, max_cards=26) max_move=0, dir=0)
l.createText(stack, "sw") l.createText(stack, "sw")
s.foundations.append(stack) s.foundations.append(stack)
y = y + l.YS y = y + l.YS
@ -174,6 +174,41 @@ class SolidSquare(UnionSquare):
shallHighlightMatch = Game._shallHighlightMatch_SSW shallHighlightMatch = Game._shallHighlightMatch_SSW
# /***********************************************************************
# // Boomerang
# ************************************************************************/
class Boomerang_Foundation(AbstractFoundationStack):
def acceptsCards(self, from_stack, cards):
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
return False
# check the rank
# 7, 8, 9, 10, J, Q, K, A, K, Q, J, 10, 9, 8, 7, A
if len(self.cards) < 7:
return cards[0].rank - 6 == len(self.cards)
elif len(self.cards) == 7:
return cards[0].rank == ACE
elif len(self.cards) < 15:
return cards[0].rank == 20 - len(self.cards)
else: # len(self.cards) == 15
return cards[0].rank == ACE
class Boomerang(UnionSquare):
Foundation_Class = StackWrapper(Boomerang_Foundation,
base_rank=6, max_cards=16)
def createGame(self):
UnionSquare.createGame(self, rows=12)
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)
# register the game # register the game
registerGame(GameInfo(35, UnionSquare, "Union Square", registerGame(GameInfo(35, UnionSquare, "Union Square",
@ -182,3 +217,7 @@ registerGame(GameInfo(35, UnionSquare, "Union Square",
)) ))
registerGame(GameInfo(439, SolidSquare, "Solid Square", registerGame(GameInfo(439, SolidSquare, "Solid Square",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED)) GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(738, Boomerang, "Boomerang",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED,
ranks=(0, 6, 7, 8, 9, 10, 11, 12),
))

View file

@ -77,7 +77,7 @@ statusbar = boolean
statusbar_game_number = boolean statusbar_game_number = boolean
num_cards = boolean num_cards = boolean
helpbar = boolean helpbar = boolean
num_recent_games = integer num_recent_games = integer(10, 100)
last_gameid = integer last_gameid = integer
game_holded = integer game_holded = integer
wm_maximized = boolean wm_maximized = boolean
@ -90,7 +90,7 @@ save_cardsets = boolean
dragcursor = boolean dragcursor = boolean
save_games_geometry = boolean save_games_geometry = boolean
sound = boolean sound = boolean
sound_mode = integer sound_mode = integer(0, 1)
sound_sample_volume = integer(0, 128) sound_sample_volume = integer(0, 128)
sound_music_volume = integer(0, 128) sound_music_volume = integer(0, 128)
tabletile_name = string tabletile_name = string

View file

@ -158,6 +158,15 @@ class SelectGameData(SelectDialogTreeData):
if 1 and gg: if 1 and gg:
s_by_pysol_version = SelectGameNode(None, _("by PySol version"), s_by_pysol_version = SelectGameNode(None, _("by PySol version"),
tuple(gg)) tuple(gg))
s_by_inventors, gg = None, []
for name, games in GI.GAMES_BY_INVENTORS:
select_func = lambda gi, games=games: gi.id in games
if name is None or not filter(select_func, self.all_games_gi):
continue
gg.append(SelectGameNode(None, name, select_func))
if 1 and gg:
s_by_inventors = SelectGameNode(None, _("by Inventors"),
tuple(gg))
# #
ul_alternate_names = UserList(list(app.gdb.getGamesTuplesSortedByAlternateName())) ul_alternate_names = UserList(list(app.gdb.getGamesTuplesSortedByAlternateName()))
# #
@ -232,6 +241,7 @@ class SelectGameData(SelectDialogTreeData):
s_by_compatibility, s_by_compatibility,
)), )),
s_by_pysol_version, s_by_pysol_version,
s_by_inventors,
SelectGameNode(None, _("Other Categories"), ( SelectGameNode(None, _("Other Categories"), (
SelectGameNode(None, _("Games for Children (very easy)"), SelectGameNode(None, _("Games for Children (very easy)"),
lambda gi: gi.si.game_flags & GI.GT_CHILDREN), lambda gi: gi.si.game_flags & GI.GT_CHILDREN),
@ -255,7 +265,6 @@ class SelectGameData(SelectDialogTreeData):
class SelectGameTreeWithPreview(SelectDialogTreeCanvas): class SelectGameTreeWithPreview(SelectDialogTreeCanvas):
data = None data = None
html_viewer = None
class SelectGameTree(SelectGameTreeWithPreview): class SelectGameTree(SelectGameTreeWithPreview):
@ -422,7 +431,6 @@ class SelectGameDialogWithPreview(SelectGameDialog):
self.preview_app = None self.preview_app = None
self.updatePreview(gameid, animations=0) self.updatePreview(gameid, animations=0)
##focus = self.tree.frame ##focus = self.tree.frame
SelectGameTreeWithPreview.html_viewer = None
self.mainloop(focus, kw.timeout) self.mainloop(focus, kw.timeout)
def initKw(self, kw): def initKw(self, kw):

View file

@ -159,7 +159,15 @@ class SelectGameData(SelectDialogTreeData):
if 1 and gg: if 1 and gg:
s_by_pysol_version = SelectGameNode(None, _("by PySol version"), s_by_pysol_version = SelectGameNode(None, _("by PySol version"),
tuple(gg)) tuple(gg))
pass s_by_inventors, gg = None, []
for name, games in GI.GAMES_BY_INVENTORS:
select_func = lambda gi, games=games: gi.id in games
if name is None or not filter(select_func, self.all_games_gi):
continue
gg.append(SelectGameNode(None, name, select_func))
if 1 and gg:
s_by_inventors = SelectGameNode(None, _("by Inventors"),
tuple(gg))
# #
ul_alternate_names = UserList(list(app.gdb.getGamesTuplesSortedByAlternateName())) ul_alternate_names = UserList(list(app.gdb.getGamesTuplesSortedByAlternateName()))
# #
@ -234,6 +242,7 @@ class SelectGameData(SelectDialogTreeData):
s_by_compatibility, s_by_compatibility,
)), )),
s_by_pysol_version, s_by_pysol_version,
s_by_inventors,
SelectGameNode(None, _("Other Categories"), ( SelectGameNode(None, _("Other Categories"), (
SelectGameNode(None, _("Games for Children (very easy)"), SelectGameNode(None, _("Games for Children (very easy)"),
lambda gi: gi.si.game_flags & GI.GT_CHILDREN), lambda gi: gi.si.game_flags & GI.GT_CHILDREN),
@ -257,7 +266,6 @@ class SelectGameData(SelectDialogTreeData):
class SelectGameTreeWithPreview(SelectDialogTreeCanvas): class SelectGameTreeWithPreview(SelectDialogTreeCanvas):
data = None data = None
html_viewer = None
class SelectGameTree(SelectGameTreeWithPreview): class SelectGameTree(SelectGameTreeWithPreview):
@ -425,7 +433,6 @@ class SelectGameDialogWithPreview(SelectGameDialog):
self.preview_app = None self.preview_app = None
self.updatePreview(gameid, animations=0) self.updatePreview(gameid, animations=0)
##focus = self.tree.frame ##focus = self.tree.frame
SelectGameTreeWithPreview.html_viewer = None
self.mainloop(focus, kw.timeout) self.mainloop(focus, kw.timeout)
def initKw(self, kw): def initKw(self, kw):