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

Unlimited redeal option for Hit or MIss game.

This commit is contained in:
Joe R 2022-11-17 17:49:01 -05:00
parent 9493f79f9c
commit 1ec22ad16f
4 changed files with 46 additions and 10 deletions

View file

@ -7,9 +7,14 @@ One-Deck game type. 1 deck. Varying number of redeals.
Move all cards to the foundation. Move all cards to the foundation.
<h3>Rules</h3> <h3>Rules</h3>
<p>As you draw cards from the talon, one at a time, you declare a card rank <p>As you draw cards from the talon, one at a time, declare a card rank
in sequence (ace to king, then start over from ace). If the card you draw in sequence (ace to king, then start over from ace). If the drawn card
matches the rank you declared, that is a "Hit", and the card may be moved matches the declard rank, that is a "Hit", and the card may be moved to
to the foundation. Otherwise, it is a "Miss". You can continue to redeal the foundation. Otherwise, it is a "Miss". You can continue to redeal
as many times as you need, until you go through the entire deck twice in a as many times as you need, until you go through the entire deck twice in
row without getting a single "Hit". a row without getting a single "Hit".
<h3>Notes</h3>
<p>
For a variation that allows unlimited redeals (often seen in other
solitaire apps), see <a href="hitormissunlimited.html">Hit or Miss Unlimited</a>.

View file

@ -0,0 +1,22 @@
<h1>Hit or Miss Unlimited</h1>
<p>
One-Deck game type. 1 deck. Unlimited redeals.
<h3>Object</h3>
<p>
Move all cards to the foundation.
<h3>Quick Description</h3>
<p>
Just like <a href="hitormiss.html">Hit or Miss</a>,
but with unlimited redeals.
<h3>Notes</h3>
<p>
The traditional rules of Hit or Miss only allow you to go through
the deck twice without getting a hit, but this rule is often
overlooked due to the extreme difficulty of winning the game it
causes. Most computer versions of Hit or Miss do not use this
rule, but when this rule is omitted, the game is always won unless
the player gets stuck with a multiple of 13 cards left. This
version does not use this rule, while Hit or Miss does.

View file

@ -546,12 +546,13 @@ class GI:
tuple(range(22217, 22219))), tuple(range(22217, 22219))),
('fc-2.14', tuple(range(811, 827))), ('fc-2.14', tuple(range(811, 827))),
('fc-2.15', tuple(range(827, 855)) + tuple(range(22400, 22407))), ('fc-2.15', tuple(range(827, 855)) + tuple(range(22400, 22407))),
('dev', tuple(range(855, 865))) ('dev', tuple(range(855, 866)))
) )
# deprecated - the correct way is to or a GI.GT_XXX flag # deprecated - the correct way is to or a GI.GT_XXX flag
# in the registerGame() call # in the registerGame() call
_CHILDREN_GAMES = [16, 33, 55, 90, 91, 96, 97, 176, 328, 329, 862, 903, ] _CHILDREN_GAMES = [16, 33, 55, 90, 91, 96, 97, 176, 328, 329, 862, 865,
903, ]
_OPEN_GAMES = [] _OPEN_GAMES = []

View file

@ -31,6 +31,7 @@ from pysollib.stack import \
WasteStack, \ WasteStack, \
WasteTalonStack WasteTalonStack
from pysollib.util import ANY_SUIT, RANKS, \ from pysollib.util import ANY_SUIT, RANKS, \
UNLIMITED_REDEALS, \
VARIABLE_REDEALS VARIABLE_REDEALS
@ -92,12 +93,12 @@ class HitOrMiss_Waste(WasteStack):
# ************************************************************************ # ************************************************************************
class HitOrMiss(Game): class HitOrMiss(Game):
MaxRounds = VARIABLE_REDEALS
def createGame(self): def createGame(self):
layout, s = Layout(self), self.s layout, s = Layout(self), self.s
self.rank = -1 self.rank = -1
self.deadDeals = 1 self.deadDeals = 1
self.max_rounds = VARIABLE_REDEALS
self.setSize(layout.XM + 4 * layout.XS, layout.YM + 2 * layout.YS) self.setSize(layout.XM + 4 * layout.XS, layout.YM + 2 * layout.YS)
x, y = layout.XM + 3 * layout.XS // 2, layout.YM x, y = layout.XM + 3 * layout.XS // 2, layout.YM
stack = HitOrMiss_Foundation(x, y, self, ANY_SUIT, stack = HitOrMiss_Foundation(x, y, self, ANY_SUIT,
@ -106,7 +107,7 @@ class HitOrMiss(Game):
layout.createText(stack, 'ne') layout.createText(stack, 'ne')
x, y = layout.XM+layout.XS, layout.YM+layout.YS x, y = layout.XM+layout.XS, layout.YM+layout.YS
s.talon = HitOrMiss_Talon(x, y, self, s.talon = HitOrMiss_Talon(x, y, self,
max_rounds=VARIABLE_REDEALS, num_deal=1) max_rounds=self.MaxRounds, num_deal=1)
layout.createText(s.talon, 'nw') layout.createText(s.talon, 'nw')
x += layout.XS x += layout.XS
@ -160,7 +161,14 @@ class HitOrMiss(Game):
return Game.getSnapshotHash(self) + str(self.rank) return Game.getSnapshotHash(self) + str(self.rank)
class HitOrMissUnlimited(HitOrMiss):
MaxRounds = UNLIMITED_REDEALS
# register the game # register the game
registerGame(GameInfo(774, HitOrMiss, "Hit or Miss", registerGame(GameInfo(774, HitOrMiss, "Hit or Miss",
GI.GT_1DECK_TYPE, 1, VARIABLE_REDEALS, GI.GT_1DECK_TYPE, 1, VARIABLE_REDEALS,
GI.SL_LUCK, altnames=("Roll Call",))) GI.SL_LUCK, altnames=("Roll Call",)))
registerGame(GameInfo(865, HitOrMissUnlimited, "Hit or Miss Unlimited",
GI.GT_1DECK_TYPE, 1, UNLIMITED_REDEALS,
GI.SL_LUCK))