mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Fixed Napoleon's Tomb game.
This commit is contained in:
parent
862c955c2c
commit
1144360d27
3 changed files with 54 additions and 13 deletions
23
html-src/rules/napoleonstomb.html
Normal file
23
html-src/rules/napoleonstomb.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<h1>Napoleon's Tomb</h1>
|
||||
<p>
|
||||
One-Deck game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all the cards to the foundations.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Cards are dealt from the talon one at a time, and can
|
||||
be moved to foundations, or one of four free cells. There
|
||||
are four foundations, built up from seven to king by rank,
|
||||
regardless of suit, located in the corners, and a fifth
|
||||
foundation, built down from six to ace by rank, regardless
|
||||
of suit, then wrapping from ace to six, with the sequence
|
||||
ultimately being built four times in a row.
|
||||
<p>
|
||||
The four free cells are located directly above, below, and
|
||||
to the left and right of the center foundation. These can
|
||||
contain a single card, and can only be moved to the
|
||||
foundations. No redeal is allowed. The game is won if all
|
||||
cards are moved to the foundations.
|
|
@ -320,16 +320,16 @@ class GI:
|
|||
# Gnome AisleRiot 2.2.0 (we have 65 out of 70 games)
|
||||
# Gnome AisleRiot 3.22.7
|
||||
# still missing:
|
||||
# Hamilton, Isabel, King's Audience, Labyrinth, Napoleon's Tomb,
|
||||
# Saratoga, Thieves, Treize, Valentine, Wall
|
||||
# Hamilton, Isabel, King's Audience, Labyrinth, Saratoga,
|
||||
# Thieves, Treize, Valentine, Wall
|
||||
("Gnome AisleRiot", (
|
||||
1, 2, 8, 9, 11, 12, 13, 19, 24, 27, 29, 31, 33, 34, 35, 36,
|
||||
38, 40, 41, 42, 43, 45, 48, 58, 65, 67, 89, 91, 92, 93, 94,
|
||||
95, 96, 97, 100, 104, 105, 111, 112, 113, 130, 135, 139, 144,
|
||||
146, 147, 148, 200, 201, 206, 224, 225, 229, 230, 233, 257,
|
||||
258, 280, 281, 282, 283, 284, 334, 384, 495, 551, 552, 553,
|
||||
572, 593, 674, 700, 715, 716, 737, 772, 810, 819, 824, 829,
|
||||
22231,
|
||||
258, 277, 280, 281, 282, 283, 284, 334, 384, 495, 551, 552,
|
||||
553, 572, 593, 674, 700, 715, 716, 737, 772, 810, 819, 824,
|
||||
829, 22231,
|
||||
)),
|
||||
|
||||
# Hoyle Card Games
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
#
|
||||
# ---------------------------------------------------------------------------##
|
||||
|
||||
import pysollib.game
|
||||
from pysollib.game import Game
|
||||
from pysollib.gamedb import GI, GameInfo, registerGame
|
||||
from pysollib.games.golf import BlackHole_Foundation
|
||||
from pysollib.hint import CautiousDefaultHint
|
||||
from pysollib.layout import Layout
|
||||
from pysollib.stack import \
|
||||
AbstractFoundationStack, \
|
||||
AC_RowStack, \
|
||||
RK_FoundationStack, \
|
||||
RK_RowStack, \
|
||||
|
@ -197,7 +197,21 @@ class DutchSolitaire(Windmill):
|
|||
# * Napoleon's Tomb
|
||||
# ************************************************************************
|
||||
|
||||
class NapoleonsTomb(pysollib.game.StartDealRowAndCards, Game):
|
||||
class NapoleonsTomb_Foundation(AbstractFoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
return False
|
||||
if self.cards:
|
||||
# check the rank - an ACE equals a seven
|
||||
rank = self.cards[-1].rank
|
||||
if rank == ACE:
|
||||
rank = 6
|
||||
if (rank + self.cap.dir) % self.cap.mod != cards[0].rank:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class NapoleonsTomb(Game):
|
||||
|
||||
#
|
||||
# game layout
|
||||
|
@ -208,7 +222,7 @@ class NapoleonsTomb(pysollib.game.StartDealRowAndCards, Game):
|
|||
l, s = Layout(self, card_x_space=20, card_y_space=20), self.s
|
||||
|
||||
# set window
|
||||
self.setSize(5*l.XS+l.XM, 3*l.YS+l.YM+l.YM)
|
||||
self.setSize(int(5.1 * l.XS) + l.XM, int(3.05 * l.YS) + (2 * l.YM))
|
||||
|
||||
# create stacks
|
||||
x = l.XM
|
||||
|
@ -218,21 +232,25 @@ class NapoleonsTomb(pysollib.game.StartDealRowAndCards, Game):
|
|||
x = x + l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, "s")
|
||||
x0, y0 = x + l.XS, y
|
||||
x0, y0 = x + l.XS + (0.15 * l.XS), y + (0.05 * l.YS)
|
||||
for d in ((0, 1), (1, 0), (1, 2), (2, 1)):
|
||||
x, y = x0 + d[0] * l.XS, y0 + d[1] * l.YS
|
||||
s.rows.append(Windmill_RowStack(x, y, self))
|
||||
x, y = x0 + l.XS, y0 + l.YS
|
||||
s.foundations.append(Windmill_Foundation(x, y, self, base_rank=5,
|
||||
mod=13, max_cards=24, dir=-1))
|
||||
for d in ((0.1, 0.1), (1.9, 0.1), (0.1, 1.9), (1.9, 1.9)):
|
||||
x, y = x0 + d[0] * l.XS, y0 + d[1] * l.YS
|
||||
s.foundations.append(NapoleonsTomb_Foundation(x, y, self, base_rank=5,
|
||||
mod=13, max_cards=24, dir=-1, suit=ANY_SUIT))
|
||||
for d in ((0.05, 0.05), (-2.05, 0.05), (0.05, -2.05), (-2.05, -2.05)):
|
||||
x, y = x0 - d[0] * l.XS, y0 - d[1] * l.YS
|
||||
s.foundations.append(Windmill_Foundation(x, y, self,
|
||||
max_cards=7, base_rank=6, mod=13))
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
||||
def startGame(self):
|
||||
self.startDealSample()
|
||||
self.s.talon.dealCards()
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Corners
|
||||
|
|
Loading…
Add table
Reference in a new issue