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


Python stack.BasicRowStack類代碼示例

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


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

示例1: createGame

    def createGame(self):

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

        y = l.YM
        suit = 0
        for i in (0, 1, 3, 4):
            x = l.XM+(2+i)*l.XS
            s.foundations.append(SS_FoundationStack(x, y, self, suit=suit))
            suit += 1

        x, y = l.XM+4*l.XS, l.YM
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
                                                    base_rank=KING, dir=-1))
            y += l.YS

        for i, j in ((0, 0), (1, 0), (2, 0), (5, 0), (6, 0), (7, 0),
                     (0, 1), (1, 1), (2, 1), (5, 1), (6, 1), (7, 1),
                     ):
            x, y = l.XM+(0.5+i)*l.XS, l.YM+(1.5+j)*l.YS
            stack = BasicRowStack(x, y, self, max_accept=0)
            s.rows.append(stack)
            stack.CARD_YOFFSET = 0

        x, y = l.XM, l.YM
        s.talon = DealRowRedealTalonStack(x, y, self, max_rounds=3)
        l.createText(s.talon, 'se')
        l.createRoundText(s.talon, 'ne')

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

示例2: createGame

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

        # set window
        w, h = max(2*l.XM+2*l.XS+(5+13)*l.XOFFSET, l.XM + 8*l.XS), l.YM+8*l.YS
        self.setSize(w, h)

        # create stacks
        x, y, = l.XM, l.YM
        for i in range(4):
            stack = BasicRowStack(x, y, self, max_move=1, max_accept=0)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
            s.rows.append(stack)
            y += l.YS
        x, y, = 2*l.XM+l.XS+5*l.XOFFSET, l.YM
        for i in range(4):
            stack = Osmosis_Foundation(
                x, y, self, i, base_rank=ANY_RANK, max_move=0)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
            s.foundations.append(stack)
            y += l.YS
        y = l.YM + 4*l.YS
        for i in range(4):
            x = l.XM
            for j in range(8):
                s.reserves.append(OpenStack(x, y, self, max_accept=0))
                x += l.XS
            y += l.YS

        x, y = w-l.XS, l.YM
        s.talon = InitialDealTalonStack(x, y, self)

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

示例3: createGame

    def createGame(self):

        l, s = Layout(self), self.s
        w0 = l.XS+5*l.XOFFSET
        self.setSize(l.XM+5*w0, l.YM+5*l.YS)

        x, y = l.XM, l.YM
        for i in range(3):
            s.reserves.append(TripleAlliance_Reserve(x, y, self))
            x += l.XS
        x, y = self.width-l.XS, l.YM
        s.foundations.append(AbstractFoundationStack(x, y, self, suit=ANY_SUIT,
                             max_move=0, max_accept=0, max_cards=52))
        l.createText(s.foundations[0], 'nw')
        y = l.YM+l.YS
        nstacks = 0
        for i in range(4):
            x = l.XM
            for j in range(5):
                stack = BasicRowStack(x, y, self, max_accept=0)
                s.rows.append(stack)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
                x += w0
                nstacks += 1
                if nstacks >= 18:
                    break
            y += l.YS

        x, y = self.width-l.XS, self.height-l.YS
        s.talon = InitialDealTalonStack(x, y, self)

        l.defaultStackGroups()
開發者ID:voyageur,項目名稱:PySolFC,代碼行數:32,代碼來源:pyramid.py

示例4: moveMove

 def moveMove(self, ncards, to_stack, frames=-1, shadow=-1):
     assert ncards == 1 and to_stack in self.game.s.rows
     if to_stack.cards:
         self._dropPairMove(ncards, to_stack, frames=-1, shadow=shadow)
     else:
         BasicRowStack.moveMove(
             self, ncards, to_stack, frames=frames, shadow=shadow)
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:7,代碼來源:montecarlo.py

示例5: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not BasicRowStack.acceptsCards(self, from_stack, cards):
         return False
     if self.id % self.game.RSTEP == 0:
         return cards[0].rank == self.game.RBASE
     left = self.game.s.rows[self.id - 1]
     return left.cards and left.cards[-1].rank + 1 == cards[0].rank
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:7,代碼來源:montana.py

示例6: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not BasicRowStack.acceptsCards(self, from_stack, cards):
         return False
     # check
     if self.cards or self.game.s.talon.cards:
         return False
     return True
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:7,代碼來源:picturegallery.py

示例7: acceptsCards

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

示例8: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not BasicRowStack.acceptsCards(self, from_stack, cards):
         return False
     if not self.cards:
         return True
     c1, c2 = self.cards[-1], cards[0]
     if c1.rank == c2.rank+1:
         return True
     return c1.rank == c2.rank
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:9,代碼來源:curdsandwhey.py

示例9: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not BasicRowStack.acceptsCards(self, from_stack, cards):
         return False
     if self.cards:
         # check the rank - an ACE equals a Six
         rank = self.cards[-1].rank
         if rank == ACE:
             rank = 5
         if (rank + self.cap.dir) % self.cap.mod != cards[0].rank:
             return False
     return True
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:11,代碼來源:gypsy.py

示例10: createGame

    def createGame(self):

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

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

        # create stacks
        x, y, = l.XM+2*l.XS, l.YM
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i))
            x = x + l.XS
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
                                                    base_rank=KING, dir=-1))
            x = x + l.XS
        x, y = l.XM+2*l.XS, 2*l.YM+l.YS
        for i in range(6):
            stack = BasicRowStack(x, y, self, max_move=1, max_accept=0)
            s.rows.append(stack)
            if not self.ROW_YOFFSET:
                stack.CARD_YOFFSET = 0
            x = x + l.XS

        x, y = l.XM, 2*l.YM+l.YS
        for i in range(4):
            self.s.reserves.append(ReserveStack(x, y, self))
            y += l.YS
        x, y = l.XM+9*l.XS, 2*l.YM+l.YS
        for i in range(4):
            self.s.reserves.append(ReserveStack(x, y, self))
            y += l.YS

        s.talon = Tournament_Talon(l.XM, l.YM, self, max_rounds=3)
        l.createText(s.talon, "se")
        l.createRoundText(s.talon, 'ne')

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

示例11: createGame

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

        # set window
        w, h = l.XM+max(
            max(rows)*(l.XS+3*l.XOFFSET), 9*l.XS), l.YM+(len(rows)+2)*l.YS
        self.setSize(w, h)

        # create stacks
        x, y = l.XM+(w-l.XM-8*l.XS)//2, l.YM
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i))
            x += l.XS
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self,
                                 base_rank=KING, suit=i, dir=-1))
            x += l.XS
        n = 0
        y = l.YM+l.YS
        for i in rows:
            x = l.XM
            for j in range(i):
                stack = BasicRowStack(x, y, self, max_move=1, max_accept=0)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
                s.rows.append(stack)
                x += l.XS+3*l.XOFFSET
                n += 1
            y += l.YS

        x, y = l.XM+(w-l.XM-8*l.XS)//2, h-l.YS
        for i in range(8):
            s.reserves.append(ReserveStack(x, y, self))
            x += l.XS
        s.talon = InitialDealTalonStack(w-l.XS, h-l.YS, self)

        # default
        l.defaultAll()
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:38,代碼來源:buffalobill.py

示例12: createGame

    def createGame(self, rows=4):
        # create layout
        max_rows = max(10, 4+rows)
        l, s = Layout(self), self.s

        # set window
        w, h = l.XM+max_rows*l.XS, l.YM+2*l.YS+18*l.YOFFSET
        self.setSize(w, h)

        # create stacks
        x, y = l.XM, l.YM
        s.talon = GrandDuchess_Talon(x, y, self, max_rounds=4)
        l.createText(s.talon, 'se')
        l.createRoundText(s.talon, 'ne')

        x += 2*l.XS
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i))
            x += l.XS
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self,
                                 suit=i, base_rank=KING, dir=-1))
            x += l.XS
        x, y = l.XM+(max_rows-rows)*l.XS//2, l.YM+l.YS
        for i in range(rows):
            stack = BasicRowStack(x, y, self, max_move=1, max_accept=0)
            stack.CARD_YOFFSET = l.YOFFSET
            s.rows.append(stack)
            x += l.XS
        dx = (max_rows-rows)*l.XS//4-l.XS//2
        x, y = l.XM+dx, l.YM+l.YS
        s.reserves.append(GrandDuchess_Reserve(x, y, self))
        x, y = self.width-dx-l.XS, l.YM+l.YS
        s.reserves.append(GrandDuchess_Reserve(x, y, self))

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

示例13: canMoveCards

 def canMoveCards(self, cards):
     if not BasicRowStack.canMoveCards(self, cards):
         return False
     c1 = cards[0]
     for c2 in cards[1:]:
         if c1.suit != c2.suit:
             return False
         # check the rank - an ACE equals a Six
         rank = c1.rank
         if rank == ACE:
             rank = 5
         if (rank + self.cap.dir) % self.cap.mod != c2.rank:
             return False
         c1 = c2
     return True
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:15,代碼來源:gypsy.py

示例14: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not BasicRowStack.acceptsCards(self, from_stack, cards):
         return False
     if self.id % 10 != 0:
         # left neighbour
         s = self.game.s.rows[self.id - 1]
         if s.cards and s.cards[-1].suit == cards[0].suit \
                 and (s.cards[-1].rank + 1) % 13 == cards[0].rank:
             return True
     if self.id % 10 != 10 - 1:
         # right neighbour
         s = self.game.s.rows[self.id + 1]
         if s.cards and s.cards[-1].suit == cards[0].suit \
                 and (s.cards[-1].rank - 1) % 13 == cards[0].rank:
             return True
     return False
開發者ID:shlomif,項目名稱:PySolFC,代碼行數:16,代碼來源:siebenbisas.py

示例15: acceptsCards

 def acceptsCards(self, from_stack, cards):
     if not BasicRowStack.acceptsCards(self, from_stack, cards):
         return False
     # this stack accepts any one card from the Waste pile
     return from_stack is self.game.s.waste
開發者ID:jimsize,項目名稱:PySolFC,代碼行數:5,代碼來源:camelot.py


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