Exemplo n.º 1
0
    def createGame(self):
        # create layout
        layout, s = Layout(self), self.s

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

        # create stacks
        x, y = layout.XM, layout.YM
        for i in range(2):
            x = layout.XM
            for j in range(5):
                s.rows.append(Giza_Reserve(x, y, self, max_accept=1))
                x += layout.XS
            y += layout.YS
        x, y = layout.XM, self.height-layout.YS
        s.talon = TalonStack(x, y, self)
        layout.createText(s.talon, 'n')
        x, y = self.width-layout.XS, self.height-layout.YS
        s.foundations.append(Pyramid_Foundation(x, y, self,
                             suit=ANY_SUIT, dir=0, base_rank=ANY_RANK,
                             max_move=0, max_cards=52))
        layout.createText(s.foundations[0], 'n')

        # define stack-groups
        layout.defaultStackGroups()
Exemplo n.º 2
0
    def createGame(self, rows=3, columns=6):
        layout, s = Layout(self), self.s
        decks = self.gameinfo.decks
        maxrows = max(columns, 2+decks*4)
        self.setSize(layout.XM+maxrows*layout.XS, layout.YM+(rows+1)*layout.YS)

        x, y = layout.XM, layout.YM
        s.talon = TalonStack(x, y, self)
        layout.createText(s.talon, 'ne')

        x, y = layout.XM+2*layout.XS, layout.YM
        for found in self.Foundation_Classes:
            for i in range(4):
                s.foundations.append(found(x, y, self, suit=i))
                x += layout.XS

        y = layout.YM+layout.YS
        for i in range(rows):
            x = layout.XM + (maxrows-columns)*layout.XS//2
            for j in range(columns):
                s.rows.append(Vague_RowStack(x, y, self))
                x += layout.XS
            y += layout.YS

        layout.defaultStackGroups()
Exemplo n.º 3
0
    def createGame(self, rows=5, reserves=4, playcards=15):
        # create layout
        l, s = Layout(self), self.s

        # set window
        self.setSize(l.XM + 8 * l.XS, l.YM + 3 * l.YS + playcards * l.YOFFSET)

        # create stacks
        x, y = l.XM, l.YM
        for i in range(4):
            for j in range(2):
                s.foundations.append(
                    RK_FoundationStack(x, y, self, suit=ANY_SUIT))
                x += l.XS
        x, y = l.XM + (8 - rows) * l.XS // 2, l.YM + l.YS
        for i in range(rows):
            s.rows.append(Gloaming_RowStack(x, y, self, max_accept=1))
            x += l.XS

        x, y = l.XM + (8 - reserves - 1) * l.XS // 2, self.height - l.YS
        for i in range(reserves):
            s.reserves.append(OpenStack(x, y, self, max_accept=0))
            x += l.XS

        s.talon = TalonStack(x, y, self)
        l.createText(s.talon, 'n')

        # define stack-groups
        l.defaultStackGroups()
Exemplo n.º 4
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

        # set window
        # (set size so that at least 7 cards are fully playable)
        dx = l.XM+l.XS+7*l.XOFFSET
        w = l.XM+max(5*dx, 9*l.XS+2*l.XM)
        h = l.YM+6*l.YS
        self.setSize(w, h)

        # create stacks
        x, y = l.XM, l.YM
        s.talon = TalonStack(x, y, self)
        l.createText(s.talon, "se")
        x = max(l.XS+3*l.XM, (self.width-l.XM-8*l.XS)//2)
        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
        y = l.YM+l.YS
        for i in range(5):
            x = l.XM
            for j in range(5):
                stack = UD_SS_RowStack(x, y, self)
                s.rows.append(stack)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
                x += dx
            y += l.YS

        # define stack-groups
        l.defaultStackGroups()
Exemplo n.º 5
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM + 12 * l.XS, l.YM + 3 * l.YS + 3 * l.YOFFSET)

        x, y = l.XM, l.YM
        for i in range(12):
            s.rows.append(
                Nestor_RowStack(x,
                                y,
                                self,
                                max_move=1,
                                max_accept=1,
                                dir=0,
                                base_rank=NO_RANK))
            x += l.XS
        x, y = l.XM, self.height - l.YS
        s.talon = TalonStack(x, y, self)
        l.createText(s.talon, 'n')

        x, y = self.width - l.XS, self.height - l.YS
        s.foundations.append(
            AbstractFoundationStack(x,
                                    y,
                                    self,
                                    suit=ANY_SUIT,
                                    max_move=0,
                                    max_cards=52,
                                    base_rank=ANY_RANK,
                                    max_accept=0))
        l.createText(s.foundations[0], "n")

        l.defaultStackGroups()
Exemplo n.º 6
0
    def createGame(self, rows=8):
        # create layout
        layout, s = Layout(self), self.s

        # set window
        playcards = 12
        self.setSize(
            layout.XM+rows*layout.XS,
            layout.YM+3*layout.YS+playcards*layout.YOFFSET)

        # create stacks
        x, y = layout.XM + (rows-1)*layout.XS//2, layout.YM
        stack = RK_FoundationStack(x, y, self, base_rank=ANY_RANK,
                                   max_cards=52, mod=13)
        s.foundations.append(stack)
        layout.createText(stack, 'ne')

        x, y = layout.XM, layout.YM+layout.YS
        for i in range(rows):
            s.rows.append(RK_RowStack(x, y, self, base_rank=NO_RANK, mod=13))
            x += layout.XS

        x, y = layout.XM, self.height-layout.YS
        s.talon = TalonStack(x, y, self)
        layout.createText(s.talon, 'se')

        # define stack-groups
        layout.defaultStackGroups()
Exemplo n.º 7
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

        # set window
        ww = l.XS + max(2 * l.XOFFSET, l.XS // 2)
        w = l.XM + 1.5 * l.XS + 4 * ww
        h = l.YM + 3 * l.YS
        self.setSize(w, h)

        # create stacks
        for xx, yy in (
            (0, 0),
            (1, 0),
            (2, 0),
            (3, 0),
            (0, 1),
            (3, 1),
            (0, 2),
            (1, 2),
            (2, 2),
            (3, 2),
        ):
            x, y = l.XM + 1.5 * l.XS + ww * xx, l.YM + l.YS * yy
            stack = Hurricane_Reserve(x, y, self, max_accept=1)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
            s.reserves.append(stack)

        d = 3 * ww - 4 * l.XS - 2 * l.XOFFSET
        x = l.XM + 1.5 * l.XS + l.XS + 2 * l.XOFFSET + d // 2
        y = l.YM + l.YS
        for i in range(3):
            stack = Hurricane_RowStack(x, y, self, max_accept=1)
            s.rows.append(stack)
            x += l.XS

        x, y = l.XM, l.YM
        s.talon = TalonStack(x, y, self)
        l.createText(s.talon, 'ne')
        y += 2 * l.YS
        s.foundations.append(
            AbstractFoundationStack(x,
                                    y,
                                    self,
                                    suit=ANY_SUIT,
                                    dir=0,
                                    base_rank=ANY_RANK,
                                    max_accept=0,
                                    max_move=0,
                                    max_cards=52))
        l.createText(s.foundations[0], 'ne')

        # define stack-groups
        l.defaultStackGroups()
Exemplo n.º 8
0
 def createGame(self, rows=12):
     l, s = Layout(self), self.s
     self.setSize(l.XM + (rows + 1) * l.XS, l.YM + l.YS + 12 * l.YOFFSET)
     x, y = l.XM, l.YM
     s.talon = TalonStack(x, y, self)
     l.createText(s.talon, "s")
     x += l.XS
     for i in range(rows):
         s.rows.append(RK_RowStack(x, y, self, max_move=1))
         x += l.XS
     l.defaultStackGroups()
Exemplo n.º 9
0
 def createGame(self):
     l, s = Layout(self), self.s
     self.setSize(l.XM + 9 * l.XS, l.YM + 2 * l.YS + 20 * l.YOFFSET)
     x, y = l.XM, l.YM
     s.talon = TalonStack(x, y, self)
     l.createText(s.talon, "s")
     y = l.YM
     for i in range(2):
         x = l.XM + l.XS
         for j in range(8):
             s.rows.append(AC_RowStack(x, y, self, max_move=1))
             x += l.XS
         y += l.YS + 10 * l.YOFFSET
     l.defaultStackGroups()
Exemplo n.º 10
0
    def createGame(self, rows=3, cols=3, reserves=3, texts=False):

        l, s = Layout(self), self.s

        self.setSize(l.XM + (cols + 2) * l.XS, l.YM + (rows + 1.5) * l.YS)

        x, y = self.width - l.XS, l.YM
        s.talon = TalonStack(x, y, self)
        l.createText(s.talon, 's')
        x, y = self.width - l.XS, self.height - l.YS
        s.foundations.append(
            AbstractFoundationStack(x,
                                    y,
                                    self,
                                    suit=ANY_SUIT,
                                    max_accept=0,
                                    max_move=0,
                                    max_cards=52))
        l.createText(s.foundations[0], 'n')
        y = l.YM
        for i in range(rows):
            x = l.XM
            for j in range(cols):
                s.rows.append(self.RowStack_Class(x, y, self, max_accept=1))
                x += l.XS
            y += l.YS
        x, y = l.XM, self.height - l.YS
        for i in range(reserves):
            stack = self.Reserve_Class(x, y, self)
            s.reserves.append(stack)
            stack.CARD_XOFFSET = l.XOFFSET  # for fifteens
            x += l.XS

        if texts:
            stack = s.reserves[0]
            tx, ty, ta, tf = l.getTextAttr(stack, "n")
            font = self.app.getFont("canvas_default")
            stack.texts.misc = MfxCanvasText(self.canvas,
                                             tx,
                                             ty,
                                             anchor=ta,
                                             font=font)

        l.defaultStackGroups()
Exemplo n.º 11
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

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

        # create stacks
        for i in range(3):
            for j in range(3):
                x, y = l.XM + (2 * j + 3) * l.XS / 2, l.YM + (2 * i +
                                                              1) * l.YS / 2
                s.rows.append(
                    self.RowStack_Class(x,
                                        y,
                                        self,
                                        max_accept=1,
                                        max_cards=2,
                                        dir=0,
                                        base_rank=NO_RANK))
        x, y = l.XM, l.YM + 3 * l.YS / 2
        s.talon = TalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, "s")
        x = x + 5 * l.XS
        s.foundations.append(
            self.Foundation_Class(x,
                                  y,
                                  self,
                                  suit=ANY_SUIT,
                                  max_move=0,
                                  max_cards=52,
                                  base_rank=ANY_RANK))
        l.createText(s.foundations[0], "s")

        # define stack-groups
        l.defaultStackGroups()
Exemplo n.º 12
0
    def createGame(self, rows=3, columns=6):
        layout, s = Layout(self), self.s
        decks = self.gameinfo.decks
        maxrows = max(columns, 2 + decks * 4)
        self.setSize(layout.XM + maxrows * layout.XS,
                     layout.YM + (rows + 1) * layout.YS)

        x, y = layout.XM, layout.YM
        s.talon = TalonStack(x, y, self)
        layout.createText(s.talon, 'ne')

        x, y = layout.XM + 2 * layout.XS, layout.YM
        for found in self.Foundation_Classes:
            if self.SEPARATE_FOUNDATIONS:
                for i in range(4):
                    s.foundations.append(found(x, y, self, suit=i))
                    x += layout.XS
            else:
                s.foundations.append(found(x, y, self, suit=ANY_SUIT))
                if self.SPREAD_FOUNDATION:
                    w1, w2 = 6 * layout.XS + layout.XM, 2 * layout.XS

                    totalcards = self.gameinfo.ncards
                    if w2 + totalcards * layout.XOFFSET > w1:
                        layout.XOFFSET = int((w1 - w2) / totalcards)
                    s.foundations[0].CARD_XOFFSET = layout.XOFFSET

        y = layout.YM + layout.YS
        for i in range(rows):
            x = layout.XM + (maxrows - columns) * layout.XS // 2
            for j in range(columns):
                s.rows.append(Vague_RowStack(x, y, self))
                x += layout.XS
            y += layout.YS

        layout.defaultStackGroups()
Exemplo n.º 13
0
 def clickHandler(self, event):
     if self.cards:
         return OpenStack.clickHandler(self, event)
     else:
         return TalonStack.clickHandler(self, event)
Exemplo n.º 14
0
 def clickHandler(self, event):
     if self.cards:
         return OpenStack.clickHandler(self, event)
     else:
         return TalonStack.clickHandler(self, event)