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


Python stack.AC_RowStack類代碼示例

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


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

示例1: createGame

    def createGame(self):

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

        # set window
        self.setSize(l.XM+10*l.XS, max(l.YM+2*l.YS+12*l.YOFFSET,
                                       l.YM+5*l.YS))

        # create stacks
        x = l.XM
        for i in range(2):
            y = l.YM+l.YS
            for j in range(4):
                s.foundations.append(SS_FoundationStack(x, y, self, suit=j))
                y += l.YS
            x += l.XS
        x, y = l.XM+2*l.XS, l.YM
        for i in range(8):
            stack = AC_RowStack(x, y, self, max_move=1)
            stack.getBottomImage = stack._getReserveBottomImage
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
            s.rows.append(stack)
            x += l.XS
        x, y = l.XM+2*l.XS, l.YM+l.YS
        for i in range(8):
            stack = OpenStack(x, y, self, max_accept=0)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
            s.reserves.append(stack)
            x += l.XS
        s.talon = KingsdownEights_Talon(l.XM, l.YM, self, max_rounds=1)
        l.createText(s.talon, "se")

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

示例2: createGame

    def createGame(self, max_rounds=2):

        l, s = Layout(self), self.s
        self.setSize(l.XM+8*l.XS, l.YM+4*l.YS)

        self.base_card = None

        i = 0
        for x, y in ((l.XM,        l.YM),
                     (l.XM+7*l.XS, l.YM),
                     (l.XM,        l.YM+3*l.YS),
                     (l.XM+7*l.XS, l.YM+3*l.YS),
                     ):
            s.foundations.append(
                SS_FoundationStack(x, y, self, suit=i, mod=13))
            i += 1
        y = l.YM+l.YS
        for i in range(2):
            x = l.XM+l.XS
            for j in range(6):
                stack = AC_RowStack(x, y, self, max_move=1, mod=13)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
                s.rows.append(stack)
                x += l.XS
            y += l.YS
        x, y = l.XM+3*l.XS, l.YM
        s.talon = WasteTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, 'sw')
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'se')

        l.defaultStackGroups()
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:33,代碼來源:windmill.py

示例3: createGame

    def createGame(self):

        l, s = Layout(self), self.s
        self.setSize(l.XM + 8*l.XS, l.YM + 4.5*l.YS)

        x, y = l.XM, l.YM
        for i in range(8):
            s.foundations.append(TheRedAndTheBlack_Foundation(x, y, self,
                                                              suit=i//2))
            x += l.XS
        x, y = l.XM+2*l.XS, l.YM+l.YS
        for i in range(4):
            stack = AC_RowStack(x, y, self, max_move=1)
            stack.getBottomImage = stack._getReserveBottomImage
            stack.CARD_YOFFSET = 0
            s.rows.append(stack)
            x += l.XS
        x, y = l.XM+2*l.XS, l.YM+2*l.YS
        for i in range(4):
            s.reserves.append(TheRedAndTheBlack_Reserve(x, y, self))
            x += l.XS
        x, y = l.XM+3*l.XS, l.YM+3.5*l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, "sw")
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, "se")

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

示例4: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not AC_RowStack.acceptsCards(self, from_stack, cards):
         return False
     if not self.cards:
         return (from_stack is self.game.s.talon or
                 from_stack in self.game.s.reserves)
     return True
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:7,代碼來源:bristol.py

示例5: moveMove

 def moveMove(self, ncards, to_stack, frames=-1, shadow=-1):
     state = self.game.getState()
     if state > 0:
         AC_RowStack.moveMove(
             self, ncards, to_stack, frames=frames, shadow=shadow)
         return
     assert to_stack in self.game.s.foundations
     assert ncards == 1
     assert not self.game.s.waste.cards
     self.game.moveMove(
         ncards, self, to_stack, frames=frames, shadow=shadow)
     for s in self.game.s.foundations:
         s.cap.base_rank = to_stack.cards[0].rank
     freerows = [s for s in self.game.s.rows if not s.cards]
     self.game.s.talon.dealRow(rows=freerows, sound=True)
     self.game.s.talon.dealCards()     # deal first card to WasteStack
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:16,代碼來源:terrace.py

示例6: acceptsCards

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

示例7: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not self.basicAcceptsCards(from_stack, cards):
         return 0
     stackcards = self.cards
     if stackcards:
         if (stackcards[-1].suit == 4 or cards[0].suit == 4):
             return stackcards[-1].rank == cards[0].rank + 1
     return AC_RowStack.acceptsCards(self, from_stack, cards)
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:8,代碼來源:hexadeck.py

示例8: canMoveCards

 def canMoveCards(self, cards):
     if self.game.base_rank is None:
         return False
     if not AC_RowStack.canMoveCards(self, cards):
         return False
     if len(cards) == 1 or len(self.cards) == len(cards):
         return True
     return False
開發者ID:voyageur,項目名稱:PySolFC,代碼行數:8,代碼來源:glenwood.py

示例9: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not AC_RowStack.acceptsCards(self, from_stack, cards):
         return False
     if not self.cards and from_stack is self.game.s.waste:
         for stack in self.game.s.reserves:
             if stack.cards:
                 return False
         return True
     if from_stack in self.game.s.rows and \
             len(cards) != len(from_stack.cards):
         return False
     return True
開發者ID:voyageur,項目名稱:PySolFC,代碼行數:12,代碼來源:glenwood.py

示例10: basicAcceptsCards

 def basicAcceptsCards(self, from_stack, cards):
     if from_stack in self.game.s.rows:
         if len(cards) != 1 and len(cards) != len(from_stack.cards):
             return False
     return AC_RowStack.basicAcceptsCards(self, from_stack, cards)
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:5,代碼來源:canfield.py

示例11: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if self.game.getState() == 0:
         return False
     if from_stack in self.game.s.reserves:
         return False
     return AC_RowStack.acceptsCards(self, from_stack, cards)
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:6,代碼來源:terrace.py

示例12: __init__

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

示例13: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not AC_RowStack.acceptsCards(self, from_stack, cards):
         return False
     if from_stack is self.game.s.waste:
         return False
     return True
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:6,代碼來源:royalcotillion.py

示例14: acceptsCards

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

示例15: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not AC_RowStack.acceptsCards(self, from_stack, cards):
         return False
     if self.cards:
         return len(cards) == 1
     return True
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:6,代碼來源:fortythieves.py


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