forked from shlomif/PySolFC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
daddylonglegs.py
57 lines (45 loc) · 1.59 KB
/
daddylonglegs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# vim:ts=4:et:nowrap:fileencoding=utf-8
#
from pysollib.game import Game
from pysollib.gamedb import GI, GameInfo, registerGame
from pysollib.layout import Layout
from pysollib.stack import \
DealRowTalonStack, \
StackWrapper, \
Yukon_SS_RowStack, \
isSameSuitSequence
from pysollib.util import ACE
# ***********************************************************************
# 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"))