Example #1
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()
Example #2
0
    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()
Example #3
0
    def createGame(self):

        l, s = Layout(self), self.s
        h0 = l.YS+3*l.YOFFSET
        self.setSize(l.XM+10*l.XS, l.YM+l.YS+l.TEXT_HEIGHT+2*h0)

        x, y = l.XM, l.YM
        s.talon = WasteTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, 's')
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 's')

        x += l.XS
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i % 4))
            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+l.TEXT_HEIGHT
        for i in range(2):
            x = l.XM
            for j in range(10):
                s.rows.append(DoubleLine_RowStack(x, y, self, max_cards=2,
                              max_move=1, max_accept=1, base_rank=NO_RANK))
                x += l.XS
            y += h0

        l.defaultStackGroups()
Example #4
0
    def createGame(self):
        l, s = Layout(self), self.s

        # Set window size
        h = max(5 * l.YS, 20 * l.YOFFSET)
        self.setSize(l.XM + 9 * l.XS, l.YM + l.YS + h)

        # Create foundations
        x = self.width - l.XS
        y = l.YM
        s.foundations.append(SS_FoundationStack(x, y, self, 4, max_cards=22))
        y = y + l.YS
        for i in range(4):
            s.foundations.append(
                SS_FoundationStack(x, y, self, i, max_cards=14))
            y = y + l.YS

        # Create rows
        x = l.XM
        y = l.YM
        for j in range(2):
            for i in range(8):
                s.rows.append(Excuse_RowStack(x, y, self,
                              max_move=1, max_accept=1, base_rank=NO_RANK))
                x = x + l.XS
            x = l.XM
            y = y + l.YS * 3
        self.setRegion(s.rows, (-999, -999, l.XM + l.XS * 8, 999999))

        # Create talon
        s.talon = InitialDealTalonStack(l.XM, self.height-l.YS, self)

        # Define stack groups
        l.defaultStackGroups()
Example #5
0
    def createGame(self, max_rounds=2):

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

        y = l.YM
        for i in range(2):
            x = l.XM
            for j in range(4):
                s.foundations.append(SS_FoundationStack(x, y, self,
                                     suit=j, base_rank=6, max_cards=7))
                x += l.XS
            y += l.YS
        for i in range(2):
            x = l.XM
            for j in range(4):
                s.foundations.append(SS_FoundationStack(x, y, self, suit=j,
                                     base_rank=5, dir=-1, max_cards=6))
                x += l.XS
            y += l.YS
        y = l.YM
        for i in range(3):
            x = l.XM+5*l.XS
            for j in range(3):
                s.rows.append(ReserveStack(x, y, self))
                x += l.XS
            y += l.YS
        x, y = l.XM+5*l.XS, l.YM+3*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')

        l.defaultStackGroups()
Example #6
0
    def createGame(self):

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

        x, y = l.XM, l.YM
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i))
            y += l.YS
        x, y = self.width - 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
        x, y = (self.width - l.XS) // 2, self.height - l.YS
        s.talon = DealRowTalonStack(x, y, self)
        l.createText(s.talon, 'se')
        y = l.YM
        for i in range(4):
            x = l.XM + l.XS * 3 // 2
            for j in range(6):
                stack = UD_SS_RowStack(x, y, self, base_rank=NO_RANK)
                s.rows.append(stack)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
                x += l.XS
            y += l.YS

        l.defaultStackGroups()
Example #7
0
    def createGame(self):

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

        x, y = l.XM, l.YM
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i//2,
                                 base_rank=4, dir=-1, mod=13, max_cards=6))
            x += l.XS
        x, y = l.XM, l.YM+l.YS
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i//2,
                                 base_rank=5, max_cards=7))
            x += l.XS

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

        l.defaultStackGroups()
Example #8
0
    def createGame(self):

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

        s.talon = Matrimony_Talon(l.XM, l.YM, self, max_rounds=17)
        l.createText(s.talon, 'se')
        l.createRoundText(s.talon, 'ne')

        x, y = l.XM+2*l.XS, l.YM
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
                                 base_rank=JACK, dir=-1, mod=13))
            x += l.XS
        x, y = l.XM+2*l.XS, l.YM+l.YS
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
                                 base_rank=QUEEN, dir=1, mod=13))
            x += l.XS
        y = l.YM+2*l.YS
        for i in range(2):
            x = l.XM
            for j in range(8):
                stack = LadyOfTheManor_RowStack(x, y, self, max_accept=0)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
                s.rows.append(stack)
                x += l.XS
            y += l.YS

        l.defaultStackGroups()
Example #9
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

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

        # create stacks
        x, y = l.XM, l.YM
        s.talon = DealRowTalonStack(x, y, self)
        l.createText(s.talon, 'se')
        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

        for y in (l.YM + l.YS, l.YM + 2 * l.YS + 5 * l.YOFFSET):
            x = l.XM
            for i in range(10):
                s.rows.append(
                    Twenty_RowStack(x,
                                    y,
                                    self,
                                    base_rank=ANY_RANK,
                                    max_accept=1))
                x += l.XS

        # define stack-groups
        l.defaultStackGroups()
Example #10
0
    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()
Example #11
0
    def createGame(self):
        l, s = Layout(self), self.s
        playcards = 10
        w0 = l.XS + (playcards - 1) * l.XOFFSET
        w, h = l.XM + max(self.COLS * w0, 9 * l.XS), \
            l.YM + (self.ROWS + 1) * l.YS + l.TEXT_HEIGHT
        self.setSize(w, h)
        x, y = l.XM, l.YM
        s.talon = Crescent_Talon(x, y, self, max_rounds=4)
        if self.SHOW_TALON_COUNT:
            l.createText(s.talon, 'ne')
        l.createRoundText(s.talon, 's')
        x, y = w - 8 * l.XS, 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, suit=i, base_rank=KING, dir=-1))
            x += l.XS
        y = l.YM + l.YS + l.TEXT_HEIGHT
        for i in range(self.ROWS):
            x = l.XM
            for j in range(self.COLS):
                stack = UD_SS_RowStack(x, y, self, base_rank=NO_RANK, mod=13)
                s.rows.append(stack)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
                x += w0
            y += l.YS
        self.s.internals.append(InvisibleStack(self))
        self.s.internals.append(InvisibleStack(self))

        l.defaultStackGroups()
Example #12
0
    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()
Example #13
0
    def createGame(self):

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

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

        x, y = l.XM + 4 * l.XS, l.YM
        r = list(range(11))
        for i in range(5, 0, -1):
            for j in r[i:-i]:
                x, y = l.XM + (j - 0.5) * l.XS, l.YM + (5 - i) * l.YS
                s.rows.append(BasicRowStack(x, y, self, max_accept=0))

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

        l.defaultStackGroups()
Example #14
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM + 8 * l.XS, l.YM + 2 * l.YS + 12 * l.YOFFSET)

        x, y = l.XM, l.YM
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i))
            s.foundations.append(
                SS_FoundationStack(x + 4 * l.XS,
                                   y,
                                   self,
                                   suit=i,
                                   base_rank=KING,
                                   dir=-1))
            x += l.XS
        x, y = l.XM, l.YM + l.YS
        s.talon = WasteTalonStack(x,
                                  y,
                                  self,
                                  max_rounds=UNLIMITED_REDEALS,
                                  num_deal=3)
        l.createText(s.talon, 'ne')
        y += l.YS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'ne')
        x, y = l.XM + 2 * l.XS, l.YM + l.YS
        for i in range(4):
            s.rows.append(AC_RowStack(x, y, self, base_rank=6))
            x += l.XS
        x += l.XS
        stack = OpenStack(x, y, self)
        s.reserves.append(stack)
        stack.CARD_YOFFSET = l.YOFFSET

        l.defaultStackGroups()
Example #15
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM + 6 * l.XS, l.YM + 2 * l.YS)

        x, y = l.XM, l.YM
        s.talon = WasteTalonStack(x,
                                  y,
                                  self,
                                  max_rounds=UNLIMITED_REDEALS,
                                  num_deal=3)
        l.createText(s.talon, 'ne')
        y += l.YS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'ne')

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

        l.defaultStackGroups()
Example #16
0
    def createGame(self, rows=12, round_text=True):

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

        # set window
        self.setSize(l.XM + rows * l.XS, l.YM + 2 * l.YS + 15 * l.YOFFSET)

        # create stacks
        x, y, = l.XM + (rows - 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, suit=i, base_rank=KING, dir=-1))
            x += l.XS
        x, y, = l.XM, y + l.YS
        for i in range(rows):
            s.rows.append(
                self.RowStack_Class(x, y, self, max_move=1, max_accept=1))
            x += l.XS
        s.talon = self.Talon_Class(l.XM, l.YM, self)
        if round_text:
            l.createRoundText(self.s.talon, 'ne')

        # define stack-groups
        l.defaultStackGroups()
Example #17
0
    def createGame(self):
        rows = 12

        l, s = Layout(self), self.s
        self.setSize(l.XM + rows * l.XS, l.YM + 3 * l.YS + 16 * l.YOFFSET)

        x, y = l.XM + (rows - 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, suit=i, base_rank=KING, dir=-1))
            x += l.XS

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

        x, y = l.XM, l.YM + 2 * l.YS
        for i in range(rows):
            s.rows.append(UD_SS_RowStack(x, y, self))
            x += l.XS

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

        l.defaultStackGroups()
Example #18
0
    def createGame(self):

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

        x, y = l.XM, l.YM + l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=3)
        l.createText(s.talon, 'ne')
        l.createRoundText(s.talon, 'nn')
        y += l.YS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'ne')

        x, y = l.XM + 1.5 * l.XS, l.YM
        for i in range(4):
            s.foundations.append(
                SS_FoundationStack(x, y, self, suit=i, max_cards=13))
            x += l.XS

        x = l.XM + 1.5 * l.XS
        y += l.YS
        for i in range(4):
            s.rows.append(
                AbstractFoundationStack(x,
                                        y,
                                        self,
                                        suit=i,
                                        max_cards=1,
                                        max_move=0,
                                        base_rank=QUEEN))
            x += l.XS

        x = l.XM + 1.5 * l.XS
        y += l.YS
        for i in range(4):
            s.rows.append(
                AbstractFoundationStack(x,
                                        y,
                                        self,
                                        suit=i,
                                        max_cards=1,
                                        max_move=0,
                                        base_rank=JACK))
            x += l.XS

        x = l.XM + 1.5 * l.XS
        y += l.YS
        for i in range(4):
            s.foundations.append(
                SS_FoundationStack(x,
                                   y,
                                   self,
                                   suit=i,
                                   mod=13,
                                   max_cards=11,
                                   base_rank=9,
                                   dir=-1))
            x += l.XS

        l.defaultStackGroups()
Example #19
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s
        # set window
        self.setSize(l.XM + 12 * l.XS, l.YM + 7 * l.YS)
        # create stacks
        s.talon = Parallels_TalonStack(l.XM, l.YM, self)
        l.createText(s.talon, 's')
        n = 0
        y = l.YM
        for i in range(7):
            x = l.XM + l.XS
            for j in range(10):
                stack = Parallels_RowStack(x, y, self, max_accept=0)
                stack.index = n
                s.rows.append(stack)
                n += 1
                x += l.XS
            y += l.YS
        x, y = l.XM, l.YM + l.YS + l.YS // 2
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i))
            y += l.YS
        x, y = l.XM + 11 * l.XS, l.YM + l.YS + l.YS // 2
        for i in range(4):
            s.foundations.append(
                SS_FoundationStack(x, y, self, suit=i, base_rank=KING, dir=-1))
            y += l.YS

        # define stack-groups
        l.defaultStackGroups()
Example #20
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

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

        # create stacks
        x, y = 2 * l.XM, l.YM + l.YS
        for i in range(8):
            s.rows.append(self.RowStack_Class(x, y, self))
            x += l.XS
        y = l.YM
        for i in range(4):
            x = l.XM + i * l.XS
            s.foundations.append(SS_FoundationStack(x, y, self, i, max_move=0))
            x += 2 * l.XM + 4 * l.XS
            s.foundations.append(
                SS_FoundationStack(x,
                                   y,
                                   self,
                                   i,
                                   base_rank=KING,
                                   max_move=0,
                                   dir=-1))

        s.talon = InitialDealTalonStack(w - l.XS, h - l.YS, self)

        # default
        l.defaultAll()
Example #21
0
    def createGame(self, rows=1, reserves=8, playcards=3):
        # create layout
        l, s = Layout(self), self.s

        # set window
        w, h = l.XM + 8 * l.XS, l.YM + 3.5 * l.YS + playcards * l.YOFFSET
        h += l.TEXT_HEIGHT
        self.setSize(w, h)

        # create stacks
        x, y, = l.XM, l.YM
        for i in range(4):
            s.foundations.append(
                SS_FoundationStack(x, y, self, suit=i, max_move=0))
            x = x + l.XS
        for i in range(4):
            s.foundations.append(
                SS_FoundationStack(x,
                                   y,
                                   self,
                                   suit=i,
                                   max_move=0,
                                   base_rank=KING,
                                   dir=-1))
            x = x + l.XS
        x, y, = l.XM + (8 - reserves) * l.XS / 2, y + l.YS
        for i in range(reserves):
            stack = OpenStack(x, y, self, max_accept=0)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
            s.reserves.append(stack)
            x = x + l.XS
        x, y = l.XM + (8 - 1 - rows) * l.XS / 2, self.height - l.YS
        s.talon = Alhambra_Talon(x, y, self, max_rounds=3)
        if rows == 1:
            l.createText(s.talon, 'sw')
        else:
            l.createText(s.talon, 'n')
        anchor = 'nn'
        if rows > 1:
            anchor = 'nnn'
        l.createRoundText(s.talon, anchor)

        x += l.XS
        for i in range(rows):
            stack = self.RowStack_Class(x, y, self, mod=13, max_accept=1)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
            s.rows.append(stack)
            x += l.XS
            if rows == 1:
                l.createText(stack, 'se')
            else:
                l.createText(stack, 'n')

        # define stack-groups (non default)
        l.defaultStackGroups()
Example #22
0
    def createGame(self):

        l, s = Layout(self), self.s
        playcards = 7
        w0 = l.XS + (playcards - 1) * l.XOFFSET
        w, h = l.XM + 3 * w0 + 4 * l.XS, l.YM + 6 * l.YS
        self.setSize(w, h)

        x1, x2 = l.XM, self.width - 2 * l.XS
        for i in range(2):
            y = l.YM
            for j in range(4):
                s.foundations.append(
                    SS_FoundationStack(x1, y, self, suit=j, dir=2,
                                       max_cards=7))
                s.foundations.append(
                    SS_FoundationStack(x2,
                                       y,
                                       self,
                                       base_rank=1,
                                       suit=j,
                                       dir=2,
                                       max_cards=6))
                y += l.YS
            x1 += l.XS
            x2 += l.XS

        x, y = l.XM + 3 * l.XS, l.YM
        for i in (0, 1):
            stack = SS_RowStack(x, y, self, max_move=1, base_rank=KING)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
            s.rows.append(stack)
            x += w0
        y = l.YM + l.YS
        for i in range(4):
            x = l.XM + 2 * l.XS
            for j in range(3):
                stack = SS_RowStack(x, y, self, max_move=1, base_rank=KING)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
                s.rows.append(stack)
                x += w0
            y += l.YS
        x, y = l.XM + 3 * l.XS, l.YM + 5 * l.YS
        for i in (0, 1):
            stack = SS_RowStack(x, y, self, max_move=1, base_rank=KING)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
            s.rows.append(stack)
            x += w0

        x, y = l.XM, self.height - l.YS
        s.talon = ForestGlade_Talon(x, y, self, max_rounds=3)
        l.createText(s.talon, 'ne')
        l.createRoundText(s.talon, 'se')

        l.defaultStackGroups()
Example #23
0
    def createGame(self, max_rounds=2):

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

        lay = (
            (1.5, 0),
            (2.5, 0.3),
            (3, 1.3),
            (2.5, 2.3),
            (1.5, 2.6),
            (0.5, 2.3),
            (0, 1.3),
            (0.5, 0.3),
        )

        suit = 0
        x0, y0 = l.XM + l.XS, l.YM
        for xx, yy in lay:
            x, y = x0 + xx * l.XS, y0 + yy * l.YS
            s.foundations.append(
                SS_FoundationStack(x,
                                   y,
                                   self,
                                   suit=suit // 2,
                                   base_rank=6,
                                   max_cards=7))
            suit += 1
        suit = 0
        x0, y0 = l.XM + 5 * l.XS, l.YM
        for xx, yy in lay:
            x, y = x0 + xx * l.XS, y0 + yy * l.YS
            s.foundations.append(
                SS_FoundationStack(x,
                                   y,
                                   self,
                                   suit=suit // 2,
                                   base_rank=5,
                                   dir=-1,
                                   max_cards=6))
            suit += 1

        x, y = l.XM, l.YM + 4 * l.YS
        for i in range(8):
            stack = BasicRowStack(x, y, self)
            stack.CARD_YOFFSET = 0
            s.rows.append(stack)
            x += l.XS

        x += l.XS
        s.talon = DealRowRedealTalonStack(x, y, self, max_rounds=2)
        l.createText(s.talon, 'nw')
        l.createRoundText(s.talon, 'sw')

        l.defaultStackGroups()
Example #24
0
 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
Example #25
0
    def createGame(self):

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

        for i, j in ((0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0),
                     (6, 1), (6, 2), (6, 3), (6, 4), (5, 4), (4, 4), (3, 4),
                     (2, 4), (1, 4), (0, 4), (0, 3), (0, 2), (0, 1)):
            x, y = l.XM + l.XS + i * l.XS, l.YM + j * l.YS
            stack = RegalFamily_RowStack(x,
                                         y,
                                         self,
                                         max_move=1,
                                         base_rank=NO_RANK)
            s.rows.append(stack)
            stack.CARD_YOFFSET = 0

        x, y = l.XM + 3 * l.XS, l.YM + l.YS
        for i in range(3):
            s.foundations.append(
                SS_FoundationStack(x,
                                   y,
                                   self,
                                   suit=i,
                                   base_rank=9,
                                   mod=13,
                                   dir=-1))
            s.foundations.append(
                SS_FoundationStack(x,
                                   y + 2 * l.YS,
                                   self,
                                   suit=i,
                                   base_rank=9,
                                   mod=13,
                                   dir=-1))
            x += l.XS
        x, y = l.XM + 3 * l.XS, l.YM + 2 * l.YS
        s.foundations.append(
            SS_FoundationStack(x, y, self, suit=3, base_rank=ACE, mod=13))
        x += 2 * l.XS
        s.foundations.append(
            SS_FoundationStack(x,
                               y,
                               self,
                               suit=3,
                               base_rank=JACK,
                               mod=13,
                               dir=-1))

        x, y = l.XM, l.YM + 2 * l.YS
        s.talon = DealRowTalonStack(x, y, self)
        l.createText(s.talon, 's')

        l.defaultStackGroups()
Example #26
0
 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
Example #27
0
    def createGame(self):
        l, s = Layout(self), self.s

        # Set window size
        self.setSize(l.XM + l.XS * 11.5, l.YM + l.YS * 5.5)

        # Create wheel
        xoffset = (1, 2, 3, 3.9, 3, 2, 1, 0, -1, -2, -3, -3.9, -3, -2, -1, 0,
                   -2, -1, 0, 1, 2)
        yoffset = (0.2, 0.5, 1.1, 2.2, 3.3, 3.9, 4.2, 4.4, 4.2, 3.9, 3.3, 2.2,
                   1.1, 0.5, 0.2, 0, 1.8, 2.1, 2.2, 2.4, 2.6)
        x = l.XM + l.XS * 4
        y = l.YM
        for i in range(21):
            x0 = x + xoffset[i] * l.XS
            y0 = y + yoffset[i] * l.YS
            s.rows.append(
                WheelOfFortune_RowStack(x0,
                                        y0,
                                        self,
                                        yoffset=l.CH / 4,
                                        max_cards=2,
                                        max_move=1,
                                        max_accept=1))
        self.setRegion(s.rows, (-999, -999, l.XS * 9, 999999))

        # Create foundations
        x = self.width - l.XS * 2
        y = l.YM
        s.foundations.append(SS_FoundationStack(x, y, self, 0, max_cards=14))
        x = x + l.XS
        s.foundations.append(SS_FoundationStack(x, y, self, 1, max_cards=14))
        y = y + l.YS
        s.foundations.append(SS_FoundationStack(x, y, self, 3, max_cards=14))
        x = x - l.XS
        s.foundations.append(SS_FoundationStack(x, y, self, 2, max_cards=14))
        x = x + l.XS * 0.5
        y = y + l.YS
        s.foundations.append(SS_FoundationStack(x, y, self, 4, max_cards=22))

        # Create talon
        x = self.width - l.XS
        y = self.height - l.YS * 1.5
        s.talon = WasteTalonStack(x, y, self, num_deal=2, max_rounds=1)
        l.createText(s.talon, "n")
        x = x - l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, "n")

        # Define stack groups
        l.defaultStackGroups()
Example #28
0
    def createGame(self):
        l, s = Layout(self), self.s

        # Set window size
        decks = self.gameinfo.decks
        self.setSize(2 * l.XM + (2 + 5 * decks) * l.XS, 3 * l.YM + 5 * l.YS)
        yoffset = min(l.YOFFSET, max(10, l.YOFFSET / 2))

        # Create talon
        x = l.XM
        y = l.YM
        s.talon = WasteTalonStack(x,
                                  y,
                                  self,
                                  num_deal=1,
                                  max_rounds=self.MAX_ROUNDS)
        l.createText(s.talon, "s")
        x = x + l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, "s")

        # Create foundations
        x = x + l.XM + l.XS
        for j in range(4):
            for i in range(decks):
                s.foundations.append(
                    SS_FoundationStack(x, y, self, j, max_cards=14))
                x = x + l.XS
        for i in range(decks):
            s.foundations.append(
                SS_FoundationStack(x, y, self, 4, max_cards=22))
            x = x + l.XS

        # Create reserve
        x = l.XM
        y = l.YM + l.YS + l.TEXT_HEIGHT
        s.reserves.append(OpenStack(x, y, self))
        s.reserves[0].CARD_YOFFSET = (l.YOFFSET, yoffset)[decks == 2]

        # Create rows
        x = x + l.XM + l.XS
        for i in range(decks):
            s.rows.append(TrumpOnly_RowStack(x, y, self, yoffset=yoffset))
            x = x + l.XS
        for i in range(4 * decks + 1):
            s.rows.append(Tarock_AC_RowStack(x, y, self))
            x = x + l.XS
        self.setRegion(s.rows, (-999, y - l.YS, 999999, 999999))

        # Define stack groups
        l.defaultStackGroups()
Example #29
0
    def createGame(self):

        l, s = Layout(self), self.s
        h0 = l.YS+4*l.YOFFSET
        self.setSize(l.XM+11*l.XS, l.YM+2*l.YS+2*h0)
        self.base_rank = ANY_RANK

        x, y = l.XM, l.YM
        s.talon = GrandmammasPatience_Talon(x, y, self)
        l.createText(s.talon, 'ne')

        x, y = self.width-4*l.XS, l.YM
        for i in range(4):
            s.foundations.append(
                SS_FoundationStack(
                    x, y, self, suit=i,
                    dir=-1, mod=13, max_move=0, base_rank=ANY_RANK))
            x += l.XS
        stack = s.foundations[0]
        tx, ty, ta, tf = l.getTextAttr(stack, "sw")
        font = self.app.getFont("canvas_default")
        stack.texts.misc = MfxCanvasText(
            self.canvas, tx, ty, anchor=ta, font=font)
        x, y = self.width-4*l.XS, self.height-l.YS
        for i in range(4):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
                                 mod=13, max_move=0, base_rank=ANY_RANK))
            x += l.XS
        stack = s.foundations[4]
        tx, ty, ta, tf = l.getTextAttr(stack, "sw")
        font = self.app.getFont("canvas_default")
        stack.texts.misc = MfxCanvasText(
            self.canvas, tx, ty, anchor=ta, font=font)

        y = l.YM+l.YS
        for i in range(2):
            x = l.XM
            for j in range(11):
                s.rows.append(GrandmammasPatience_RowStack(x, y, self,
                              max_accept=1, max_cards=2))
                x += l.XS
            y += h0

        x, y = l.XM, self.height-l.YS
        for i in range(4):
            s.reserves.append(ReserveStack(x, y, self))
            x += l.XS

        l.defaultStackGroups()
        self.sg.dropstacks.append(s.talon)
Example #30
0
    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()
Example #31
0
 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
Example #32
0
 def createGame(self, rows=12, max_rounds=2, XOFFSET=0):
     l, s = Layout(self), self.s
     self.setSize(l.XM + (rows + 2) * l.XS, l.YM + 8 * l.YS)
     x, y = l.XM, l.YM
     for i in range(rows):
         s.rows.append(self.RowStack_Class(x, y, self))
         x += l.XS
     for i in range(2):
         y = l.YM
         for j in range(8):
             s.foundations.append(SS_FoundationStack(x, y, self,
                                                     suit=j % 4))
             y += l.YS
         x += l.XS
     x, y = l.XM, self.height - l.YS
     s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds)
     l.createText(s.talon, 'n')
     x += l.XS
     s.waste = WasteStack(x, y, self)
     s.waste.CARD_XOFFSET = XOFFSET
     l.createText(s.waste, 'n')
     if max_rounds > 1:
         l.createRoundText(s.talon, 'nnn')
     self.setRegion(s.rows,
                    (-999, -999, l.XM + rows * l.XS - l.CW // 2, 999999),
                    priority=1)
     l.defaultStackGroups()
    def createGame(self, reserves=3, rows=5):
        # create layout
        l, s = Layout(self), self.s

        # set window
        w, h = l.XM + 11 * l.XS, l.YM + 6 * l.YS
        self.setSize(w, h)

        # create stacks
        x, y = w - l.XS, h - l.YS
        s.talon = Toad_TalonStack(x, y, self)
        l.createText(s.talon, "n")
        x, y = l.XM, l.YM
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i // 2))
            x += l.XS
        x, y = l.XM + 3 * l.XS // 2, l.YM + l.YS
        for i in range(5):
            s.rows.append(
                Gloaming_RowStack(x, y, self, max_accept=UNLIMITED_ACCEPTS))
            x += l.XS
        y = l.YM + l.YS // 2
        for i in (3, 3, 3, 3, 1):
            x = l.XM + 8 * l.XS
            for j in range(i):
                s.reserves.append(OpenStack(x, y, self, max_accept=0))
                x += l.XS
            y += l.YS

        # define stack-groups
        l.defaultStackGroups()
Example #34
0
 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
Example #35
0
 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
Example #36
0
 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
Example #37
0
 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)
Example #38
0
 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
Example #39
0
 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
Example #40
0
 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
Example #41
0
 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if self.game.s.talon.round == 1:
         if (self.cap.base_rank == KING and
                 from_stack in self.game.s.rows[6:10:]):
             return False
         if (self.cap.base_rank == ACE and
                 from_stack in self.game.s.rows[:4]):
             return False
     return True
Example #42
0
    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()
Example #43
0
 def acceptsCards(self, from_stack, cards):
     if self.game.getState() == 0:
         if cards[0].suit != self.cap.base_suit:
             return False
         return True
     return SS_FoundationStack.acceptsCards(self, from_stack, cards)
Example #44
0
 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[:8]:
         return True
     return False
Example #45
0
 def canMoveCards(self, cards):
     if not SS_FoundationStack.canMoveCards(self, cards):
         return False
     # can only move cards if the Talon is empty
     return len(self.game.s.talon.cards) == 0
Example #46
0
 def __init__(self, x, y, game, suit, **cap):
     kwdefault(cap, base_rank=suit, mod=13, dir=suit+1, max_move=0)
     SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
Example #47
0
 def __init__(self, x, y, game, suit, **cap):
     kwdefault(cap, max_move=0)
     SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
Example #48
0
 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)
Example #49
0
 def __init__(self, x, y, game, **cap):
     kwdefault(cap, base_suit=ANY_SUIT)
     SS_FoundationStack.__init__(self, x, y, game, ANY_SUIT, **cap)
Example #50
0
 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     # we only accept cards if there are no cards in the talon
     return len(self.game.s.talon.cards) == 0
Example #51
0
 def acceptsCards(self, from_stack, cards):
     if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
         return False
     if self.game.s.waste.cards or self.game.s.talon.cards:
         return False
     return True
Example #52
0
 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)
Example #53
0
 def getBaseCard(self):
     if self.game.getState() == 0:
         return _('Base card - %s.') % _('any card')
     return SS_FoundationStack.getBaseCard(self)
Example #54
0
 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