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

Added Fire and Ice game.

This commit is contained in:
Joe R 2021-10-18 22:25:21 -04:00
parent d6ca9c9e25
commit bdb62f94b7
6 changed files with 87 additions and 8 deletions

View file

@ -0,0 +1,24 @@
<h1>Fire and Ice</h1>
<p>
One-deck game type. 1 deck. No redeal.
<h3>Object</h3>
<p>
Move all the red "fire" cards to the left five tableau piles and the black
"ice" cards to the right five tableau piles.
<h3>Rules</h3>
<p>
Five cards are dealt to each of ten tableau piles, with the leftmost and
rightmost piles receiving an extra card. Any card or sequence of cards can
be moved between tableau piles, building down by rank, regardless of suit.
<p>
In this game, the red cards are called "fire" cards and the black cards are
called "ice" cards. The object is to move all of the "fire" cards to the
leftmost five tableau piles, and all the "ice" cards to the rightmost five.
When dealing, a gap is left between the two sets of tableau piles to show
this clearer.
<h3>Notes</h3>
<p>
Fire and Ice was invented by David Bernazzani.

View file

@ -16,3 +16,8 @@ Cards may not be moved between the reserve stacks.
The tableau stacks are built down by suit. Any sequence of cards in the
tableau stacks may be moved to another appropriate tableau stack. The game
is won when four stacks contain complete sequences from king to ace.
<h3>Notes</h3>
<p>
Wave Motion was invented by David Bernazzani. Its name is a reference to
the anime series Space Battleship Yamato, also called Star Blazers.

View file

@ -381,7 +381,7 @@ class GI:
GAMES_BY_INVENTORS = (
("Paul Alfille", (8,)),
("C.L. Baker", (45,)),
("David Bernazzani", (314,)),
("David Bernazzani", (314, 830,)),
("Gordon Bower", (763, 783,)),
("Art Cabral", (9,)),
("Richard A. Canfield", (105,)),
@ -479,7 +479,7 @@ class GI:
('fc-2.12', tuple(range(774, 811)) + (16681,) +
tuple(range(22217, 22219))),
('fc-2.14', tuple(range(811, 827))),
('fc-2.16', tuple(range(827, 830)))
('fc-2.16', tuple(range(827, 831)))
)
# deprecated - the correct way is to or a GI.GT_XXX flag

View file

@ -45,8 +45,8 @@ from pysollib.stack import \
WasteTalonStack, \
isRankSequence, \
isSameSuitSequence
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, UNLIMITED_ACCEPTS, \
UNLIMITED_MOVES
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, BLACK, KING, RED,\
UNLIMITED_ACCEPTS, UNLIMITED_MOVES
# ************************************************************************
# * Curds and Whey
@ -528,6 +528,53 @@ class FourPacks(EightPacks):
return True
# ************************************************************************
# * Fire and Ice
# ************************************************************************
class FireAndIce(Game):
RowStack_Class = RK_RowStack
def createGame(self, playcards=18):
l, s = Layout(self), self.s
self.setSize(l.XM + (10.5 * l.XS),
l.YM + l.YS + playcards * l.YOFFSET)
x, y = l.XM, l.YM
for i in range(5):
s.rows.append(self.RowStack_Class(x, y, self))
x += l.XS
x += l.XS / 2
for i in range(5):
s.rows.append(self.RowStack_Class(x, y, self))
x += l.XS
x, y = self.width - l.XS, self.height - l.YS
s.talon = InitialDealTalonStack(x, y, self)
l.defaultStackGroups()
def startGame(self):
for i in range(4):
self.s.talon.dealRow(frames=0)
r = self.s.rows
rows = (r[0], r[9])
self.s.talon.dealRow(rows=rows, frames=0)
self._startAndDealRow()
def isGameWon(self):
for i in self.s.rows[0:5]:
for j in i.cards:
if j.color != RED:
return False
for i in self.s.rows[5:10]:
for j in i.cards:
if j.color != BLACK:
return False
# register the game
registerGame(GameInfo(294, CurdsAndWhey, "Curds and Whey",
GI.GT_SPIDER | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
@ -564,3 +611,5 @@ registerGame(GameInfo(724, EightPacks, "Eight Packs",
GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(762, FourPacks, "Four Packs",
GI.GT_2DECK_TYPE, 2, 1, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(830, FireAndIce, "Fire and Ice",
GI.GT_1DECK_TYPE, 1, 0, GI.SL_SKILL))

View file

@ -40,7 +40,7 @@ from pysollib.stack import \
StackWrapper, \
WasteStack, \
WasteTalonStack
from pysollib.util import ACE, ANY_SUIT, JACK, KING, QUEEN, RANKS
from pysollib.util import ACE, ANY_SUIT, BLACK, JACK, KING, QUEEN, RANKS, RED
class GrandfathersClock_Hint(CautiousDefaultHint):
@ -187,9 +187,6 @@ class Dial(Game):
# * Hemispheres
# ************************************************************************
BLACK, RED = 0, 1
class Hemispheres_Hint(DefaultHint):
def shallMovePile(self, from_stack, to_stack, pile, rpile):
if not self._defaultShallMovePile(from_stack, to_stack, pile, rpile):

View file

@ -52,6 +52,10 @@ SPADE = 1
HEART = 2
DIAMOND = 3
# Specific colors
BLACK = 0
RED = 1
# Card ranks are 0-12. We also define symbolic names for the picture cards.
RANKS = (_("Ace"), "2", "3", "4", "5", "6", "7", "8", "9", "10",
_("Jack"), _("Queen"), _("King"))