Beispiel #1
0
    def createGame(self):

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

        self.setSize(l.XM+10*l.XS, l.YM+2*l.YS+12*l.YOFFSET+l.TEXT_HEIGHT)

        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(8):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i%4,
                                                    max_cards=12))
            x += l.XS
        x, y = l.XM, l.YM+l.YS+l.TEXT_HEIGHT
        s.foundations.append(RK_FoundationStack(x, y, self, suit=ANY_SUIT,
                             base_rank=KING, dir=0, max_cards=8))
        x += 3*l.XS
        for i in range(6):
            s.rows.append(RK_RowStack(x, y, self, max_move=1))
            x += l.XS

        l.defaultStackGroups()
Beispiel #2
0
    def createGame(self):

        l, s = Layout(self), self.s
        self.setSize(l.XM+7*l.XS, l.YM+2*l.YS+20*l.YOFFSET)

        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 += 3.5*l.XS
        s.foundations.append(FourByFour_Foundation(x, y, self,
                             suit=ANY_SUIT, base_rank=ANY_RANK, max_cards=52,
                             max_accept=1, max_move=0, mod=13))
        stack = s.foundations[0]
        tx, ty, ta, tf = l.getTextAttr(stack, 'ne')
        font = self.app.getFont('canvas_default')
        stack.texts.misc = MfxCanvasText(self.canvas, tx, ty,
                                         anchor=ta, font=font)

        x, y = l.XM+3*l.XS, l.YM+l.YS
        for i in range(4):
            stack = UD_RK_RowStack(x, y, self, mod=13)
            stack.getBottomImage = stack._getReserveBottomImage
            s.rows.append(stack)
            x += l.XS

        l.defaultStackGroups()
Beispiel #3
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()
Beispiel #4
0
    def createGame(self):

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

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

        x, y = l.XM, l.YM
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self,
                                 suit=i/2, base_rank=KING, mod=13))
            x += l.XS
        x, y = l.XM, l.YM+l.YS
        s.talon = TheSpark_Talon(x, y, self, max_rounds=1, num_deal=3)
        l.createText(s.talon, 'se')
        y += l.YS
        for i in (0,1):
            stack = WasteStack(x, y, self)
            s.reserves.append(stack)
            l.createText(stack, 'se')
            y += l.YS
        y = l.YM+l.YS*3/2
        for i in range(2):
            x = l.XM+2*l.XS
            for j in range(6):
                stack = SS_RowStack(x, y, self, max_move=1)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
                s.rows.append(stack)
                x += l.XS
            y += l.YS

        l.defaultStackGroups()
Beispiel #5
0
    def createGame(self):
        l, s = Layout(self), self.s

        self.setSize(l.XM+12*l.XS, l.YM+max(4.5*l.YS, 2*l.YS+12*l.YOFFSET))

        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 += 2*l.XS
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i/2))
            x += l.XS
        x, y = l.XM, l.YM+l.YS*3/2
        for i in range(3):
            s.reserves.append(ReserveStack(x, y, self))
            y += l.YS
        x, y = l.XM+2*l.XS, l.YM+l.YS
        for i in range(10):
            s.rows.append(SS_RowStack(x, y, self, max_move=1))
            x += l.XS

        l.defaultStackGroups()
Beispiel #6
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 = 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()
Beispiel #7
0
    def createGame(self, rows=13):

        l, s = Layout(self), self.s
        w, h = l.XM+(rows+2)*l.XS, l.YM+max(l.YS+24*l.YOFFSET, 9*l.YS)
        self.setSize(w, h)

        x, y = l.XM, l.YM
        for i in range(rows):
            s.rows.append(self.RowStack_Class(x, y, self))
            x += l.XS
        l.setRegion(s.rows, (-999, -999, l.XM+rows*l.XS-l.CW/2, 999999))
        x = l.XM+rows*l.XS
        for i in range(2):
            y = l.YM
            for j in range(8):
                s.foundations.append(self.Foundation_Class(x, y, self))
                y += l.YS
            x += l.XS

        x, y = w-1.5*l.XS, h-l.YS
        s.talon = self.Talon_Class(x, y, self)
        l.createText(s.talon, 'sw')

        l.defaultStackGroups()
        l.defaultRegions()
Beispiel #8
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()
Beispiel #9
0
    def createGame(self):

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

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

        # create stacks
        x, y = l.XM, l.YM
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self,
                                                    suit=i/2, max_cards=10))
            x += l.XS

        y = l.YM+l.YS
        for i in range(3):
            x = l.XM
            for j in range(8):
                ##stack = SS_RowStack(x, y, self, max_move=1)
                stack = ReserveStack(x, y, self)
                stack.CARD_YOFFSET = 0
                s.rows.append(stack)
                x += l.XS
            y += l.YS

        x, y = self.width-l.XS, self.height-l.YS
        s.talon = DealRowTalonStack(x, y, self)
        l.createText(s.talon, 'sw')

        # define stack-groups
        l.defaultStackGroups()
Beispiel #10
0
    def createGame(self):

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

        x, y = l.XM+l.XS, l.YM
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i%4,
                                 base_rank=JACK, dir=-1, max_cards=11))
            x += l.XS
        x, y = l.XM+l.XS, l.YM+l.YS
        for i in range(8):
            s.foundations.append(Adela_Foundation(x, y, self, suit=i%4,
                                 base_rank=QUEEN, max_cards=1))
            x += l.XS
        x, y = l.XM+l.XS, l.YM+2*l.YS
        for i in range(8):
            s.foundations.append(Adela_Foundation(x, y, self, suit=i%4,
                                 base_rank=KING, max_cards=1))
            x += l.XS
        x, y = l.XM, l.YM+l.YS
        s.talon = DealRowTalonStack(x, y, self)
        l.createText(s.talon, 'n')
        x, y = l.XM+l.XS/2, l.YM+3*l.YS
        for i in range(9):
            stack = SS_RowStack(x, y, self, max_move=1, dir=1)
            s.rows.append(stack)
            stack.CARD_YOFFSET = 0
            x += l.XS
            
        l.defaultStackGroups()
Beispiel #11
0
    def createGame(self):

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

        for i, j in ((1,0),
                     (2,0),
                     (3,0),
                     (4,1.5),
                     (3,3),
                     (2,3),
                     (1,3),
                     (0,1.5),
                     ):
            x, y = l.XM+i*l.XS, l.YM+j*l.YS
            stack = RK_RowStack(x, y, self, dir=1, mod=13, max_move=0)
            s.rows.append(stack)
            stack.CARD_YOFFSET = 0

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

        l.defaultStackGroups()
Beispiel #12
0
    def createGame(self):

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

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

        # create stacks
        x, y = l.XM, l.YM+l.YS//2
        for i in (0, 1):
            stack = ReserveStack(x, y, self, max_cards=4)
            s.reserves.append(stack)
            stack.CARD_YOFFSET = l.YOFFSET
            l.createText(stack, 'n')
            x += l.XS

        x, y = l.XM+2.5*l.XS, 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+2.5*l.XS, l.YM+l.YS
        for i in range(8):
            s.rows.append(AC_RowStack(x, y, self))
            x += l.XS

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

        # define stack-groups
        l.defaultStackGroups()
Beispiel #13
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()
Beispiel #14
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM+13*l.XS, l.YM+7*l.YS)
        self.base_rank = ANY_RANK

        x, y = l.XM+2.5*l.XS, l.YM
        for i in range(8):
            s.foundations.append(StepUp_Foundation(x, y, self,
                                 suit=i%4, mod=13, base_rank=ANY_RANK))
            x += l.XS
        tx, ty, ta, tf = l.getTextAttr(s.foundations[0], "sw")
        font = self.app.getFont("canvas_default")
        self.texts.info = MfxCanvasText(self.canvas, tx, ty,
                                        anchor=ta, font=font)

        x, y = l.XM, l.YM+l.YS
        for i in range(13):
            s.reserves.append(ReserveStack(x, y, self))
            x += l.XS
        x, y = l.XM+2*l.XS, l.YM+2*l.YS
        for i in range(9):
            s.rows.append(StepUp_RowStack(x, y, self, max_move=1, mod=13))
            x += l.XS

        x, y = l.XM, l.YM+2.5*l.YS
        s.talon = StepUp_Talon(x, y, self, max_rounds=1)
        l.createText(s.talon, 'se')
        y += l.YS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'se')

        l.defaultStackGroups()
Beispiel #15
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM+9*l.XS, l.YM+4*l.YS)

        x, y = l.XM, l.YM
        s.talon = SlyFox_Talon(x, y, self)
        s.waste = s.talon
        l.createText(s.talon, 'ne')
        tx, ty, ta, tf = l.getTextAttr(s.talon, "ss")
        font = self.app.getFont("canvas_default")
        self.texts.misc = MfxCanvasText(self.canvas, tx, ty,
                                        anchor=ta, font=font)

        y = l.YM
        for i in range(4):
            x = l.XM+1.5*l.XS
            for j in range(5):
                stack = SlyFox_RowStack(x, y, self, max_cards=UNLIMITED_CARDS)
                stack.CARD_YOFFSET = 0
                s.rows.append(stack)
                x += l.XS
            y += l.YS

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

        l.defaultStackGroups()
Beispiel #16
0
    def createGame(self):
        playcards = 6

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

        x, y = l.XM, l.YM
        s.talon = SlyFox_Talon(x, y, self)
        s.waste = s.talon
        l.createText(s.talon, 'ne')
        tx, ty, ta, tf = l.getTextAttr(s.talon, "ss")
        font = self.app.getFont("canvas_default")
        self.texts.misc = MfxCanvasText(self.canvas, tx, ty,
                                        anchor=ta, font=font)

        x += 2*l.XS
        for i in range(4):
            s.foundations.append(SlyFox_Foundation(x, y, self, suit=i))
            s.foundations.append(SlyFox_Foundation(x+4*l.XS, 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):
                stack = SlyFox_RowStack(x, y, self, max_cards=UNLIMITED_CARDS)
                s.rows.append(stack)
                stack.CARD_YOFFSET = l.YOFFSET
                x += l.XS
            y += l.YS+playcards*l.YOFFSET

        l.defaultStackGroups()
Beispiel #17
0
    def createGame(self):

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

        w, h = l.XM+8*l.XS, 2*l.YM+3*l.YS
        self.setSize(w, h)

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

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

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

        # create stacks
        x, y = l.XM, l.YM
        s.talon = DealRowTalonStack(x, y, self)
        l.createText(s.talon, "s")
        x += l.XS
        for i in range(10):
            stack = self.RowStack_Class(x, y, self, base_rank=ANY_RANK,
                                        max_move=UNLIMITED_MOVES,
                                        max_accept=UNLIMITED_ACCEPTS)
            s.rows.append(stack)
            x += l.XS
        s.foundations.append(AbstractFoundationStack(x, y, self, suit=ANY_SUIT,
                                                     max_accept=0, max_cards=104))
        l.createText(s.foundations[0], "s")

        # define stack-groups
        l.defaultStackGroups()
Beispiel #19
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()
Beispiel #20
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

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

        # create stacks
        y = l.YM
        for d in ((1, 2.5), (2, 2), (3, 1.5), (4, 1), (5, 0.5), (5, 0.5)):
            x = l.XM + d[1] * l.XS
            for i in range(d[0]):
                s.rows.append(EiffelTower_RowStack(x, y, self))
                x = x + l.XS
            y = y + l.YS
        x = l.XM + 6 * l.XS
        y = l.YM + 5 * l.YS // 2
        s.waste = self.Waste_Class(x, y, self)
        l.createText(s.waste, "s")
        x = x + l.XS
        s.talon = self.Talon_Class(x, y, self, max_rounds=1)
        l.createText(s.talon, "s")

        # define stack-groups
        l.defaultStackGroups()
Beispiel #21
0
    def createGame(self):

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

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

        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,
                                 mod=13, max_cards=6, base_rank=4, dir=-1))
            x += l.XS

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

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

        l.defaultStackGroups()
Beispiel #22
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()
Beispiel #23
0
    def createGame(self):

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

        y = l.YM
        for i in range(5):
            x = l.XM+(8-i)*l.XS/2
            for j in range(i+1):
                s.rows.append(ReserveStack(x, y, self))
                x += l.XS
            y += l.YS

        suit = 0
        for xx, yy in ((1.5, 1.5),
                       (1,   2.5),
                       (6.5, 1.5),
                       (7,   2.5)):
            x, y = l.XM+xx*l.XS, l.YM+yy*l.YS
            s.foundations.append(SS_FoundationStack(x, y, self, suit))
            suit += 1

        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')

        l.defaultStackGroups()
Beispiel #24
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM+5*l.XS, l.YM+5*l.YS)

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

        x, y = l.XM+3*l.XS/2, l.YM
        s.talon = WasteTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, 'nw')
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'ne')

        y = l.YM+l.YS
        for i in range(3):
            x = l.XM+l.XS
            for j in range(3):
                stack = CornerSuite_RowStack(x, y, self, max_move=1)
                s.rows.append(stack)
                stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
                x += l.XS
            y += l.YS

        l.defaultStackGroups()
Beispiel #25
0
    def createGame(self):

        # create layout
        l, s = Layout(self), self.s
        self.setSize(l.XM+8*l.XS, l.YM+2*l.YS+16*l.YOFFSET)

        # create stacks
        x, y = l.XM, l.YM
        s.talon = DealRowTalonStack(x, y, self)
        l.createText(s.talon, "s")
        x += 2*l.XS
        s.reserves.append(ReserveStack(x, y, self))
        x += 2*l.XS
        for i in range(4):
            s.foundations.append(Spider_SS_Foundation(x, y, self,
                                                      suit=ANY_SUIT))
            x += l.XS
        x, y = l.XM+l.XS, l.YM+l.YS
        for i in range(7):
            s.rows.append(Spider_RowStack(x, y, self,
                                          base_rank=ANY_RANK))
            x += l.XS

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

        # Set window size
        self.setSize(l.XM * 3 + l.XS * 9, l.YM + l.YS * 6)

        # Create row stacks
        x = l.XM
        y = l.YM
        for i in range(8):
            s.rows.append(RK_RowStack(x, y, self, base_rank=11,
                                      max_move=12, max_cards=99))
            x = x + l.XS

        # Create reserve stacks
        x = self.width - l.XS
        y = l.YM
        for i in range(6):
            s.reserves.append(ReserveStack(x, y, self))
            y = y + l.YS
        y = y - l.YS
        for i in range(4):
            x = x - l.XS
            s.reserves.append(ReserveStack(x, y, self))

        self.setRegion(s.rows, (0, 0, l.XM + l.XS * 8, l.YS * 5))

        # Create talon
        s.talon = DealRowTalonStack(l.XM, self.height - l.YS, self)
        l.createText(s.talon, "n")

        # Define stack groups
        l.defaultStackGroups()
Beispiel #28
0
    def createGame(self):

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

        w1 = l.XS+12*l.XOFFSET
        w, h = l.XM+2*l.XS+2*w1, l.YM+4*l.YS
        self.setSize(w, h)

        for x, y in ((l.XM,                l.YM),
                     (l.XM+w1+2*l.XS+l.XM, l.YM),
                     (l.XM,                l.YM+3*l.YS),
                     (l.XM+w1+2*l.XS+l.XM, l.YM+3*l.YS),):
            stack = SS_RowStack(x, y, self, max_move=1)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
            s.rows.append(stack)
        i = 0
        for x, y in ((l.XM+w1,                    l.YM),
                     (l.XM+w1+l.XS,               l.YM),
                     (l.XM+w1-2*l.XS-l.XS/2-l.XM, l.YM+1.5*l.YS),
                     (l.XM+w1-l.XS-l.XS/2-l.XM,   l.YM+1.5*l.YS),
                     (l.XM+w1+2*l.XS+l.XS/2+l.XM, l.YM+1.5*l.YS),
                     (l.XM+w1+3*l.XS+l.XS/2+l.XM, l.YM+1.5*l.YS),
                     (l.XM+w1,                    l.YM+3*l.YS),
                     (l.XM+w1+l.XS,               l.YM+3*l.YS),):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i%4))
            i += 1
        x, y = l.XM+w1, l.YM+1.5*l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=4)
        l.createText(s.talon, 's')
        l.createRoundText(s.talon, 'nn')
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 's')

        l.defaultStackGroups()
Beispiel #29
0
    def createGame(self, rows=7):
        
        l, s = Layout(self), self.s

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

        y = l.YM
        for i in range(2):
            x = l.XM+2*l.XS
            for j in range(8):
                s.foundations.append(self.Foundation_Class(x, y, self,
                                                           suit=j%4))
                x += l.XS
            y += l.YS

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

        x, y = l.XM, l.YM
        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()
Beispiel #30
0
    def createGame(self):

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

        x, y = l.XM, l.YM
        s.talon = WasteTalonStack(x, y, self, max_rounds=3)
        l.createText(s.talon, 's')
        l.createRoundText(s.talon, 'ne', dx=l.XS)
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 's')
        x0, y0 = l.XM+2*l.XS, l.YM
        k = 0
        for i, j in((2, 0), (0, 1.5), (4, 1.5), (2, 3)):
            x, y = x0+i*l.XS, y0+j*l.YS
            s.foundations.append(RK_FoundationStack(x, y, self,
                                 ##suit=ANY_SUIT,
                                 base_rank=KING, dir=-1, max_move=0))
            k += 1
        k = 0
        for i, j in((2, 1), (1, 1.5), (3, 1.5), (2, 2)):
            x, y = x0+i*l.XS, y0+j*l.YS
            s.foundations.append(RK_FoundationStack(x, y, self,
                                 ##suit=ANY_SUIT,
                                 base_rank=1, max_move=0, max_cards=12))
            k += 1
        k = 0
        for i, j in((1, 0.2), (3, 0.2), (1, 2.8), (3, 2.8)):
            x, y = x0+i*l.XS, y0+j*l.YS
            s.foundations.append(IdleAces_AceFoundation(x, y, self,
                                 suit=k, max_cards=1, max_move=0))
            k += 1

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

        # set window
        self.setSize(l.XM + self.COLS * l.XS,
                     l.YM + 2 * l.YS + (self.COLCARDS + 6) * l.YOFFSET)

        # create stacks
        x, y = l.XM, l.YM
        for i in range(self.COLS):
            s.rows.append(
                self.RowStack_Class(x,
                                    y,
                                    self,
                                    max_move=1,
                                    max_accept=1,
                                    dir=0,
                                    base_rank=NO_RANK))
            x += l.XS
        x, y = l.XM + ((self.COLS / 2) - 2) * l.XS, self.height - l.YS
        for i in range(4):
            s.rows.append(
                self.RowStack_Class(x,
                                    y,
                                    self,
                                    max_move=1,
                                    max_accept=1,
                                    dir=0,
                                    base_rank=NO_RANK))
            x += l.XS
        x, y = self.width - l.XS, self.height - l.YS
        s.foundations.append(
            self.Foundation_Class(x,
                                  y,
                                  self,
                                  suit=ANY_SUIT,
                                  max_move=0,
                                  max_cards=(52 * self.gameinfo.decks),
                                  base_rank=ANY_RANK))
        l.createText(s.foundations[0], "n")
        x, y = l.XM, self.height - l.YS
        s.talon = InitialDealTalonStack(x, y, self)

        # define stack-groups
        l.defaultStackGroups()
Beispiel #32
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM+12*l.XS, l.YM+5.5*l.YS)

        y = l.YM
        for i in range(2):
            x = l.XM
            for j in range(6):
                s.rows.append(BigBen_RowStack(x, y, self, max_move=1, mod=13))
                x += l.XS
            y += 2.75*l.YS

        x0, y0 = l.XM+6*l.XS, l.YM
        rank = 1
        for xx, yy in (
            (0,   1.5),
            (0.5, 0.5),
            (1.5, 0.15),
            (2.5, 0),
            (3.5, 0.15),
            (4.5, 0.5),
            (5,   1.5),
            (4.5, 2.5),
            (3.5, 2.85),
            (2.5, 3),
            (1.5, 2.85),
            (0.5, 2.5),
            ):
            x = int(x0 + xx*l.XS)
            y = int(y0 + yy*l.YS)
            suit=(3,0,2,1)[rank%4]
            max_cards = rank <= 4 and 8 or 9
            s.foundations.append(SS_FoundationStack(x, y, self, suit=suit,
                                 max_cards=max_cards, base_rank=rank,
                                 mod=13, max_move=0))
            rank += 1

        x, y = self.width-l.XS, self.height-l.YS
        s.talon = BigBen_Talon(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()
Beispiel #33
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

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

        # create stacks
        x, y = l.XM, l.YM
        for i in range(7):
            s.rows.append(
                self.RowStack_Class(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
        for i in range(9):
            s.rows.append(
                self.RowStack_Class(x,
                                    y,
                                    self,
                                    max_move=1,
                                    max_accept=1,
                                    dir=0,
                                    base_rank=NO_RANK))
            x += l.XS
        x, y = self.width - l.XS, l.YM
        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")
        x -= l.XS
        s.talon = InitialDealTalonStack(x, y, self)

        # define stack-groups
        l.defaultStackGroups()
Beispiel #34
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()
Beispiel #35
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM + 9 * l.XS, l.YM + 6 * l.YS)

        # vertical rows
        x = l.XM + l.XS
        for i in (0, 1):
            y = l.YM + l.YS
            for j in range(4):
                stack = ReserveStack(x, y, self, base_suit=i)
                stack.getBottomImage = stack._getSuitBottomImage
                s.rows.append(stack)
                y += l.YS
            x += 6 * l.XS
        # horizontal rows
        y = l.YM + l.YS
        for i in (2, 3):
            x = l.XM + 2.5 * l.XS
            for j in range(4):
                stack = ReserveStack(x, y, self, base_suit=i)
                stack.getBottomImage = stack._getSuitBottomImage
                s.rows.append(stack)
                x += l.XS
            y += 3 * l.YS
        # foundations
        decks = self.gameinfo.decks
        for k in range(decks):
            suit = 0
            for i, j in ((0, 3 - decks * 0.5 + k), (8, 3 - decks * 0.5 + k),
                         (4.5 - decks * 0.5 + k, 0), (4.5 - decks * 0.5 + k,
                                                      5)):
                x, y = l.XM + i * l.XS, l.YM + j * l.YS
                s.foundations.append(
                    SS_FoundationStack(x, y, self, suit=suit, max_move=0))
                suit += 1
        # talon & waste
        x, y = l.XM + 3.5 * l.XS, l.YM + 2.5 * l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=2)
        l.createText(s.talon, 's')
        l.createRoundText(self.s.talon, 'nn')
        x += l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 's')

        l.defaultStackGroups()
Beispiel #36
0
    def createGame(self):
        l, s = Layout(self), self.s

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

        x0, y0 = l.XM+2*l.XS, l.YM
        # foundations (corners)
        suit = 0
        for i, j in ((0,0),(5,0),(0,4),(5,4)):
            x, y = x0+i*l.XS, y0+j*l.YS
            s.foundations.append(Frames_Foundation(x, y, self,
                                 suit=suit, dir=0, max_cards=26))
            suit += 1
        # rows (frame)
        for i in (1,2,3,4):
            for j in (0,4):
                x, y = x0+i*l.XS, y0+j*l.YS
                stack = Frames_RowStack(x, y, self)
                s.rows.append(stack)
                stack.cap.addattr(column=i)
                stack.CARD_YOFFSET = 0
        for i in (0,5):
            for j in (1,2,3):
                x, y = x0+i*l.XS, y0+j*l.YS
                stack = Frames_RowStack(x, y, self)
                s.rows.append(stack)
                stack.cap.addattr(row=j)
                stack.CARD_YOFFSET = 0
        # reserves (picture)
        for j in (1,2,3):
            for i in (1,2,3,4):
                x, y = x0+i*l.XS, y0+j*l.YS
                stack = OpenStack(x, y, self)
                s.reserves.append(stack)
                stack.cap.addattr(column=i)
                stack.cap.addattr(row=j)
        # talon & waste
        x, y, = l.XM, l.YM
        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()
Beispiel #37
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

        ROWS = 7

        # set size so that at least 2//3 of a card is visible with 20 cards
        h = l.CH * 2 // 27 * l.YOFFSET
        h = l.YM + max(h, 5 * l.YS)

        # create rows
        x, y = l.XM, l.YM

        w1, w2 = (7 * (l.XS + l.XM)), (2 * l.XS)
        if w2 + 13 * l.XOFFSET > w1:
            l.XOFFSET = int((w1 - w2) / 13)

        reserve = OpenStack(x * 3, y, self)
        reserve.CARD_XOFFSET = l.XOFFSET
        l.createText(reserve, "sw")
        s.reserves.append(reserve)

        y += l.YS
        for i in range(ROWS):
            self.s.rows.append(self.RowStack_Class(x, y, self))
            x += l.XS

        # Don't know why this is necessary for the Yukon layout.
        # But we should probably figure out how to get this to work
        # like other games.
        self.setRegion(self.s.rows, (-999, -999, x - l.CW // 2, 999999))

        # create foundations
        y = l.YM
        for suit in range(4):
            self.s.foundations.append(self.Foundation_Class(
                x, y, self, suit=suit, max_move=0))
            y += l.YS

        x, y = l.XM, h - l.YS
        self.s.talon = self.Talon_Class(x, y, self)

        # set window
        self.setSize(l.XM + 8 * l.XS, h)
        l.defaultAll()
    def createGame(self, **layout):
        # create layout
        l, s = Layout(self), self.s

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

        # create stacks
        x, y, = l.XM, l.YM
        s.talon = self.Talon_Class(x, y, self)
        l.createText(s.talon, "ss")
        x = x + 3 * l.XS // 2
        for i in range(4):
            s.rows.append(self.RowStack_Class(x, y, self))
            x = x + l.XS

        # define stack-groups
        l.defaultStackGroups()
Beispiel #39
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM + 7.5 * l.XS, l.YM + 3.8 * l.YS)

        x0, y0 = l.XM, l.YM
        for xx, yy in (
            (4, 0.4),
            (3, 0.2),
            (2, 0.0),
            (1, 0.2),
            (0, 0.7),
            (1, 1.2),
            (2, 1.4),
            (3, 1.6),
            (4, 2.0),
            (3, 2.6),
            (2, 2.8),
            (1, 2.6),
            (0, 2.4),
        ):
            x, y = x0 + xx * l.XS, y0 + yy * l.YS
            s.foundations.append(
                RK_FoundationStack(x,
                                   y,
                                   self,
                                   suit=ANY_SUIT,
                                   max_cards=8,
                                   mod=13,
                                   max_move=0))

        x, y = l.XM + 5.5 * l.XS, l.YM + 2 * l.YS
        for i in (0, 1):
            stack = Calculation_RowStack(x, y, self, max_move=1, max_accept=1)
            stack.CARD_YOFFSET = 0
            s.rows.append(stack)
            l.createText(stack, 's')
            x += l.XS
        x, y = l.XM + 5.5 * l.XS, l.YM + l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=1)
        l.createText(s.talon, 'nw')
        x += l.XS
        s.waste = WasteStack(x, y, self, max_cards=1)

        l.defaultStackGroups()
Beispiel #40
0
    def createGame(self):

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

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

        # create stacks
        y = l.YM
        for i in range(2):
            x = l.XM+3*l.XS
            for j in range(4):
                s.foundations.append(TwilightZone_Foundation(x, y, self,
                                                             suit=j))
                x += l.XS
            y += l.YS

        x, y = l.XM+3*l.XS, l.YM+2*l.YS
        for i in range(4):
            stack = TwilightZone_RowStack(x, y, self, max_move=1)
            stack.CARD_YOFFSET = 0
            s.rows.append(stack)
            x += l.XS

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


        x, y = l.XM, l.YM+l.YS/2
        s.talon = TwilightZone_Talon(x, y, self, max_move=1, max_rounds=2)
        l.createText(s.talon, 's')
        l.createRoundText(s.talon, 'nn')
        x += l.XS
        s.waste = TwilightZone_Waste(x, y, self, max_accept=1)
        l.createText(s.waste, 's')


        # define stack-groups
        l.defaultStackGroups()
        self.sg.dropstacks.append(s.talon)
        self.sg.openstacks.append(s.waste)
Beispiel #41
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()
Beispiel #42
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()
Beispiel #43
0
    def createGame(self, rows=8):
        # create layout
        l, s = Layout(self), self.s

        # set window
        w, h = l.XM + (rows + 2) * l.XS, max(
            l.YM + 3 * l.XS + 10 * l.YOFFSET,
            l.YM + 2 * l.YS + self.RESERVE_CARDS * l.YOFFSET + l.TEXT_HEIGHT)
        self.setSize(w, h)

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

        x, y = l.XM + rows * l.XS // 2, l.YM
        s.reserves.append(Backbone_BraidStack(x, y, self, max_accept=0))
        x += l.XS
        s.reserves.append(Backbone_BraidStack(x, y, self, max_accept=0))
        x, y = l.XM + (rows +
                       1) * l.XS // 2, l.YM + self.RESERVE_CARDS * l.YOFFSET
        s.reserves.append(BasicRowStack(x, y, self, max_accept=0))

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

        x, y = l.XM + rows * l.XS // 2, h - 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")

        # define stack-groups
        l.defaultStackGroups()
Beispiel #44
0
    def createGame(self, texts=False):
        # create layout
        l, s = Layout(self, card_x_space=4), self.s

        # set window
        decks = self.gameinfo.decks
        if decks == 1:
            w = l.XM + 13 * l.XS
            dx = 0
        else:
            w = l.XM + 15 * l.XS
            dx = l.XS
        h = l.YM + 5 * l.YS
        self.setSize(w, h)

        # create stacks
        for i in range(4):
            for j in range(13):
                x, y, = dx + l.XM + j * l.XS, l.YM + (i + 1) * l.YS
                s.rows.append(
                    DerLetzteMonarch_RowStack(x,
                                              y,
                                              self,
                                              max_accept=1,
                                              max_cards=2))
        for i in range(4):
            x, y, = l.XM + (i + 2) * l.XS, l.YM
            s.reserves.append(
                DerLetzteMonarch_ReserveStack(x, y, self, max_accept=0))
        for i in range(4 * decks):
            x, y, = l.XM + (i + 7) * l.XS, l.YM
            s.foundations.append(
                DerLetzteMonarch_Foundation(x, y, self, suit=i % 4,
                                            max_move=0))
        s.talon = self.Talon_Class(l.XM, l.YM, self)
        if texts:
            l.createText(s.talon, 'ne')

        # define stack-groups (non default)
        self.sg.talonstacks = [s.talon]
        self.sg.openstacks = s.foundations + s.rows
        self.sg.dropstacks = s.rows + s.reserves
        self.sg.reservestacks = s.reserves
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM+6*l.XS, l.YM+2*l.YS+12*l.YOFFSET)

        x, y, = l.XM, l.YM
        s.talon = self.Talon_Class(x, y, self)
        l.createText(s.talon, "s")
        x, y = l.XM+2*l.XS, l.YM
        for i in range(4):
            s.foundations.append(Formic_Foundation(x, y, self,
                                 suit=ANY_SUIT, base_rank=ANY_RANK,
                                 max_cards=52, max_move=0))
            x += l.XS
        x, y = l.XM+2*l.XS, l.YM+l.YS
        for i in range(4):
            s.rows.append(BasicRowStack(x, y, self, max_move=1, max_accept=0))
            x += l.XS

        l.defaultStackGroups()
    def createGame(self):

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

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

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

        x, y = l.XM + l.XS, l.YM
        for i in range(8):
            s.rows.append(
                SS_RowStack(x, y, self, dir=1, max_move=1, max_accept=1))
            x += l.XS
        x, y = l.XM + l.XS, l.YM + l.YS + h
        for i in range(8):
            s.rows.append(
                SS_RowStack(x, y, self, dir=-1, max_move=1, max_accept=1))
            x += l.XS

        x, y = l.XM + l.XS, l.YM + h
        for i in range(8):
            stack = HeadsAndTails_Reserve(x, y, self)
            s.reserves.append(stack)
            l.createText(stack, "n")
            x += l.XS

        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 = l.XM + 9 * 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

        # define stack-groups
        l.defaultStackGroups()
Beispiel #47
0
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM + 8 * l.XS, l.YM + 4 * l.YS)

        x0, y0 = l.XM + 2 * l.XS, l.YM
        rank = 0
        for xx, yy in (
            (3.5, 0.15),
            (4.5, 0.5),
            (5, 1.5),
            (4.5, 2.5),
            (3.5, 2.85),
            (2.5, 3),
            (1.5, 2.85),
            (0.5, 2.5),
            (0, 1.5),
            (0.5, 0.5),
            (1.5, 0.15),
            (2.5, 0),
            (2.5, 1.5),
        ):
            x = int(x0 + xx * l.XS)
            y = int(y0 + yy * l.YS)
            s.foundations.append(
                AC_FoundationStack(x,
                                   y,
                                   self,
                                   suit=ANY_SUIT,
                                   dir=0,
                                   max_cards=4,
                                   base_rank=rank,
                                   max_move=0))
            rank += 1

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

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

        # set window
        n = m = max(self.ROWS)
        if self.ROWS[0] == m or self.ROWS[-1] == m:
            n = n + 1
        self.setSize(l.XM + n*l.XS, l.YM + len(self.ROWS)*l.YS)

        # game extras 1)
        self.map = {}

        # create stacks
        for i in range(len(self.ROWS)):
            r = self.ROWS[i]
            for j in range(r):
                d = m - r + 2*j
                x, y = l.XM + d*l.XS//2, l.YM + i*l.YS
                stack = Pegged_RowStack(x, y, self)
                stack.pos = (d, 2*i)
                # print stack.id, stack.pos
                s.rows.append(stack)
                self.map[stack.pos] = stack
        x, y = self.width - l.XS, l.YM
        s.foundations.append(
            AbstractFoundationStack(
                x, y, self, ANY_SUIT, max_move=0, max_accept=0,
                max_cards=self.gameinfo.ncards))
        l.createText(s.foundations[0], "s")
        y = self.height - l.YS
        s.talon = InitialDealTalonStack(x, y, self)
        s.internals.append(InvisibleStack(self))

        # game extras 2)
        self.STEP_MAP = {}
        for step in self.STEPS:
            self.STEP_MAP[step] = 1
        if self.EMPTY_STACK_ID < 0:
            self.EMPTY_STACK_ID = len(s.rows) // 2

        # Define stack groups
        l.defaultStackGroups()
Beispiel #49
0
    def createGame(self, rows=8, text=False):
        # create layout
        l, s = Layout(self), self.s

        # set window
        max_rows = max(rows, self.gameinfo.decks*4)
        w, h = 2*l.XM+l.XS+max_rows*l.XS+l.XS//2, l.YM+l.TEXT_HEIGHT+5*l.YS
        self.setSize(w, h)

        # create stacks
        x, y, = w-l.XS*self.gameinfo.decks*4, l.YM
        for j in range(self.gameinfo.decks):
            for i in range(4):
                s.foundations.append(self.Foundation_Class(x, y, self, suit=i))
                x += l.XS
        if text:
            x, y = w-l.XS, l.YM
            tx, ty, ta, tf = l.getTextAttr(None, "ss")
            tx, ty = x+tx, y+ty
            font = self.app.getFont("canvas_default")
            self.texts.info = MfxCanvasText(self.canvas, tx, ty,
                                            anchor=ta, font=font)

        x, y = w-rows*l.XS, l.YM+l.YS
        if text:
            y += l.TEXT_HEIGHT
        for i in range(rows):
            stack = self.RowStack_Class(x, y, self)
            stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
            s.rows.append(stack)
            x += l.XS
        x, y, = l.XM, l.YM
        s.talon = self.Talon_Class(x, y, self)
        l.createText(s.talon, "s")
        y += l.TEXT_HEIGHT
        for i in range(3):
            y += l.YS
            stack = self.ReserveStack_Class(x, y, self)
            s.reserves.append(stack)
            l.createText(stack, "se")

        # define stack-groups
        l.defaultStackGroups()
Beispiel #50
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()
Beispiel #51
0
    def createGame(self, rows=8):

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

        w, h = l.XM+rows*l.XS, l.YM+2*l.YS+14*l.YOFFSET
        self.setSize(w, h)

        x, y = l.XM, l.YM
        for i in range(rows):
            s.rows.append(RK_RowStack(x, y, self, max_cards=13, mod=13, dir=1, max_move=1))
            x += l.XS
        x, y = l.XM, h-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()
Beispiel #52
0
    def createGame(self):
        layout, s = Layout(self), self.s
        self.setSize(layout.XM + 4 * layout.XS, layout.YM + 2 * layout.YS)
        x, y = layout.XM, layout.YM
        for i in range(4):
            s.foundations.append(Uintah_Foundation(x, y, self,
                                 suit=ANY_SUIT, dir=0, mod=13,
                                 max_cards=52, max_move=0))
            x += layout.XS
        x, y = layout.XM + layout.XS, layout.YM + layout.YS
        s.talon = WasteTalonStack(x, y, self,
                                  max_rounds=UNLIMITED_REDEALS, num_deal=3)
        layout.createText(s.talon, 'nw')
        x += layout.XS
        s.waste = WasteStack(x, y, self)
        layout.createText(s.waste, 'ne')

        # define stack-groups
        layout.defaultStackGroups()
Beispiel #53
0
    def createGame(self):

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

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

        # create stacks
        x, y = l.XM, l.YM
        for i in range(12):
            stack = TwelveSleepingMaids_Reserve(x, y, self)
            stack.CARD_YOFFSET = l.YOFFSET
            s.reserves.append(stack)
            x += l.XS

        x, y = l.XM + 2 * l.XS, l.YM + l.YS + 3 * l.YOFFSET
        for i in range(8):
            s.foundations.append(
                SS_FoundationStack(x,
                                   y,
                                   self,
                                   suit=i // 2,
                                   base_rank=KING,
                                   mod=13))
            x += l.XS

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

        x, y = self.width - l.XS, self.height - l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=3)
        l.createText(s.talon, 'n')
        l.createRoundText(s.talon, 'nnn')

        x -= l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'n')

        # define stack-groups
        l.defaultStackGroups()
    def createGame(self):
        l, s = Layout(self), self.s
        self.setSize(l.XM + 7 * l.XS, l.YM + 3 * l.YS)

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

        x, y = l.XM + 3.5 * l.XS, l.YM + l.YS
        stack = RK_FoundationStack(x,
                                   y,
                                   self,
                                   suit=ANY_SUIT,
                                   max_cards=52,
                                   max_move=0,
                                   mod=13,
                                   base_rank=ANY_RANK)
        s.foundations.append(stack)
        l.createText(stack, 'ne')
        x, y = l.XM, l.YM
        s.talon = Strategerie_Talon(x, y, self)
        l.createText(s.talon, 'ne')

        l.defaultStackGroups()
        self.sg.dropstacks.append(s.talon)
Beispiel #55
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s

        # game extras
        self.other_stack = None
        self.closed_cards = -1
        self.score = 0

        # create text
        x, y = l.XM, self.ROWS * l.YS
        if self.preview <= 1:
            self.texts.score = MfxCanvasText(
                self.canvas,
                x,
                y,
                anchor="sw",
                font=self.app.getFont("canvas_large"))
            x = self.texts.score.bbox()[1][0] + 16

        # set window
        w = max(2 * l.XS, x)
        self.setSize(l.XM + w + self.COLUMNS * l.XS, l.YM + self.ROWS * l.YS)

        # create stacks
        for i in range(self.ROWS):
            for j in range(self.COLUMNS):
                x, y = l.XM + w + j * l.XS, l.YM + i * l.YS
                s.rows.append(
                    Memory_RowStack(x,
                                    y,
                                    self,
                                    max_move=0,
                                    max_accept=0,
                                    max_cards=1))
        x, y = l.XM, l.YM
        s.talon = InitialDealTalonStack(x, y, self)
        l.createText(s.talon, anchor="n", text_format="%D")
        s.internals.append(InvisibleStack(self))

        # define stack-groups
        l.defaultStackGroups()
Beispiel #56
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()
Beispiel #57
0
    def createGame(self):
        playcards = 6

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

        x, y = l.XM, l.YM
        s.talon = SlyFox_Talon(x, y, self)
        s.waste = s.talon
        l.createText(s.talon, 'ne')
        tx, ty, ta, tf = l.getTextAttr(s.talon, "ss")
        font = self.app.getFont("canvas_default")
        self.texts.misc = MfxCanvasText(self.canvas,
                                        tx,
                                        ty,
                                        anchor=ta,
                                        font=font)

        x += 2 * l.XS
        for i in range(4):
            s.foundations.append(SlyFox_Foundation(x, y, self, suit=i))
            s.foundations.append(
                SlyFox_Foundation(x + 4 * l.XS,
                                  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):
                stack = SlyFox_RowStack(x, y, self, max_cards=UNLIMITED_CARDS)
                s.rows.append(stack)
                stack.CARD_YOFFSET = l.YOFFSET
                x += l.XS
            y += l.YS + playcards * l.YOFFSET

        l.defaultStackGroups()
Beispiel #58
0
    def createGame(self):
        # create layout
        l, s = Layout(self), self.s
        help, text_width = self._getHelpText()
        text_width += 2*l.XM

        # set window
        self.setSize(5.5*l.XS+l.XM+text_width, l.YM+3*l.YS+l.TEXT_HEIGHT)

        # create stacks
        x0 = l.XM + l.XS * 3 // 2
        x, y = x0, l.YM
        for i in range(4):
            stack = BetsyRoss_Foundation(x, y, self, base_rank=i,
                                         max_cards=1, max_move=0, max_accept=0)
            s.foundations.append(stack)
            x += l.XS
        x = x0
        y = l.YM + l.YS
        for i in range(4):
            stack = BetsyRoss_Foundation(x, y, self, base_rank=2*i+1,
                                         mod=13, dir=i+1,
                                         max_cards=12, max_move=0)
            tx, ty, ta, tf = l.getTextAttr(stack, "s")
            font = self.app.getFont("canvas_default")
            stack.texts.misc = MfxCanvasText(self.canvas, tx, ty,
                                             anchor=ta, font=font)
            s.foundations.append(stack)
            x += l.XS
        self.texts.help = MfxCanvasText(self.canvas, x + l.XM, y + l.CH // 2,
                                        text=help, anchor="w",
                                        font=self.app.getFont("canvas_fixed"))
        x = l.XM
        s.talon = WasteTalonStack(x, y, self, max_rounds=3)
        l.createText(s.talon, "n")
        l.createRoundText(s.talon, 'nnn')
        y += l.YS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, "s")

        # define stack-groups
        l.defaultStackGroups()
Beispiel #59
0
    def createGame(self, rows=10, playcards=20):
        l, s = Layout(self), self.s
        self.setSize(l.XM + max(rows, 8) * l.XS,
                     l.YM + 2 * l.YS + playcards * l.YOFFSET)
        x, y = l.XM, l.YM
        stack = OpenStack(x, y, self, max_move=1, max_accept=0)
        s.reserves.append(stack)
        l.createText(stack, 'ne')
        x, y = self.width - 8 * l.XS, l.YM
        for i in range(8):
            s.foundations.append(SS_FoundationStack(x, y, self, suit=i // 2))
            x += l.XS
        x, y = self.width - rows * l.XS, l.YM + l.YS
        for i in range(rows):
            s.rows.append(Yukon_AC_RowStack(x, y, self))
            x += l.XS
        x, y = l.XM, self.height - l.YS
        s.talon = InitialDealTalonStack(x, y, self)

        l.defaultStackGroups()
Beispiel #60
0
    def createGame(self, max_rounds=3, width=10, playcards=14):
        l, s = Layout(self), self.s
        self.setSize(l.XM+width*l.XS,
                     l.YM+2*l.YS+l.TEXT_HEIGHT+playcards*l.YOFFSET)

        x, y = l.XM, l.YM
        for i in range(10):
            s.rows.append(self.RowStack_Class(x, y, self, dir=1))
            x += l.XS

        x, y = self.width-l.XS, self.height-l.YS
        s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds)
        l.createText(s.talon, 'n')
        l.createRoundText(s.talon, 'nnn')

        x -= l.XS
        s.waste = WasteStack(x, y, self)
        l.createText(s.waste, 'n')

        l.defaultStackGroups()