From 8160ee11864377e25a64d336616f2ee7d5c96e06 Mon Sep 17 00:00:00 2001 From: Jim Sizelove Date: Thu, 17 Nov 2011 21:38:31 -0500 Subject: [PATCH] added new game, Daddy Longlegs --- html-src/rules/daddylonglegs.html | 14 ++++++++ pysollib/games/__init__.py | 1 + pysollib/games/daddylonglegs.py | 57 +++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 html-src/rules/daddylonglegs.html create mode 100644 pysollib/games/daddylonglegs.py diff --git a/html-src/rules/daddylonglegs.html b/html-src/rules/daddylonglegs.html new file mode 100644 index 00000000..5a39b6a9 --- /dev/null +++ b/html-src/rules/daddylonglegs.html @@ -0,0 +1,14 @@ +

Daddy Longlegs

+

Spider type. 1 deck. No redeal.

+

Object

+

Group all the cards into four sets of 13 cards by suit in ascending sequence from Ace to King.

+

Rules

+

Cards are dealt four at a time, one card into each of four piles. A card can be moved onto the end of another pile, if it is the same suit and follows in sequence. The rest of the pile moves with the card. Only an Ace (with the rest of its pile) can move to an empty space.

+

At any time, you can deal more cards by clicking on the talon. One card will be added to each of the playing piles.

+

History

+

I created Daddy Longlegs in the early 1980's to amuse myself with a different solitaire variant. Over the years, I have implemented this game many times under the name of "Deal Four" as an exercise when learning new programming languages.

+

I learned of pysol in 2006 and almost immediately realized that it is a perfect platform for Daddy Longlegs. Thank you, Markus Oberhumer!

+

Author

+

Jim Sizelove

+

sizelji@comcast.net

+

March 8, 2007

diff --git a/pysollib/games/__init__.py b/pysollib/games/__init__.py index ce23f9fe..2c9a629c 100644 --- a/pysollib/games/__init__.py +++ b/pysollib/games/__init__.py @@ -35,6 +35,7 @@ import camelot import canfield import capricieuse import curdsandwhey +import daddylonglegs import dieboesesieben import diplomat import doublets diff --git a/pysollib/games/daddylonglegs.py b/pysollib/games/daddylonglegs.py new file mode 100644 index 00000000..00bdf45b --- /dev/null +++ b/pysollib/games/daddylonglegs.py @@ -0,0 +1,57 @@ +## vim:ts=4:et:nowrap:fileencoding=utf-8 +## + +# imports +import sys + +# PySol imports +from pysollib.gamedb import registerGame, GameInfo, GI +from pysollib.util import * +from pysollib.stack import * +from pysollib.game import Game +from pysollib.layout import Layout + + +#*********************************************************************** +# Daddy Longlegs (by Jim Sizelove) +#*********************************************************************** + +class DaddyLonglegs(Game): + Talon_Class = DealRowTalonStack + RowStack_Class = StackWrapper(Yukon_SS_RowStack, dir=1, base_rank=ACE) + + def createGame(self, **layout): + # create layout + l, s = Layout(self), self.s + + # set window + self.setSize(l.XM + 6*l.XS, l.YM + 7*l.YS) + + # create stacks + x, y, = l.XM, l.YM + s.talon = self.Talon_Class(x, y, self) + l.createText(s.talon, "ss") + x = x + 3*l.XS/2 + for i in range(4): + s.rows.append(self.RowStack_Class(x, y, self)) + x = x + l.XS + + # define stack-groups + l.defaultStackGroups() + + def startGame(self): + self.s.talon.dealRow() + + def isGameWon(self): + if self.s.talon.cards: + return 0 + for row in self.s.rows: + if not isSameSuitSequence(row.cards, dir=1): + return 0 + return 1 + + +# register the game +registerGame(GameInfo(555001, DaddyLonglegs, "Daddy Longlegs", + GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL, + rules_filename="daddylonglegs.html"))