Skip to content

Commit

Permalink
Add Microbe game
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Jan 21, 2025
1 parent 7cac54b commit ac03fa7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
27 changes: 27 additions & 0 deletions html-src/rules/microbe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<h1>Microbe</h1>
<p>
Spider type. 2 decks. No redeal.

<h3>Object</h3>
<p>
Group all the cards in sets of 13 cards in descending sequence
by alternate color from King to Ace and move such sets to the foundations.

<h3>Rules</h3>
<p>
The decks are separated. From one deck, four cards are dealt to each of
eleven tableau piles, with alternating cards face-up and face-down (the
bottom and third from the bottom cards are face-down). The remaining
eight cards from that deck are combined with the other deck to form the
talon.
<p>
Tableau piles are built down by alternate color, and any card or valid
sequence of cards can be moved between tableau piles. Any valid card or
sequence can fill empty piles.
<p>
The object is to group the cards in sets of 13 cards, from King to Ace
in an alternating color sequence. Such groups can be moved to the foundations.
<p>
When there are no moves left, you can deal one card from the talon to
each tableau pile. The game is won if all cards are grouped into sequences
and moved to the foundations.
1 change: 1 addition & 0 deletions pysollib/gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ def _callback(gi, gt=game_type):
tuple(range(19000, 19012)) + tuple(range(22303, 22311)) +
tuple(range(22353, 22361))),
('fc-3.1', tuple(range(961, 971))),
('dev', tuple(range(971, 972))),
)

# deprecated - the correct way is to or a GI.GT_XXX flag
Expand Down
23 changes: 15 additions & 8 deletions pysollib/games/spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,7 @@ def getQuickPlayScore(self, ncards, from_stack, to_stack):

# ************************************************************************
# * Fechter's Game
# * Microbe
# ************************************************************************

class FechtersGame_Talon(TalonStack):
Expand All @@ -1180,14 +1181,7 @@ def dealCards(self, sound=True):


class FechtersGame_RowStack(AC_RowStack):
def canDropCards(self, stacks):
if len(self.cards) < 13:
return (None, 0)
cards = self.cards[-13:]
for s in stacks:
if s is not self and s.acceptsCards(self, cards):
return (s, 13)
return (None, 0)
canDropCards = BasicRowStack.spiderCanDropCards


class FechtersGame(RelaxedSpider):
Expand All @@ -1208,6 +1202,17 @@ def startGame(self):
shallHighlightMatch = Game._shallHighlightMatch_AC


class Microbe(FechtersGame):
Talon_Class = DealRowTalonStack
RowStack_Class = StackWrapper(FechtersGame_RowStack, base_rank=ANY_RANK)

def createGame(self):
RelaxedSpider.createGame(self, rows=11)

def shuffle(self):
self.shuffleSeparateDecks()


# ************************************************************************
# * Bebop
# ************************************************************************
Expand Down Expand Up @@ -1663,3 +1668,5 @@ def startGame(self):
GI.GT_SPIDER, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(917, Astrocyte, "Astrocyte",
GI.GT_SPIDER, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(971, Microbe, "Microbe",
GI.GT_SPIDER | GI.GT_SEPARATE_DECKS, 2, 0, GI.SL_MOSTLY_SKILL))

0 comments on commit ac03fa7

Please sign in to comment.