mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ game "Hanoi Sequence"
git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@268 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
1a761a56cd
commit
7041c3407d
3 changed files with 40 additions and 1 deletions
23
html-src/rules/hanoisequence.html
Normal file
23
html-src/rules/hanoisequence.html
Normal 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.
|
|
@ -138,6 +138,17 @@ class HanoiPuzzle6(HanoiPuzzle4):
|
||||||
pass
|
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
|
# register the game
|
||||||
registerGame(GameInfo(124, TowerOfHanoy, "Tower of Hanoy",
|
registerGame(GameInfo(124, TowerOfHanoy, "Tower of Hanoy",
|
||||||
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
|
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,
|
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
|
||||||
suits=(2,), ranks=range(6),
|
suits=(2,), ranks=range(6),
|
||||||
rules_filename="hanoipuzzle.html"))
|
rules_filename="hanoipuzzle.html"))
|
||||||
|
registerGame(GameInfo(769, HanoiSequence, "Hanoi Sequence",
|
||||||
|
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
|
||||||
|
suits=(2,), ranks=range(9)))
|
||||||
|
|
||||||
|
|
|
@ -203,8 +203,9 @@ class ThreePeaks(Game):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getHandScore(self):
|
def getHandScore(self):
|
||||||
|
# FIXME: bug #2937253
|
||||||
score, i = self.hand_score, 1
|
score, i = self.hand_score, 1
|
||||||
if self.busy:
|
if 0: #self.busy:
|
||||||
return score
|
return score
|
||||||
# First count the empty peaks
|
# First count the empty peaks
|
||||||
for r in self.s.rows[:3]:
|
for r in self.s.rows[:3]:
|
||||||
|
@ -218,6 +219,7 @@ class ThreePeaks(Game):
|
||||||
if self.sequence and len(self.s.waste.cards) - 1:
|
if self.sequence and len(self.s.waste.cards) - 1:
|
||||||
score = score + i * 2 ** int((self.sequence - 1) / 4)
|
score = score + i * 2 ** int((self.sequence - 1) / 4)
|
||||||
self.hand_score = score
|
self.hand_score = score
|
||||||
|
#print 'getHandScore: score:', score
|
||||||
return score
|
return score
|
||||||
|
|
||||||
def canUndo(self):
|
def canUndo(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue