Esempio n. 1
0
def r(id, gameclass, name, rules_filename="shisensho.html"):
    decks, ranks, trumps = comp_cardset(gameclass.NCARDS)
    gi = GameInfo(id, gameclass, name,
                  GI.GT_SHISEN_SHO, 4*decks, 0, GI.SL_MOSTLY_SKILL,
                  category=GI.GC_MAHJONGG, short_name=name,
                  suits=range(3), ranks=range(ranks), trumps=range(trumps),
                  si={"decks": decks, "ncards": gameclass.NCARDS})
    gi.ncards = gameclass.NCARDS
    gi.rules_filename = rules_filename
    registerGame(gi)
    return gi
Esempio n. 2
0
def r(id, gameclass, short_name):
    name = short_name
    ncards = int(name[:2]) * int(name[:2])
    gi = GameInfo(id, gameclass, name,
                GI.GT_MATRIX, 1, 0, GI.SL_SKILL,
                category=GI.GC_TRUMP_ONLY, short_name=short_name,
                suits=(), ranks=(), trumps=range(ncards),
                si = {"decks": 1, "ncards": ncards})
    gi.ncards = ncards
    gi.rules_filename = "matrix.html"
    registerGame(gi)
    return gi
Esempio n. 3
0
def r(id, short_name, name=None, ncards=144, layout=None):
    assert layout
    if not name:
        name = "Mahjongg " + short_name
    classname = re.sub('\W', '', name)
    # create class
    gameclass = classobj(classname, (AbstractMahjonggGame,), {})
    gameclass.L = layout
    gameclass.NCARDS = ncards
    decks, ranks, trumps = comp_cardset(ncards)
    gi = GameInfo(id, gameclass, name,
                  GI.GT_MAHJONGG, 4*decks, 0, ##GI.SL_MOSTLY_SKILL,
                  category=GI.GC_MAHJONGG, short_name=short_name,
                  suits=range(3), ranks=range(ranks), trumps=range(trumps),
                  si={"decks": decks, "ncards": ncards})
    gi.ncards = ncards
    gi.rules_filename = "mahjongg.html"
    registerGame(gi)
    return gi
Esempio n. 4
0
    def fillStack(self, stack):
        if stack in self.s.rows and not stack.cards:
            old_state = self.enterState(self.S_FILL)
            if not self.s.waste.cards:
                self.s.talon.dealCards()
            if self.s.waste.cards:
                self.s.waste.moveMove(1, stack)
            self.leaveState(old_state)

    shallHighlightMatch = Game._shallHighlightMatch_RKW


# register the game
registerGame(GameInfo(330, Sultan, "Sultan",
                      GI.GT_2DECK_TYPE, 2, 2, GI.SL_MOSTLY_LUCK,
                      altnames=("Sultan of Turkey",
                                "Emperor of Germany")))
registerGame(GameInfo(331, SultanPlus, "Sultan +",
                      GI.GT_2DECK_TYPE, 2, 2, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(354, Boudoir, "Boudoir",
                      GI.GT_2DECK_TYPE, 2, 2, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(410, CaptiveQueens, "Captive Queens",
                      GI.GT_1DECK_TYPE, 1, 2, GI.SL_MOSTLY_LUCK,
                      altnames=("Quadrille",)))
registerGame(GameInfo(418, Contradance, "Contradance",
                      GI.GT_2DECK_TYPE, 2, 1, GI.SL_LUCK,
                      altnames=("Cotillion",)))
registerGame(GameInfo(419, IdleAces, "Idle Aces",
                      GI.GT_2DECK_TYPE, 2, 2, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(423, LadyOfTheManor, "Lady of the Manor",
                      GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_LUCK,
Esempio n. 5
0
        Carthage.startGame(self)


class AlgerianPatience3(Carthage):
    Foundation_Classes = (SS_FoundationStack, SS_FoundationStack,
                          SS_FoundationStack)
    RowStack_Class = StackWrapper(UD_SS_RowStack, mod=13)

    def createGame(self):
        Carthage.createGame(self, rows=8, reserves=8, playcards=20)

    def _shuffleHook(self, cards):
        return self._shuffleHookMoveToTop(
            cards, lambda c: (c.rank == ACE, (c.deck, c.suit)))

    def startGame(self):
        self.s.talon.dealRow(rows=self.s.foundations, frames=0)
        Carthage.startGame(self)


# register the game
registerGame(
    GameInfo(321, Carthage, "Carthage", GI.GT_2DECK_TYPE, 2, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(322, AlgerianPatience, "Algerian Patience", GI.GT_2DECK_TYPE, 2,
             0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(457, AlgerianPatience3, "Algerian Patience (3 decks)",
             GI.GT_3DECK_TYPE | GI.GT_ORIGINAL, 3, 0, GI.SL_MOSTLY_SKILL))
Esempio n. 6
0
            s.foundations.append(
                SS_FoundationStack(r.x, r.y, self, suit=r.suit))
        for r in l.s.rows:
            s.rows.append(SS_RowStack(r.x, r.y, self, base_rank=NO_RANK))
        # default
        l.defaultAll()

    def startGame(self):
        CastlesInSpain.startGame(self, flip=(1, 1, 1))

    shallHighlightMatch = Game._shallHighlightMatch_SS


# register the game
registerGame(
    GameInfo(83, CastlesInSpain, "Castles in Spain", GI.GT_BAKERS_DOZEN, 1, 0,
             GI.SL_BALANCED))
registerGame(
    GameInfo(84, Martha, "Martha", GI.GT_BAKERS_DOZEN, 1, 0, GI.SL_BALANCED))
registerGame(
    GameInfo(31, BakersDozen, "Baker's Dozen", GI.GT_BAKERS_DOZEN | GI.GT_OPEN,
             1, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(85, SpanishPatience, "Spanish Patience",
             GI.GT_BAKERS_DOZEN | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(86, GoodMeasure, "Good Measure", GI.GT_BAKERS_DOZEN | GI.GT_OPEN,
             1, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(104, Cruel, "Cruel", GI.GT_BAKERS_DOZEN | GI.GT_OPEN, 1, -1,
             GI.SL_BALANCED))
registerGame(
Esempio n. 7
0
                DieRussische_Foundation(
                    x, y, self, i/2, max_move=0, max_cards=8))
        for i in range(rows):
            x, y, = l.XM + (2*i+8-rows)*l.XS/2, l.YM + l.YS
            s.rows.append(AC_RowStack(x, y, self))
        s.talon = DieBoeseSieben_Talon(
            l.XM, self.height-l.YS, self, max_rounds=2)
        l.createText(s.talon, 'ne')
        l.createRoundText(s.talon, 'se')

        # define stack-groups
        l.defaultStackGroups()

    #
    # game overrides
    #

    def startGame(self):
        self.startDealSample()
        for flip in (1, 0, 1, 0, 1, 0, 1):
            self.s.talon.dealRow(flip=flip)

    shallHighlightMatch = Game._shallHighlightMatch_AC


# register the game
registerGame(GameInfo(120, DieBoeseSieben, "Bad Seven",
                      GI.GT_2DECK_TYPE, 2, 1, GI.SL_MOSTLY_LUCK,
                      ranks=(0, 6, 7, 8, 9, 10, 11, 12),
                      altnames=("Die boese Sieben",)))
Esempio n. 8
0
        x -= l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'n')

        # define stack-groups
        l.defaultStackGroups()

    def startGame(self):
        self._startDealNumRowsAndDealRowAndCards(4)

    shallHighlightMatch = Game._shallHighlightMatch_AC


# register the game
registerGame(
    GameInfo(290, Bisley, "Bisley", GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(372, DoubleBisley, "Double Bisley",
             GI.GT_2DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(373, Gloria, "Gloria",
             GI.GT_2DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(374, Realm, "Realm",
             GI.GT_1DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(375, Mancunian, "Mancunian",
             GI.GT_1DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0,
Esempio n. 9
0
            return True
        if card1.suit == HEART and card2.suit == CLUB:
            return True
        if card1.suit == CLUB and card2.suit == DIAMOND:
            return True
        if card1.suit == DIAMOND and card2.suit == SPADE:
            return True
        return False


# register the game
registerGame(
    GameInfo(13,
             FortyThieves,
             "Forty Thieves",
             GI.GT_FORTY_THIEVES,
             2,
             0,
             GI.SL_MOSTLY_SKILL,
             altnames=("Napoleon at St. Helena", "Le Cadran")))
registerGame(
    GameInfo(80, BusyAces, "Busy Aces", GI.GT_FORTY_THIEVES, 2, 0,
             GI.SL_BALANCED))
registerGame(
    GameInfo(228, Limited, "Limited", GI.GT_FORTY_THIEVES, 2, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(79, WaningMoon, "Waning Moon", GI.GT_FORTY_THIEVES, 2, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(125, Lucas, "Lucas", GI.GT_FORTY_THIEVES, 2, 0,
             GI.SL_MOSTLY_SKILL))
Esempio n. 10
0
        self.s.talon.dealRow(rows=self.s.foundations, frames=0)
        self.startDealSample()
        self.s.talon.dealRow()

    def fillStack(self, stack):
        if stack in self.s.rows and not stack.cards:
            if self.s.talon.cards:
                self.s.talon.flipMove()
                self.s.talon.moveMove(1, stack)

    shallHighlightMatch = Game._shallHighlightMatch_ACW


# register the game
registerGame(
    GameInfo(303, Tournament, "Tournament", GI.GT_2DECK_TYPE, 2, 2,
             GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(
        304,
        LaNivernaise,
        "La Nivernaise",
        GI.GT_2DECK_TYPE,
        2,
        2,
        GI.SL_MOSTLY_LUCK,
        altnames=("Napoleon's Flank", ),
    ))
registerGame(
    GameInfo(386, KingsdownEights, "Kingsdown Eights", GI.GT_2DECK_TYPE, 2, 0,
             GI.SL_BALANCED))
registerGame(
Esempio n. 11
0
        # set window
        self.setSize(l.XM + (l.XS * 1.5) + self.Foundations * l.XS,
                     l.YM + 5 * l.YS)

        # create stacks
        for j in range(self.Foundations):
            for i in range(4):
                x, y, = l.XM + (l.XS * (j + 1.5)), (l.YM + i * l.YS) + l.YS
                s.foundations.append(
                    Moojub_Foundation(x, y, self, ANY_SUIT, mod=13,
                                      max_move=0))

        for i in range(4):
            x, y, = l.XM, (l.YM + i * l.YS) + l.YS
            s.rows.append(OpenStack(x, y, self))

        x, y, = l.XM, l.YM
        s.talon = DealRowTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, 'se')

        # define stack-groups
        l.defaultStackGroups()

    def startGame(self):
        self._startAndDealRow()


# register the game
registerGame(
    GameInfo(845, Moojub, "Moojub", GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
Esempio n. 12
0
        i = 0
        while self.s.talon.cards:
            r = self.s.talon.cards[-1].rank
            self.s.talon.dealRow(rows=[self.s.rows[i]], frames=4)
            if r == ACE:
                i += 1

    shallHighlightMatch = Game._shallHighlightMatch_RK


# register the game
registerGame(
    GameInfo(141,
             DerKatzenschwanz,
             "Cat's Tail",
             GI.GT_FREECELL | GI.GT_OPEN,
             2,
             0,
             GI.SL_MOSTLY_SKILL,
             altnames=("Der Katzenschwanz", )))
registerGame(
    GameInfo(142,
             DieSchlange,
             "Snake",
             GI.GT_FREECELL | GI.GT_OPEN,
             2,
             0,
             GI.SL_MOSTLY_SKILL,
             altnames=("Die Schlange", )))
registerGame(
    GameInfo(279, Kings, "Kings", GI.GT_FREECELL | GI.GT_OPEN, 2, 0,
             GI.SL_MOSTLY_SKILL))
Esempio n. 13
0
    def updateText(self):
        if self.preview > 1:
            return
        self.texts.base_rank.config(text=RANKS[self.rank])

    def _restoreGameHook(self, game):
        self.rank = game.loadinfo.dval.get('Rank')
        self.deadDeals = game.loadinfo.dval.get('DeadDeals')

    def _loadGameHook(self, p):
        self.loadinfo.addattr(dval=p.load())

    def _saveGameHook(self, p):
        dval = {'Rank': self.rank, 'DeadDeals': self.deadDeals}
        p.dump(dval)

    def setState(self, state):
        # restore saved vars (from undo/redo)
        self.rank = state[0]
        self.deadDeals = state[1]

    def getState(self):
        # save vars (for undo/redo)
        return [self.rank, self.deadDeals]


# register the game
registerGame(GameInfo(774, HitOrMiss, "Hit or Miss",
                      GI.GT_1DECK_TYPE, 1, VARIABLE_REDEALS,
                      GI.SL_LUCK))
Esempio n. 14
0
        self.s.talon.dealRow()
        self.s.talon.dealCards()

    def fillStack(self, stack):
        if stack in self.s.rows and not stack.cards:
            old_state = self.enterState(self.S_FILL)
            if not self.s.waste.cards:
                self.s.talon.dealCards()
            if self.s.waste.cards:
                self.s.waste.moveMove(1, stack)
            self.leaveState(old_state)


# register the game
registerGame(
    GameInfo(280, Camelot, "Camelot", GI.GT_1DECK_TYPE, 1, 0, GI.SL_BALANCED))
registerGame(
    GameInfo(610, SlyFox, "Sly Fox", GI.GT_NUMERICA, 2, 0, GI.SL_BALANCED))
registerGame(
    GameInfo(614, OpenSlyFox, "Open Sly Fox", GI.GT_NUMERICA | GI.GT_ORIGINAL,
             2, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(623, PrincessPatience, "Princess Patience", GI.GT_2DECK_TYPE, 2,
             0, GI.SL_BALANCED))
registerGame(
    GameInfo(622, GrandmammasPatience, "Grandmamma's Patience", GI.GT_NUMERICA,
             2, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(702, DoubleLine, "Double Line", GI.GT_NUMERICA, 2, 0,
             GI.SL_BALANCED))
Esempio n. 15
0
    #
    # game extras
    #

    def cardsMatch(self, card1, card2):
        return card1.rank == card2.rank


# register the game
registerGame(
    GameInfo(176,
             Memory24,
             "Memory 24",
             GI.GT_MEMORY | GI.GT_SCORE,
             2,
             0,
             GI.SL_SKILL,
             suits=(0, 2),
             ranks=(0, 8, 9, 10, 11, 12)))
registerGame(
    GameInfo(219,
             Memory30,
             "Memory 30",
             GI.GT_MEMORY | GI.GT_SCORE,
             2,
             0,
             GI.SL_SKILL,
             suits=(0, 2, 3),
             ranks=(0, 9, 10, 11, 12)))
registerGame(
Esempio n. 16
0
    def dealCards(self, sound=True):
        # for demo-mode
        if self.demo:
            r = self.s.reserves[0]
            if r.canDealCards():
                # self.demo.last_deal = [] # don't check last deal
                return r.dealCards(sound=sound)
        return Game.dealCards(self, sound=sound)

    shallHighlightMatch = Game._shallHighlightMatch_AC


# register the game
registerGame(
    GameInfo(135, Terrace, "Terrace", GI.GT_TERRACE, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(136, GeneralsPatience, "General's Patience", GI.GT_TERRACE, 2, 0,
             GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(137, BlondesAndBrunettes, "Blondes and Brunettes", GI.GT_TERRACE,
             2, 0, GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(138, FallingStar, "Falling Star", GI.GT_TERRACE, 2, 0,
             GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(431, QueenOfItaly, "Queen of Italy", GI.GT_TERRACE, 2, 0,
             GI.SL_BALANCED))
registerGame(
    GameInfo(499, Signora, "Signora", GI.GT_TERRACE, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    def isGameWon(self):
        if self.s.talon.cards or self.s.waste.cards:
            return False
        for s in self.s.rows:
            if s.cards:
                if s.cards[0].rank != ACE:
                    return False
                if len(s.cards) != 26:
                    return False
        return True


# register the game
registerGame(
    GameInfo(294, CurdsAndWhey, "Curds and Whey", GI.GT_SPIDER | GI.GT_OPEN, 1,
             0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(311, Dumfries, "Dumfries", GI.GT_1DECK_TYPE, 1, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(312, Galloway, "Galloway", GI.GT_1DECK_TYPE, 1, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(313, Robin, "Robin", GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(348, Arachnida, "Arachnida", GI.GT_SPIDER, 2, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(349, MissMuffet, "Miss Muffet", GI.GT_SPIDER | GI.GT_OPEN, 1, 0,
             GI.SL_MOSTLY_SKILL))
Esempio n. 18
0
            self.s.talon.dealRow(rows=self.s.reserves, frames=0)
        self.startDealSample()
        for i in range(3):
            self.s.talon.dealRow(rows=self.s.reserves)

    def isGameWon(self):
        for r in self.s.reserves:
            if len(r.cards) != 1:
                return False
        return True

    def shallHighlightMatch(self, stack1, card1, stack2, card2):
        r1, r2 = card1.rank, card2.rank
        if r1 == QUEEN or r2 == QUEEN:
            return False
        if ((r1 == JACK and r2 == KING) or (r2 == JACK and r1 == KING)):
            return True
        return ((r1 + 1) % 13 == r2 or (r2 + 1) % 13 == r1)


# register the game
registerGame(
    GameInfo(334, TakeAway, "Take Away", GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(335, FourStacks, "Four Stacks", GI.GT_1DECK_TYPE | GI.GT_OPEN, 1,
             0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(654, Striptease, "Striptease", GI.GT_1DECK_TYPE, 1, 0,
             GI.SL_MOSTLY_SKILL))
Esempio n. 19
0
    def _restoreGameHook(self, game):
        self.base_card = self.cards[game.loadinfo.base_card_id]
        for s in self.s.foundations:
            s.cap.base_rank = self.base_card.rank

    def _loadGameHook(self, p):
        self.loadinfo.addattr(base_card_id=None)  # register extra load var.
        self.loadinfo.base_card_id = p.load()

    def _saveGameHook(self, p):
        p.dump(self.base_card.id)


# register the game
registerGame(
    GameInfo(30, Windmill, "Windmill", GI.GT_2DECK_TYPE, 2, 0,
             GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(277, NapoleonsTomb, "Napoleon's Tomb", GI.GT_1DECK_TYPE, 1, 0,
             GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(417,
             Corners,
             "Corners",
             GI.GT_1DECK_TYPE,
             1,
             2,
             GI.SL_MOSTLY_LUCK,
             rules_filename='fourseasons.html'))
registerGame(
    GameInfo(437,
             Simplicity,
Esempio n. 20
0
# ************************************************************************
# * Take Away 8
# ************************************************************************


class TakeAway8(TakeAway):
    def createGame(self):
        TakeAway.createGame(self, reserves=8)


# register the game
registerGame(
    GameInfo(334,
             TakeAway,
             "Take Away",
             GI.GT_1DECK_TYPE | GI.GT_OPEN,
             1,
             0,
             GI.SL_MOSTLY_SKILL,
             altnames=("Eliminator")))
registerGame(
    GameInfo(335, FourStacks, "Four Stacks", GI.GT_1DECK_TYPE | GI.GT_OPEN, 1,
             0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(654, Striptease, "Striptease", GI.GT_1DECK_TYPE, 1, 0,
             GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(784, TakeAway8, "Take Away 8", GI.GT_1DECK_TYPE | GI.GT_OPEN, 1,
             0, GI.SL_MOSTLY_SKILL))
Esempio n. 21
0
        self.base_card = self.s.talon.cards[-1]
        for s in self.s.foundations:
            s.cap.base_rank = self.base_card.rank
        # deal base card to Foundations
        c = self.s.talon.getCard()
        to_stack = self.s.foundations[c.suit * self.gameinfo.decks]
        self.flipMove(self.s.talon)
        self.moveMove(1, self.s.talon, to_stack, frames=0)
        # deal rows
        self._startAndDealRowAndCards()

    def _restoreGameHook(self, game):
        self.base_card = self.cards[game.loadinfo.base_card_id]
        for s in self.s.foundations:
            s.cap.base_rank = self.base_card.rank

    def _loadGameHook(self, p):
        self.loadinfo.addattr(base_card_id=None)  # register extra load var.
        self.loadinfo.base_card_id = p.load()

    def _saveGameHook(self, p):
        p.dump(self.base_card.id)

    shallHighlightMatch = Game._shallHighlightMatch_RKW


# register the game
registerGame(
    GameInfo(93, RoyalEast, "Royal East", GI.GT_1DECK_TYPE, 1, 0,
             GI.SL_BALANCED))
Esempio n. 22
0
            indx = list(self.s.rows).index(stack)
            r = self.s.reserves[indx]
            if r.cards:
                old_state = self.enterState(self.S_FILL)
                r.moveMove(1, stack)
                self.leaveState(old_state)

    shallHighlightMatch = Game._shallHighlightMatch_SSW


# register the game
registerGame(
    GameInfo(12,
             Braid,
             "Braid",
             GI.GT_NAPOLEON,
             2,
             2,
             GI.SL_BALANCED,
             altnames=("Der Zopf", "Plait", "Pigtail")))
registerGame(
    GameInfo(175,
             LongBraid,
             "Long Braid",
             GI.GT_NAPOLEON,
             2,
             2,
             GI.SL_BALANCED,
             altnames=("Der lange Zopf", )))
registerGame(GameInfo(358, Fort, "Fort", GI.GT_NAPOLEON, 2, 2, GI.SL_BALANCED))
registerGame(
    GameInfo(376, Backbone, "Backbone", GI.GT_NAPOLEON, 2, 0, GI.SL_BALANCED))
Esempio n. 23
0
        stack = Simplex_Foundation(x,
                                   y,
                                   self,
                                   suit=ANY_SUIT,
                                   base_rank=ANY_RANK,
                                   max_cards=52)
        xoffset = (self.width - 3 * l.XS) / 51
        stack.CARD_XOFFSET, stack.CARD_YOFFSET = xoffset, 0
        s.foundations.append(stack)
        x, y = l.XM, l.YM + l.YS + l.TEXT_HEIGHT
        for i in range(9):
            s.rows.append(Simplex_RowStack(x, y, self))
            x += l.XS

        # define stack-groups
        l.defaultStackGroups()

    def startGame(self):
        self.startDealSample()
        self.s.talon.dealRow()
        self.s.talon.dealCards()  # deal first card to WasteStack

    def shallHighlightMatch(self, stack1, card1, stack2, card2):
        return card1.rank == card2.rank


# register the game
registerGame(
    GameInfo(436, Simplex, "Simplex", GI.GT_1DECK_TYPE, 1, 0,
             GI.SL_MOSTLY_LUCK))
Esempio n. 24
0
        for c in cards[:]:
            if c.rank not in ranks:
                ranks.append(c.rank)
                cards.remove(c)
                top.append(c)
        top.sort(key=lambda x: -x.rank)
        return cards+top[7:]+top[:7]

    def startGame(self):
        self.startDealSample()
        self.s.talon.dealRow(rows=self.s.foundations)
        self.s.talon.dealCards()


# register the game
registerGame(GameInfo(256, Calculation, "Calculation",
                      GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_SKILL,
                      altnames=("Progression",)))
registerGame(GameInfo(94, Hopscotch, "Hopscotch",
                      GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(134, BetsyRoss, "Betsy Ross",
                      GI.GT_1DECK_TYPE, 1, 2, GI.SL_MOSTLY_LUCK,
                      altnames=("Fairest", "Four Kings", "Musical Patience",
                                "Quadruple Alliance", "Plus Belle")))
registerGame(GameInfo(550, One234, "One234",
                      GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(653, SeniorWrangler, "Senior Wrangler",
                      GI.GT_2DECK_TYPE, 2, 8, GI.SL_BALANCED))
registerGame(GameInfo(704, SPatience, "S Patience",
                      GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
Esempio n. 25
0
class TwinQueens(Congress):
    Foundation_Classes = [
        StackWrapper(SS_FoundationStack, base_rank=KING, mod=13),
        StackWrapper(SS_FoundationStack, base_rank=KING, mod=13),
        ]
    RowStack_Class = StackWrapper(SS_RowStack, max_move=1)

    def createGame(self):
        Congress.createGame(self, max_rounds=2)

    shallHighlightMatch = Game._shallHighlightMatch_SS


# register the game
registerGame(GameInfo(149, Diplomat, "Diplomat",
                      GI.GT_FORTY_THIEVES, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(151, LadyPalk, "Lady Palk",
                      GI.GT_FORTY_THIEVES, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(150, Congress, "Congress",
                      GI.GT_FORTY_THIEVES, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(433, RowsOfFour, "Rows of Four",
                      GI.GT_FORTY_THIEVES, 2, 2, GI.SL_BALANCED))
registerGame(GameInfo(485, Dieppe, "Dieppe",
                      GI.GT_FORTY_THIEVES, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(489, LittleNapoleon, "Little Napoleon",
                      GI.GT_FORTY_THIEVES, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(548, Parliament, "Parliament",
                      GI.GT_FORTY_THIEVES, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(549, Wheatsheaf, "Wheatsheaf",
                      GI.GT_FORTY_THIEVES, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(563, TwinQueens, "Twin Queens",
Esempio n. 26
0
    #
    # game overrides
    #

    def _shuffleHook(self, cards):
        # move Queens to top of the Talon (i.e. first cards to be dealt)
        return self._shuffleHookMoveToTop(cards, lambda c:
                                          (c.rank == 11, c.suit), 8)

    def startGame(self):
        self.startDealSample()
        self.s.talon.dealRow(self.s.rows[8:])
        self.s.talon.dealCards()  # deal first cards to WasteStack

    def isGameWon(self):
        return len(self.s.talon.cards) == 0 and len(self.s.waste.cards) == 0

    def shallHighlightMatch(self, stack1, card1, stack2, card2):
        if card1.rank + card2.rank == QUEEN + KING:
            return False
        return (card1.suit == card2.suit
                and ((card1.rank + 1) % 13 == card2.rank or
                     (card2.rank + 1) % 13 == card1.rank))


# register the game
registerGame(
    GameInfo(17, Matriarchy, "Matriarchy", GI.GT_2DECK_TYPE, 2,
             VARIABLE_REDEALS, GI.SL_BALANCED))
Esempio n. 27
0
def r(id, gameclass, name, game_type, decks, redeals, skill_level):
    game_type = game_type | GI.GT_HANAFUDA
    gi = GameInfo(id, gameclass, name, game_type, decks, redeals, skill_level,
                  suits=list(range(12)), ranks=list(range(4)))
    registerGame(gi)
    return gi
Esempio n. 28
0
        return int(to_stack in self.s.rows)


# ************************************************************************
# * Penelope's Web
# ************************************************************************


class PenelopesWeb(StreetsAndAlleys):
    RowStack_Class = StackWrapper(RK_RowStack, base_rank=KING)
    Solver_Class = FreeCellSolverWrapper(sbb='rank', esf='kings')


# register the game
registerGame(
    GameInfo(146, StreetsAndAlleys, "Streets and Alleys",
             GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(34, BeleagueredCastle, "Beleaguered Castle",
             GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(145, Citadel, "Citadel", GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1,
             0, GI.SL_MOSTLY_SKILL))
registerGame(
    GameInfo(147, Fortress, "Fortress", GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN,
             1, 0, GI.SL_SKILL))
registerGame(
    GameInfo(148, Chessboard, "Chessboard",
             GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_SKILL))
registerGame(
    GameInfo(300, Stronghold, "Stronghold",
             GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
Esempio n. 29
0
                                    base_rank=ANY_RANK))
        l.createText(s.foundations[0], 's')

        # define stack-groups
        l.defaultStackGroups()

    def startGame(self):
        self._startAndDealRow()


# register the game
registerGame(
    GameInfo(89,
             MonteCarlo,
             "Monte Carlo",
             GI.GT_PAIRING_TYPE,
             1,
             0,
             GI.SL_MOSTLY_LUCK,
             altnames=("Quilt", )))
registerGame(
    GameInfo(216, MonteCarlo2Decks, "Monte Carlo (2 decks)",
             GI.GT_PAIRING_TYPE, 2, 0, GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(212, Weddings, "Weddings", GI.GT_PAIRING_TYPE, 1, 0,
             GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(90, SimpleCarlo, "Simple Carlo", GI.GT_PAIRING_TYPE, 1, 0,
             GI.SL_MOSTLY_LUCK))
registerGame(
    GameInfo(91,
             SimplePairs,
Esempio n. 30
0
# ************************************************************************


class HerzZuHerz(Knockout):
    FOUNDATION_SUIT = HEART

    def fillStack(self, stack):
        pass


# register the game
registerGame(
    GameInfo(850,
             Knockout,
             "Knockout",
             GI.GT_1DECK_TYPE | GI.GT_STRIPPED,
             1,
             2,
             GI.SL_LUCK,
             altnames=("Hope Deferred", ),
             ranks=(0, 6, 7, 8, 9, 10, 11, 12)))
registerGame(
    GameInfo(851,
             HerzZuHerz,
             "Herz zu Herz",
             GI.GT_1DECK_TYPE | GI.GT_STRIPPED,
             1,
             2,
             GI.SL_LUCK,
             ranks=(0, 6, 7, 8, 9, 10, 11, 12)))
Esempio n. 31
0
    def startGame(self):
        self._startDealNumRowsAndDealSingleRow(3)

    def fillStack(self, stack):
        if stack in self.s.rows and not stack.cards:
            if self.s.talon.cards:
                old_state = self.enterState(self.S_FILL)
                self.s.talon.flipMove()
                self.s.talon.moveMove(1, stack)
                self.leaveState(old_state)

    shallHighlightMatch = Game._shallHighlightMatch_RKW


# register the game
registerGame(GameInfo(36, Golf, "Golf", GI.GT_GOLF, 1, 0, GI.SL_BALANCED))
registerGame(
    GameInfo(259, DeadKingGolf, "Dead King Golf", GI.GT_GOLF, 1, 0,
             GI.SL_BALANCED))
registerGame(
    GameInfo(260,
             RelaxedGolf,
             "Relaxed Golf",
             GI.GT_GOLF | GI.GT_RELAXED,
             1,
             0,
             GI.SL_BALANCED,
             altnames=("Putt Putt", )))
registerGame(
    GameInfo(40,
             Elevator,
        self.setSize(l.XM + 6*l.XS, l.YM + 7*l.YS)

        # create stacks
        x, y, = l.XM, l.YM
        s.talon = self.Talon_Class(x, y, self)
        l.createText(s.talon, "ss")
        x = x + 3*l.XS//2
        for i in range(4):
            s.rows.append(self.RowStack_Class(x, y, self))
            x = x + l.XS

        # define stack-groups
        l.defaultStackGroups()

    def startGame(self):
        self.s.talon.dealRow()

    def isGameWon(self):
        if self.s.talon.cards:
            return 0
        for row in self.s.rows:
            if not isSameSuitSequence(row.cards, dir=1):
                return 0
        return 1


# register the game
registerGame(GameInfo(555001, DaddyLonglegs, "Daddy Longlegs",
                      GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL,
                      rules_filename="daddylonglegs.html"))
Esempio n. 33
0
# ************************************************************************

class RelaxedLarasGame(LarasGame):
    Reserve_Class = LarasGame_Reserve
    Reserve_Cards = 1
    DEAL_TO_TALON = 3
    MAX_ROUNDS = 2


# ************************************************************************
# * Double Lara's Game
# ************************************************************************

class DoubleLarasGame(RelaxedLarasGame):
    Reserve_Cards = 2
    MAX_ROUNDS = 3

    def Max_Cards(self, i):
        return 26


# register the game

registerGame(GameInfo(37, LarasGame, "Lara's Game",
                      GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED,
                      altnames=("Thirteen Packs",)))
registerGame(GameInfo(13006, RelaxedLarasGame, "Lara's Game Relaxed",
                      GI.GT_2DECK_TYPE, 2, 1, GI.SL_BALANCED))
registerGame(GameInfo(13007, DoubleLarasGame, "Lara's Game Doubled",
                      GI.GT_2DECK_TYPE, 4, 2, GI.SL_BALANCED))