當前位置: 首頁>>代碼示例>>Python>>正文


Python stack.SS_FoundationStack類代碼示例

本文整理匯總了Python中pysollib.stack.SS_FoundationStack的典型用法代碼示例。如果您正苦於以下問題:Python SS_FoundationStack類的具體用法?Python SS_FoundationStack怎麽用?Python SS_FoundationStack使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SS_FoundationStack類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: createGame

    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

        # set window
        self.setSize(l.XM + 5.5*l.XS, l.YM + 4*l.YS)

        # extra settings
        self.base_card = None

        # create stacks
        for i in range(4):
            dx, dy = ((0, 0), (2, 0), (0, 2), (2, 2))[i]
            x, y = l.XM + (2*dx+5)*l.XS//2, l.YM + (2*dy+1)*l.YS//2
            stack = SS_FoundationStack(x, y, self, i, mod=13, max_move=0)
            stack.CARD_YOFFSET = 0
            s.foundations.append(stack)
        for i in range(5):
            dx, dy = ((1, 0), (0, 1), (1, 1), (2, 1), (1, 2))[i]
            x, y = l.XM + (2*dx+5)*l.XS//2, l.YM + (2*dy+1)*l.YS//2
            stack = RK_RowStack(x, y, self, mod=13, max_move=1)
            stack.CARD_YOFFSET = 0
            s.rows.append(stack)
        x, y = l.XM, l.YM + 3*l.YS//2
        s.talon = WasteTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, "s")
        x = x + l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, "s")

        # define stack-groups
        l.defaultStackGroups()
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:32,代碼來源:royaleast.py

示例2: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if cards is None:
         # special hack for _getDropStack() below
         return SS_FoundationStack.acceptsCards(
             self, from_stack, from_stack.cards)
     #
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     # We only accept cards from a Reserve. Other cards will get
     # delivered by _handlePairMove.
     return from_stack in self.game.s.reserves
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:11,代碼來源:montecarlo.py

示例3: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if self.cards:
         # check suit
         return self.cards[-1].suit == cards[0].suit
     return True
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:7,代碼來源:gypsy.py

示例4: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if from_stack in self.game.s.rows:
         if len(self.game.s.talon.cards) == 0:
             return True
         return self.game.num_dealled <= 0
     return True
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:8,代碼來源:camelot.py

示例5: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if self.cards:
         # check the color
         if cards[0].color != self.cards[-1].color:
             return False
     return True
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:8,代碼來源:numerica.py

示例6: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if self.game.getState() == 0:
         if len(cards) != 1 or not cards[0].face_up:
             return False
         if cards[0].suit != self.cap.base_suit:
             return False
         return from_stack in self.game.s.rows
     return SS_FoundationStack.acceptsCards(self, from_stack, cards)
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:8,代碼來源:terrace.py

示例7: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if not self.cards:
         for s in self.game.s.foundations:
             if s.cards:
                 return cards[0].rank == s.cards[0].rank
     return True
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:8,代碼來源:beleagueredcastle.py

示例8: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if from_stack in self.game.s.reserves:
         return True
     for r in self.game.s.reserves:
         if not r.cards:
             return True
     return False
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:9,代碼來源:katzenschwanz.py

示例9: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     # this stack accepts only a card from a rowstack with an empty
     # left neighbour
     if from_stack not in self.game.s.rows:
         return False
     if from_stack.id % 10 == 0:
         return False
     return len(self.game.s.rows[from_stack.id - 1].cards) == 0
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:10,代碼來源:siebenbisas.py

示例10: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if not self.cards:
         return True
     if self.game.s.talon.cards:
         if from_stack in self.game.s.rows[4:]:
             i = list(self.game.s.foundations).index(self)
             j = list(self.game.s.rows).index(from_stack)
             return i == j-4
     return True
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:11,代碼來源:sthelena.py

示例11: createGame

    def createGame(self, reserves=6):

        l, s = Layout(self), self.s
        w, h = 3*l.XM+5*l.XS, l.YM+5*l.YS
        self.setSize(w, h)

        lay = ((0, 2, 0, QUEEN, -1),
               (0, 1, 0, QUEEN, -1),
               (0, 0, 1, QUEEN, -1),
               (2, 0, 1, QUEEN, -1),
               (1, 0, 2, QUEEN, -1),
               (2, 1, 3, QUEEN, -1),
               (2, 2, 3, QUEEN, -1),
               (1, 1, 2, KING, 1),
               )
        for xx, yy, suit, base_rank, dir in lay:
            x, y = 2*l.XM+l.XS+xx*l.XS, l.YM+yy*l.YS
            stack = SS_FoundationStack(x, y, self, suit=suit,
                                       max_move=0, base_rank=base_rank,
                                       dir=dir, mod=13)
            s.foundations.append(stack)

        for x, y in ((l.XM,          l.YM),
                     (3*l.XM+4*l.XS, l.YM)):
            for i in range(5):
                stack = RK_RowStack(x, y, self, dir=1,
                                    base_rank=NO_RANK,
                                    max_move=1, mod=13)
                stack.CARD_YOFFSET = 0
                s.rows.append(stack)
                y += l.YS

        x, y = 2*l.XM+1.5*l.XS, l.YM+4*l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, 'n')
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'n')

        l.defaultStackGroups()
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:40,代碼來源:sultan.py

示例12: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return 0
     return cards[-1].rank < len(self.game.s.foundations[4].cards)
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:4,代碼來源:tarock.py

示例13: __init__

 def __init__(self, x, y, game, suit, **cap):
     kwdefault(cap, mod=13, min_cards=1, max_move=0, base_rank=ANY_RANK)
     SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:3,代碼來源:beleagueredcastle.py

示例14: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     index = list(self.game.s.foundations).index(self)
     index %= 8
     return len(self.game.s.foundations[index].cards) > 0
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:6,代碼來源:sultan.py

示例15: getBaseCard

 def getBaseCard(self):
     if self.game.getState() == 0:
         return _('Base card - %s.') % _('any card')
     return SS_FoundationStack.getBaseCard(self)
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:4,代碼來源:terrace.py


注:本文中的pysollib.stack.SS_FoundationStack類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。