当前位置: 首页>>代码示例>>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;未经允许,请勿转载。