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

+ game "Hanoi Sequence"

git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@268 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2011-03-06 07:55:32 +00:00
parent 23490fe487
commit 4f66f1bff4
3 changed files with 40 additions and 1 deletions

View file

@ -0,0 +1,23 @@
<h1>Hanoi Sequence</h1>
<p>
Puzzle game type. 9 cards. No redeal.
<h3>Object</h3>
<p>
Build a pile containing all 9 cards down by sequence.
<h3>Quick Description</h3>
<p>
Like <a href="klondike.html">Tower of Hanoy</a>,
but build a pile down <b>by sequence</b>.
<h3>Rules</h3>
<p>
A card may only be placed onto another card that is of higher rank.
<p>
Only the top card may be moved, and spaces may be filled
with any single card.
<h3>Notes</h3>
<p>
<i>Autodrop</i> is disabled for this game.

View file

@ -138,6 +138,17 @@ class HanoiPuzzle6(HanoiPuzzle4):
pass
# ************************************************************************
# * Hanoi Sequence
# ************************************************************************
class HanoiSequence(TowerOfHanoy):
def isGameWon(self):
for s in self.s.rows:
if len(s.cards) == len(self.cards) and isRankSequence(s.cards):
return 1
return 0
# register the game
registerGame(GameInfo(124, TowerOfHanoy, "Tower of Hanoy",
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
@ -154,4 +165,7 @@ registerGame(GameInfo(209, HanoiPuzzle6, "Hanoi Puzzle 6",
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
suits=(2,), ranks=range(6),
rules_filename="hanoipuzzle.html"))
registerGame(GameInfo(769, HanoiSequence, "Hanoi Sequence",
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
suits=(2,), ranks=range(9)))

View file

@ -203,8 +203,9 @@ class ThreePeaks(Game):
return False
def getHandScore(self):
# FIXME: bug #2937253
score, i = self.hand_score, 1
if self.busy:
if 0: #self.busy:
return score
# First count the empty peaks
for r in self.s.rows[:3]:
@ -218,6 +219,7 @@ class ThreePeaks(Game):
if self.sequence and len(self.s.waste.cards) - 1:
score = score + i * 2 ** int((self.sequence - 1) / 4)
self.hand_score = score
#print 'getHandScore: score:', score
return score
def canUndo(self):