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()
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()
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()
def createGame(self, max_rounds=1): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM + 8 * l.XS, l.YM + 3 * l.YS + 12 * l.YOFFSET + l.TEXT_HEIGHT) # create stacks x, y = l.XM, l.YM for i in range(8): s.foundations.append(self.Foundation_Class(x, y, self, suit=i / 2)) x = x + l.XS x, y = l.XM, y + l.YS for i in range(8): s.rows.append(self.RowStack_Class(x, y, self)) x = 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") if max_rounds > 1: l.createRoundText(self.s.talon, 'nnn') x = x + l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "n") # define stack-groups l.defaultStackGroups()
def createGame(self, max_rounds=3, num_deal=1): l, s = Layout(self), self.s self.setSize(l.XM + 4 * l.XS, l.YM + 2 * l.YS) x, y = l.XM + 3 * l.XS // 2, l.YM stack = BlackHole_Foundation(x, y, self, ANY_SUIT, dir=0, mod=13, max_move=0, max_cards=52) s.foundations.append(stack) l.createText(stack, 'ne') x, y = l.XM + l.XS, l.YM + l.YS s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds, num_deal=num_deal) l.createText(s.talon, 'nw') if max_rounds > 0: l.createRoundText(self.s.talon, 'se', dx=l.XS) x += l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, 'ne') # define stack-groups l.defaultStackGroups()
def createGame(self, rows=4, texts=False, yoffset=None): # create layout l, s = Layout(self), self.s # set window if yoffset is None: yoffset = l.YOFFSET max_rows = max(rows, 4 * self.gameinfo.decks) self.setSize(l.XM + (2 + max_rows) * l.XS, l.YM + 2 * l.YS + 12 * yoffset) # create stacks if texts: x, y, = l.XM, l.YM + l.YS // 2 else: x, y, = l.XM, l.YM s.talon = self.Talon_Class(x, y, self) l.createText(s.talon, "s") if texts: l.createRoundText(s.talon, 'nn') x, y = l.XM + 2 * l.XS, l.YM for i in range(4 * self.gameinfo.decks): s.foundations.append(self.Foundation_Class(x, y, self, suit=i % 4)) x += l.XS x, y = l.XM + 2 * l.XS, l.YM + l.YS for i in range(rows): stack = self.RowStack_Class(x, y, self) s.rows.append(stack) stack.CARD_YOFFSET = yoffset x += l.XS # define stack-groups l.defaultStackGroups()
def createGame(self): l, s = Layout(self), self.s self.setSize(l.XM+10*l.XS, l.YM+3*l.YS+15*l.YOFFSET) x, y = l.XM+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, l.YM+l.YS for i in range(2): for j in range(4): s.rows.append(self.RowStack_Class(x, y, self)) x += l.XS x += 2*l.XS x, y = l.XM+4*l.XS, l.YM+l.YS s.reserves += self._createFirTree(l, x, y) x, y = l.XM, 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+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()
def createGame(self): # create layout l, s = Layout(self), self.s # set window # (set piles so that at least 2/3 of a card is visible with 12 cards) h = max(2*l.YS, (12-1)*l.YOFFSET + l.CH*2/3) self.setSize(10*l.XS+l.XM, h + l.YM + h) # create stacks ##center, c1, c2 = self.height / 2, h, self.height - h center = self.height / 2 c1, c2 = center-l.TEXT_HEIGHT/2, center+l.TEXT_HEIGHT/2 x, y = l.XM, c1 - l.CH for i in range(8): s.rows.append(Matriarchy_UpRowStack(x, y, self, i/2)) x = x + l.XS x, y = l.XM, c2 for i in range(8): s.rows.append(Matriarchy_DownRowStack(x, y, self, i/2)) x = x + l.XS x, y = x + l.XS / 2, c1 - l.CH / 2 - l.CH tx = x + l.CW / 2 s.waste = Matriarchy_Waste(x, y, self) l.createText(s.waste, "s") y = c2 + l.CH / 2 s.talon = Matriarchy_Talon(x, y, self, max_rounds=VARIABLE_REDEALS) l.createText(s.talon, "n") l.createRoundText(s.talon, 'ss') s.talon.texts.misc = MfxCanvasText(self.canvas, tx, center, anchor="center", font=self.app.getFont("canvas_large")) # define stack-groups l.defaultStackGroups()
def createGame(self, round_text=True): decks = self.gameinfo.decks # create layout l, s = Layout(self, card_x_space=4), self.s # set window w, h = l.XM + self.RSTEP*l.XS, l.YM + (4*decks)*l.YS if round_text: h += l.YS self.setSize(w, h) # create stacks for k in range(decks): for i in range(4): x, y = l.XM, l.YM + (i+k*4)*l.YS for j in range(self.RSTEP): s.rows.append(self.RowStack_Class(x, y, self, max_accept=1, max_cards=1)) x += l.XS if round_text: x, y = l.XM + (self.RSTEP-1)*l.XS/2, self.height-l.YS s.talon = self.Talon_Class(x, y, self) l.createRoundText(s.talon, 'se') else: # Talon is invisible x, y = self.getInvisibleCoords() s.talon = self.Talon_Class(x, y, self) if self.RBASE: # create an invisible stack to hold the four Aces s.internals.append(InvisibleStack(self)) # define stack-groups l.defaultStackGroups()
def createGame(self, max_rounds=3): # create layout l, s = Layout(self, card_x_space=20, card_y_space=20), self.s # set window self.setSize(5*l.XS+l.XM, 4*l.YS+3*l.YM) # create stacks x, y = l.XM+1.5*l.XS, l.YM s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds) l.createText(s.talon, "sw") if max_rounds > 1: l.createRoundText(self.s.talon, 'nw') x += l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "se") x0, y0 = l.XM, l.YM+l.YS i = 0 for d in ((0, 0), (4, 0), (0, 2), (4, 2)): x, y = x0+d[0]*l.XS, y0+d[1]*l.YS s.foundations.append(SS_FoundationStack(x, y, self, suit=i, max_move=0, mod=13)) i += 1 for d in ((2, 0), (1, 1), (2, 1), (3, 1), (2, 2)): x, y = x0+d[0]*l.XS, y0+d[1]*l.YS stack = self.RowStack_Class(x, y, self) s.rows.append(stack) stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0 # define stack-groups l.defaultStackGroups()
def createGame(self): l, s = Layout(self), self.s self.setSize(l.XM + 9.5 * l.XS, l.YM + 3 * l.YS) x, y = l.XM + 1.5 * l.XS, l.YM for i in range(8): stack = BetsyRoss_Foundation(x, y, self, base_rank=i, mod=13, dir=i + 1, 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 = x + l.XS x, y = l.XM + 1.5 * l.XS, l.YM + 2 * l.YS for i in range(8): stack = SeniorWrangler_RowStack(x, y, self, max_accept=0) s.rows.append(stack) stack.CARD_YOFFSET = 0 x += l.XS x, y = l.XM, l.YM + l.YS s.talon = SeniorWrangler_Talon(x, y, self, max_rounds=9) l.createRoundText(s.talon, 'nn') # define stack-groups l.defaultStackGroups()
def createGame(self): layout, s = Layout(self), self.s self.setSize(layout.XM + self.FOUNDATIONS * layout.XS, layout.YM + 2 * layout.YS) x, y = layout.XM, layout.YM for i in range(self.FOUNDATIONS): c_max = (self.gameinfo.decks * 52) / self.FOUNDATIONS s.foundations.append(Precedence_Foundation(x, y, self, dir=-1, mod=13, max_move=0, max_cards=c_max)) x += layout.XS x, y = layout.XM + (layout.XS * 3), layout.YM + layout.YS s.talon = self.TALON_STACK(x, y, self, max_rounds=self.NUM_ROUNDS, num_deal=1) layout.createText(s.talon, 'nw') layout.createRoundText(s.talon, 'se', dx=layout.XS) x += layout.XS s.waste = self.WASTE_STACK(x, y, self) layout.createText(s.waste, 'ne') x += 2 * layout.XS for i in range(self.RESERVES): s.reserves.append(self.RESERVE_STACK(x, y, self, max_cards=104)) x += layout.XS # define stack-groups layout.defaultStackGroups()
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()
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()
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()
def createGame(self): l, s = Layout(self), self.s playcards = 10 w0 = l.XS+(playcards-1)*l.XOFFSET w, h = l.XM+max(4*w0, 9*l.XS), l.YM+5*l.YS self.setSize(w, h) x, y = l.XM, l.YM s.talon = Crescent_Talon(x, y, self, max_rounds=4) l.createRoundText(s.talon, 'ne') 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 for i in range(4): x = l.XM for j in range(4): 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()
def createGame(self): l, s = Layout(self), self.s self.setSize(l.XM + 10 * l.XS, l.YM + 3 * l.YS + 15 * l.YOFFSET) x, y = l.XM + 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, l.YM + l.YS for i in range(2): for j in range(4): s.rows.append(self.RowStack_Class(x, y, self)) x += l.XS x += 2 * l.XS x, y = l.XM + 4 * l.XS, l.YM + l.YS s.reserves += self._createFirTree(l, x, y) x, y = l.XM, 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, 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()
def createGame(self, rows=8, playcards=12, texts=False): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM + max(9, rows) * l.XS, l.YM + 3 * l.YS + playcards * l.YOFFSET) # extra settings self.base_cards = None # create stacks for i in range(8): x, y, = l.XM + i * l.XS, l.YM s.reserves.append(ReserveStack(x, y, self, max_accept=0)) for i in range(8): x, y, = l.XM + i * l.XS, l.YM + l.YS s.foundations.append( Interregnum_Foundation(x, y, self, mod=13, max_move=0)) for i in range(rows): x, y, = l.XM + (2 * i + 8 - rows) * l.XS // 2, l.YM + 2 * l.YS s.rows.append(self.RowStack_Class(x, y, self)) s.talon = self.Talon_Class(self.width - l.XS, self.height - l.YS, self) if texts: l.createRoundText(s.talon, 'nn') else: l.createText(s.talon, "n") # define stack-groups l.defaultStackGroups()
def createGame(self, max_rounds=1): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM + 7 * l.XS, l.YM + 4 * l.YS) # create stacks x = l.XM + 4 * l.XS for fnd_cls in self.Foundation_Classes: y = l.YM for i in range(4): s.foundations.append(fnd_cls(x, y, self, suit=i)) y += l.YS x += l.XS for i in range(4): for j in range(2): x, y = l.XM + (3 + 3 * j) * l.XS, l.YM + i * l.YS stack = self.RowStack_Class(x, y, self) stack.CARD_YOFFSET = 0 s.rows.append(stack) x, y, = l.XM, l.YM s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds) l.createText(s.talon, "s") x = x + l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "s") if max_rounds > 1: l.createRoundText(s.talon, 'ne', dx=l.XS) # define stack-groups l.defaultStackGroups()
def createGame(self): l, s = Layout(self), self.s playcards = 10 w0 = l.XS + (playcards - 1) * l.XOFFSET w, h = l.XM + max(4 * w0, 9 * l.XS), l.YM + 5 * l.YS self.setSize(w, h) x, y = l.XM, l.YM s.talon = Crescent_Talon(x, y, self, max_rounds=4) l.createRoundText(s.talon, 'ne') 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 for i in range(4): x = l.XM for j in range(4): 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()
def createGame(self, rows=4): l, s = Layout(self), self.s self.setSize(l.XM+5*l.XS, l.YM+4*l.YS) for x, y in ((l.XM, l.YM), (l.XM+4*l.XS, l.YM), (l.XM, l.YM+3*l.YS), (l.XM+4*l.XS, l.YM+3*l.YS), ): stack = PussInTheCorner_RowStack(x, y, self, max_accept=1, max_move=1) stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0 s.rows.append(stack) for x, y in ((l.XM+1.5*l.XS, l.YM + l.YS), (l.XM+1.5*l.XS, l.YM + 2*l.YS), (l.XM+2.5*l.XS, l.YM + l.YS), (l.XM+2.5*l.XS, l.YM + 2*l.YS), ): s.foundations.append(PussInTheCorner_Foundation(x, y, self, max_move=0)) x, y = l.XM + 2*l.XS, l.YM s.waste = s.talon = PussInTheCorner_Talon(x, y, self, max_rounds=2) l.createText(s.talon, 'se') l.createRoundText(self.s.talon, 'ne') # define stack-groups l.defaultStackGroups()
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()
def createGame(self, rows=4): l, s = Layout(self), self.s self.setSize(l.XM+5*l.XS, l.YM+4*l.YS) for x, y in ((l.XM, l.YM ), (l.XM+4*l.XS, l.YM ), (l.XM, l.YM+3*l.YS), (l.XM+4*l.XS, l.YM+3*l.YS), ): stack = PussInTheCorner_RowStack(x, y, self, max_accept=1, max_move=1) stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0 s.rows.append(stack) for x, y in ((l.XM+1.5*l.XS, l.YM+ l.YS), (l.XM+1.5*l.XS, l.YM+2*l.YS), (l.XM+2.5*l.XS, l.YM+ l.YS), (l.XM+2.5*l.XS, l.YM+2*l.YS), ): s.foundations.append(PussInTheCorner_Foundation(x, y, self, max_move=0)) x, y = l.XM + 2*l.XS, l.YM s.waste = s.talon = PussInTheCorner_Talon(x, y, self, max_rounds=2) l.createText(s.talon, 'se') l.createRoundText(self.s.talon, 'ne') # define stack-groups l.defaultStackGroups()
def createGame(self): lay, s = Layout(self), self.s w, h = lay.XM + 6*lay.XS + 4*lay.XOFFSET, \ lay.YM + lay.TEXT_HEIGHT + 2*lay.YS + 12*lay.YOFFSET self.setSize(w, h) x, y = lay.XM, lay.YM s.talon = WasteTalonStack(x, y, self, max_rounds=3) lay.createText(s.talon, 's') lay.createRoundText(s.talon, 'ne', dx=lay.XS) x += lay.XS s.waste = WasteStack(x, y, self) lay.createText(s.waste, 's') x += lay.XS+4*lay.XOFFSET y = lay.YM for i in range(4): s.foundations.append(self.Foundation_Class(x, y, self, suit=i)) x += lay.XS x0, y0, w = lay.XM, lay.YM+lay.YS+2*lay.TEXT_HEIGHT,\ lay.XS+2*lay.XOFFSET for i, j in ((0, 0), (0, 1), (1, 0), (1, 1)): x, y = x0+i*w, y0+j*lay.YS stack = self.ReserveStack_Class(x, y, self, max_accept=0) stack.CARD_XOFFSET, stack.CARD_YOFFSET = lay.XOFFSET, 0 s.reserves.append(stack) x, y = lay.XM+2*lay.XS+4*lay.XOFFSET, lay.YM+lay.YS for i in range(4): s.rows.append(self.RowStack_Class(x, y, self)) x += lay.XS lay.defaultStackGroups()
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()
def createGame(self, pyramid_len=7, reserves=0, waste=True, texts=True): # create layout l, s = Layout(self), self.s # set window w = l.XM + 13*l.XS h = l.YM + 4*l.YS self.setSize(w, h) # create stacks x, y = l.XM+l.XS//2, l.YM s.rows = self._createPyramid(l, x, y, 7) x += 5.5*l.XS s.rows += self._createInvertedPyramid(l, x, y, 7) x, y = l.XM, l.YM s.talon = self.Talon_Class(x, y, self) l.createText(s.talon, "se") l.createRoundText(s.talon, 'ne') y += l.YS s.waste = self.WasteStack_Class(x, y, self, max_accept=1) l.createText(s.waste, "se") x, y = self.width - l.XS, self.height-l.YS s.foundations.append(self.Foundation_Class(x, y, self, suit=ANY_SUIT, dir=0, base_rank=ANY_RANK, max_move=0, max_cards=104)) l.createText(s.foundations[0], 'sw') # define stack-groups l.defaultStackGroups() self.sg.openstacks.append(s.talon) self.sg.dropstacks.append(s.talon) self.sg.openstacks.append(s.waste)
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): 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()
def createGame(self, max_rounds=3): # create layout l, s = Layout(self, card_x_space=20, card_y_space=20), self.s # set window self.setSize(5*l.XS+l.XM, 4*l.YS+3*l.YM) # create stacks x, y = l.XM+1.5*l.XS, l.YM s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds) l.createText(s.talon, "sw") if max_rounds > 1: l.createRoundText(self.s.talon, 'nw') x += l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "se") x0, y0 = l.XM, l.YM+l.YS i = 0 for d in ((0, 0), (4, 0), (0, 2), (4, 2)): x, y = x0+d[0]*l.XS, y0+d[1]*l.YS s.foundations.append(SS_FoundationStack(x, y, self, suit=i, max_move=0, mod=13)) i += 1 for d in ((2, 0), (1, 1), (2, 1), (3, 1), (2, 2)): x, y = x0+d[0]*l.XS, y0+d[1]*l.YS stack = self.RowStack_Class(x, y, self) s.rows.append(stack) stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0 # define stack-groups l.defaultStackGroups()
def createGame(self, rows=4, texts=False, yoffset=None): # create layout l, s = Layout(self), self.s # set window if yoffset is None: yoffset = l.YOFFSET max_rows = max(rows, 4*self.gameinfo.decks) self.setSize(l.XM+(2+max_rows)*l.XS, l.YM+2*l.YS+12*yoffset) # create stacks if texts: x, y, = l.XM, l.YM+l.YS//2 else: x, y, = l.XM, l.YM s.talon = self.Talon_Class(x, y, self) l.createText(s.talon, "s") if texts: l.createRoundText(s.talon, 'nn') x, y = l.XM+2*l.XS, l.YM for i in range(4*self.gameinfo.decks): s.foundations.append( self.Foundation_Class(x, y, self, suit=i % 4)) x += l.XS x, y = l.XM+2*l.XS, l.YM+l.YS for i in range(rows): stack = self.RowStack_Class(x, y, self) s.rows.append(stack) stack.CARD_YOFFSET = yoffset x += l.XS # define stack-groups l.defaultStackGroups()
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()
def createGame(self): layout, s = Layout(self), self.s self.setSize(layout.XM + 8 * layout.XS, layout.YM + 2 * layout.YS) x, y = layout.XM, layout.YM c_rank = 12 for i in range(8): s.foundations.append( Precedence_Foundation(x, y, self, dir=-1, mod=13, base_rank=c_rank, max_move=0)) x += layout.XS c_rank -= 1 x, y = layout.XM + (layout.XS * 3), layout.YM + layout.YS s.talon = WasteTalonStack(x, y, self, max_rounds=3, num_deal=1) layout.createText(s.talon, 'nw') layout.createRoundText(s.talon, 'se', dx=layout.XS) x += layout.XS s.waste = WasteStack(x, y, self) layout.createText(s.waste, 'ne') # define stack-groups layout.defaultStackGroups()
def createGame(self, rows=8, playcards=12, texts=False): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM+max(9, rows)*l.XS, l.YM+3*l.YS+playcards*l.YOFFSET) # extra settings self.base_cards = None # create stacks for i in range(8): x, y, = l.XM + i*l.XS, l.YM s.reserves.append(ReserveStack(x, y, self, max_accept=0)) for i in range(8): x, y, = l.XM + i*l.XS, l.YM + l.YS s.foundations.append( Interregnum_Foundation(x, y, self, mod=13, max_move=0)) for i in range(rows): x, y, = l.XM + (2*i+8-rows)*l.XS//2, l.YM + 2*l.YS s.rows.append(self.RowStack_Class(x, y, self)) s.talon = self.Talon_Class(self.width-l.XS, self.height-l.YS, self) if texts: l.createRoundText(s.talon, 'nn') else: l.createText(s.talon, "n") # define stack-groups l.defaultStackGroups()
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()
def createGame(self): lay, s = Layout(self), self.s w, h = lay.XM + 6*lay.XS + 4*lay.XOFFSET, \ lay.YM + lay.TEXT_HEIGHT + 2*lay.YS + 12*lay.YOFFSET self.setSize(w, h) x, y = lay.XM, lay.YM s.talon = WasteTalonStack(x, y, self, max_rounds=3) lay.createText(s.talon, 's') lay.createRoundText(s.talon, 'ne', dx=lay.XS) x += lay.XS s.waste = WasteStack(x, y, self) lay.createText(s.waste, 's') x += lay.XS + 4 * lay.XOFFSET y = lay.YM for i in range(4): s.foundations.append(self.Foundation_Class(x, y, self, suit=i)) x += lay.XS x0, y0, w = lay.XM, lay.YM+lay.YS+2*lay.TEXT_HEIGHT,\ lay.XS+2*lay.XOFFSET for i, j in ((0, 0), (0, 1), (1, 0), (1, 1)): x, y = x0 + i * w, y0 + j * lay.YS stack = self.ReserveStack_Class(x, y, self, max_accept=0) stack.CARD_XOFFSET, stack.CARD_YOFFSET = lay.XOFFSET, 0 s.reserves.append(stack) x, y = lay.XM + 2 * lay.XS + 4 * lay.XOFFSET, lay.YM + lay.YS for i in range(4): s.rows.append(self.RowStack_Class(x, y, self)) x += lay.XS lay.defaultStackGroups()
def createGame(self, rows=7): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM + max(8, rows) * l.XS, l.YM + 5 * l.YS) # create stacks for i in range(8): x, y, = l.XM + i * l.XS, l.YM s.foundations.append( DieRussische_Foundation(x, y, self, i / 2, max_move=0, max_cards=8)) for i in range(rows): x, y, = l.XM + (2 * i + 8 - rows) * l.XS / 2, l.YM + l.YS s.rows.append(AC_RowStack(x, y, self)) s.talon = DieBoeseSieben_Talon(l.XM, self.height - l.YS, self, max_rounds=2) l.createText(s.talon, 'ne') l.createRoundText(s.talon, 'se') # define stack-groups l.defaultStackGroups()
def createGame(self): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM + 8*l.XS, l.YM + 4*l.YS) # create stacks x, y, = l.XM, l.YM for i in range(4): s.foundations.append(self.Foundation_Class(x, y, self, i, dir=2, mod=13)) x = x + l.XS for i in range(4): s.foundations.append(self.Foundation_Class(x, y, self, i, dir=2, mod=13, base_rank=1)) x = x + l.XS for i in range(2): x, y, = l.XM + ((4,3)[i])*l.XS, l.YM + (i+1)*l.YS for j in range((4,5)[i]): s.reserves.append(ReserveStack(x, y, self, max_accept=0)) x = x + l.XS x, y = l.XM, self.height - l.YS s.talon = WasteTalonStack(x, y, self, max_rounds=2) l.createText(s.talon, "n") l.createRoundText(s.talon, 'nnn') x = 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+9.5*l.XS, l.YM+3*l.YS) x, y = l.XM+1.5*l.XS, l.YM for i in range(8): stack = BetsyRoss_Foundation(x, y, self, base_rank=i, mod=13, dir=i+1, 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 = x + l.XS x, y = l.XM+1.5*l.XS, l.YM+2*l.YS for i in range(8): stack = SeniorWrangler_RowStack(x, y, self, max_accept=0) s.rows.append(stack) stack.CARD_YOFFSET = 0 x += l.XS x, y = l.XM, l.YM+l.YS s.talon = SeniorWrangler_Talon(x, y, self, max_rounds=9) l.createRoundText(s.talon, 'nn') # define stack-groups l.defaultStackGroups()
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, max_rounds=1): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM + 7*l.XS, l.YM + 4*l.YS) # create stacks x = l.XM+4*l.XS for fnd_cls in self.Foundation_Classes: y = l.YM for i in range(4): s.foundations.append(fnd_cls(x, y, self, suit=i)) y += l.YS x += l.XS for i in range(4): for j in range(2): x, y = l.XM + (3+3*j)*l.XS, l.YM + i*l.YS stack = self.RowStack_Class(x, y, self) stack.CARD_YOFFSET = 0 s.rows.append(stack) x, y, = l.XM, l.YM s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds) l.createText(s.talon, "s") x = x + l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "s") if max_rounds > 1: l.createRoundText(s.talon, 'ne', dx=l.XS) # define stack-groups l.defaultStackGroups()
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()
def createGame(self, max_rounds=1): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM+8*l.XS, l.YM+3*l.YS+12*l.YOFFSET+l.TEXT_HEIGHT) # create stacks x, y = l.XM, l.YM for i in range(8): s.foundations.append(self.Foundation_Class(x, y, self, suit=i/2)) x = x + l.XS x, y = l.XM, y + l.YS for i in range(8): s.rows.append(self.RowStack_Class(x, y, self)) x = 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") if max_rounds > 1: l.createRoundText(self.s.talon, 'nnn') x = x + l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "n") # define stack-groups l.defaultStackGroups()
def createGame(self): # create layout l, s = Layout(self), self.s # set window w = l.XM + 10.5*l.XS h = l.YM + 4*l.YS self.setSize(w, h) # create stacks x, y = l.XM+2*l.XS, l.YM s.rows = self._createInvertedPyramid(l, x, y, 7) x, y = l.XM, l.YM s.talon = self.Talon_Class(x, y, self) l.createText(s.talon, "se") l.createRoundText(s.talon, 'ne') y += l.YS s.waste = self.WasteStack_Class(x, y, self, max_accept=1) l.createText(s.waste, "se") x, y = self.width - l.XS, l.YM s.foundations.append(self.Foundation_Class(x, y, self, suit=ANY_SUIT, dir=0, base_rank=ANY_RANK, max_move=0, max_cards=52)) # define stack-groups l.defaultStackGroups() self.sg.openstacks.append(s.talon) self.sg.dropstacks.append(s.talon) self.sg.openstacks.append(s.waste)
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()
def createGame(self): # create layout l, s = Layout(self), self.s # set window w = l.XM + 9*l.XS h = l.YM + 4*l.YS self.setSize(w, h) # create stacks x, y = l.XM+1.5*l.XS, l.YM s.rows = self._createPyramid(l, x, y, 7) x, y = l.XM, l.YM s.talon = DealReserveRedealTalonStack(x, y, self, max_rounds=3) l.createText(s.talon, 'se') l.createRoundText(s.talon, 'ne') y += l.YS for i in range(3): stack = Pyramid_Waste(x, y, self, max_accept=1) s.reserves.append(stack) l.createText(stack, 'se') y += l.YS x, y = self.width - l.XS, l.YM s.foundations.append(Pyramid_Foundation(x, y, self, suit=ANY_SUIT, dir=0, base_rank=ANY_RANK, max_move=0, max_cards=52)) l.createText(s.foundations[0], 'nw') # define stack-groups l.defaultStackGroups()
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) # create stacks for dx, dy in ((0, 0), (1, 0), (2, 0), (0, 1), (2, 1), (0, 2), (2, 2)): x, y = l.XM + (2*dx+5)*l.XS//2, l.YM + (2*dy+1)*l.YS//2 s.rows.append(ReserveStack(x, y, self)) dx, dy = 1, 2 x, y = l.XM + (2*dx+5)*l.XS//2, l.YM + (2*dy+1)*l.YS//2 s.foundations.append(Doublets_Foundation(x, y, self, ANY_SUIT, dir=0, mod=13, max_move=0, max_cards=48)) l.createText(s.foundations[0], "s") # help = "A, 2, 4, 8, 3, 6, Q, J, 9, 5, 10, 7, A, ..." # self.texts.help = MfxCanvasText( # self.canvas, x + l.CW//2, y + l.YS + l.YM, anchor="n", text=help) x, y = l.XM, l.YM + 3*l.YS//2 s.talon = WasteTalonStack(x, y, self, max_rounds=3) l.createText(s.talon, "s") x = x + l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "s") l.createRoundText(s.talon, 'nn') # define stack-groups l.defaultStackGroups()
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()
def createGame(self): l, s = Layout(self), self.s self.setSize(l.XM+7*l.XS, l.YM+5*l.YS) for i, j in ((0, 0), (5, 0), (0, 4), (5, 4)): x, y = l.XM+l.XS+i*l.XS, l.YM+j*l.YS stack = LesQuatreCoins_RowStack(x, y, self, max_move=1, base_rank=NO_RANK) s.rows.append(stack) stack.CARD_YOFFSET = 0 for x in (l.XM+2*l.XS, l.XM+5*l.XS): y = l.YM+l.YS/2 for j in range(4): stack = LesQuatreCoins_RowStack(x, y, self, max_move=1, base_rank=NO_RANK) s.rows.append(stack) stack.CARD_YOFFSET = 0 y += l.YS x, y = l.XM+3*l.XS, l.YM+l.YS/2 for i in range(4): s.foundations.append(LesQuatreCoins_Foundation(x, y, self, suit=i)) y += l.YS x, y = l.XM+4*l.XS, l.YM+l.YS/2 for i in range(4): s.foundations.append(LesQuatreCoins_Foundation(x, y, self, suit=i, base_rank=KING, dir=-1)) y += l.YS x, y = l.XM, l.YM+2*l.YS s.talon = LesQuatreCoins_Talon(x, y, self, max_rounds=3) l.createText(s.talon, 's') l.createRoundText(s.talon, 'nn') l.defaultStackGroups()
def createGame(self): # create layout l, s = Layout(self), self.s ROW_LENGTH = self.ROW_LENGTH # set window w, h = l.XM + l.XS * (ROW_LENGTH + 5), l.YM + l.YS * (ROW_LENGTH + (ROW_LENGTH != 6)) self.setSize(w, h) # extra settings self.active_row = None # Create foundations x, y = l.XM, l.YM for j in range(2): for i in range(ROW_LENGTH): s.foundations.append(SS_FoundationStack(x, y, self, self.Base_Suit(i, j), max_cards = self.Max_Cards(i), mod = self.Mod(i), dir = self.DIR[j], base_rank = self.Base_Rank(i, j))) y = y + l.YS * (not j) x = x + l.XS * j x, y = x + l.XS * 2, l.YM # Create rows x, y = l.XM + l.XS, y + l.YS for i in range(self.MAX_ROW): s.rows.append(LarasGame_RowStack(x, y, self)) x = x + l.XS if i == ROW_LENGTH or i == ROW_LENGTH * 2 + 1 or i == ROW_LENGTH * 3 + 2: x, y = l.XM + l.XS, y + l.YS # Create reserves x, y = l.XM + l.XS * (ROW_LENGTH == 6), l.YM + l.YS * (ROW_LENGTH - (ROW_LENGTH == 6)) for i in range(20): s.reserves.append(LarasGame_ReserveStack(x, y, self, max_cards=2)) x = x + l.XS * (i < (ROW_LENGTH + 4)) - l.XS * (i == (ROW_LENGTH + 9)) y = y - l.YS * (i > (ROW_LENGTH + 3) and i < (ROW_LENGTH + 9)) + l.YS * (i > (ROW_LENGTH + 9)) # Create talon x, y = l.XM + l.XS * (ROW_LENGTH + 2), h - l.YM - l.YS * 3 s.talon = self.Talon_Class(x, y, self, max_rounds=self.MAX_ROUNDS) l.createText(s.talon, "s") if self.MAX_ROUNDS > 1: l.createRoundText(s.talon, 'nn') y = h - l.YS * 2 s.rows.append(LarasGame_RowStack(x, y, self, yoffset=0)) # Define stack-groups (not default) self.sg.openstacks = s.foundations + s.rows[:self.MAX_ROW] self.sg.talonstacks = [s.talon] + s.rows[-1:] self.sg.dropstacks = s.rows[:self.MAX_ROW] + s.reserves # Create relaxed reserve if self.Reserve_Class != None: x, y = l.XM + l.XS * (ROW_LENGTH + 2), l.YM + l.YS * .5 s.reserves.append(self.Reserve_Class(x, y, self, max_accept=1, max_cards=self.Reserve_Cards)) self.sg.openstacks = self.sg.openstacks + s.reserves[19:] self.sg.dropstacks = self.sg.dropstacks + s.reserves[19:] self.setRegion(s.reserves[19:], (x - l.XM / 2, 0, 99999, 99999))
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()
def createGame(self): layout, s = Layout(self), self.s self.setSize( layout.XM + 9 * layout.XS, layout.YM + 3 * layout.YS + 7 * layout.YOFFSET + 2 * layout.TEXT_HEIGHT) x, y = layout.XM + 4 * layout.XS, layout.YM stack = DevilsSolitaire_Foundation(x, y, self, suit=ANY_SUIT, base_rank=ANY_RANK, mod=13) tx, ty, ta, tf = layout.getTextAttr(stack, 'nw') font = self.app.getFont('canvas_default') stack.texts.misc = MfxCanvasText(self.canvas, tx, ty, anchor=ta, font=font) s.foundations.append(stack) x, y = self.width - layout.XS, layout.YM stack = AbstractFoundationStack(x, y, self, suit=ANY_SUIT, max_move=0, max_cards=104, max_accept=0, base_rank=ANY_RANK) layout.createText(stack, 'nw') s.foundations.append(stack) x, y = layout.XM, layout.YM + layout.YS for i in range(4): s.rows.append(Vague_RowStack(x, y, self)) x += layout.XS x += layout.XS for i in range(4): s.rows.append(Vague_RowStack(x, y, self)) x += layout.XS x, y = layout.XM + 4 * layout.XS, layout.YM + layout.YS stack = OpenStack(x, y, self) stack.CARD_YOFFSET = layout.YOFFSET s.reserves.append(stack) x, y = layout.XM + 4.5 * layout.XS, self.height - layout.YS s.talon = WasteTalonStack(x, y, self, max_rounds=3) layout.createText(s.talon, 'n') layout.createRoundText(s.talon, 'nnn') x -= layout.XS s.waste = DevilsSolitaire_WasteStack(x, y, self) layout.createText(s.waste, 'n') layout.defaultStackGroups()
def createGame(self): # create layout l, s = Layout(self), self.s # set window self.setSize(l.XM + 11 * l.XS, l.YM + 3 * l.YS + 16 * l.YOFFSET) # create stacks # x, y = l.XM, self.height - l.YS s.talon = DoubleFives_Talon(x, y, self, max_rounds=2, num_deal=1) l.createText(s.talon, "n") l.createRoundText(self.s.talon, 'nnn') x += l.XS for i in range(5): s.reserves.append(DoubleFives_WasteStack(x, y, self)) x += l.XS l.createText(s.reserves[0], 'n') # x = self.width - l.XS s.addattr(stock=None) # register extra stack variable s.stock = DoubleFives_Stock(x, y, self) l.createText(s.stock, "n") # x, y = l.XM, l.YM s.reserves.append(Glenwood_ReserveStack(x, y, self)) x += l.XS s.reserves.append(Glenwood_ReserveStack(x, y, self)) # x += 2 * l.XS for i in range(8): s.foundations.append( Glenwood_Foundation(x, y, self, suit=i / 2, mod=13, base_rank=ANY_RANK, max_move=0)) x += l.XS tx, ty, ta, tf = l.getTextAttr(None, "ss") tx, ty = x - l.XS + tx, y + ty font = self.app.getFont("canvas_default") self.texts.info = MfxCanvasText(self.canvas, tx, ty, anchor=ta, font=font) x, y = l.XM + l.XS / 2, l.YM + l.YS + l.TEXT_HEIGHT for i in range(10): s.rows.append(DoubleFives_RowStack(x, y, self, mod=13, max_move=1)) x += l.XS # define stack-groups l.defaultStackGroups()
def createGame(self): # create layout l, s = Layout(self), self.s font = self.app.getFont("canvas_default") # set window # (piles up to 20 cards are playable - needed for Braid_BraidStack) decks = self.gameinfo.decks h = max(4 * l.YS + 30, l.YS + (self.BRAID_CARDS - 1) * l.YOFFSET) self.setSize(l.XM + (8 + decks) * l.XS, l.YM + h) # extra settings self.base_card = None # create stacks s.addattr(braid=None) # register extra stack variable x, y = l.XM, l.YM for i in range(2): s.rows.append(Braid_RowStack(x + 0.5 * l.XS, y, self)) s.rows.append(Braid_RowStack(x + 4.5 * l.XS, y, self)) y = y + 3 * l.YS y = l.YM + l.YS for i in range(2): s.rows.append(Braid_ReserveStack(x, y, self)) s.rows.append(Braid_ReserveStack(x + l.XS, y, self)) s.rows.append(Braid_ReserveStack(x, y + l.YS, self)) s.rows.append(Braid_ReserveStack(x + l.XS, y + l.YS, self)) x = x + 4 * l.XS x, y = l.XM + l.XS * 5 // 2, l.YM s.braid = Braid_BraidStack(x, y, self) x, y = l.XM + 7 * l.XS, l.YM + l.YS * 3 // 2 s.talon = WasteTalonStack(x, y, self, max_rounds=3) l.createText(s.talon, "s") l.createRoundText(s.talon, 'nn') x -= l.XS s.waste = WasteStack(x, y, self) l.createText(s.waste, "s") y = l.YM for i in range(4): x = l.XM + 8 * l.XS for cl in self.Foundation_Classes: s.foundations.append(cl(x, y, self, suit=i)) x += l.XS y = y + l.YS x = l.XM + 8 * l.XS + decks * l.XS // 2 self.texts.info = MfxCanvasText(self.canvas, x, y, anchor="n", font=font) # define stack-groups self.sg.talonstacks = [s.talon] + [s.waste] self.sg.openstacks = s.foundations + s.rows self.sg.dropstacks = [s.braid] + s.rows + [s.waste]
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()
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()
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()
def createGame(self, max_rounds=1, num_deal=1, rows=10, playcards=12, XCARDS=64, XOFFSET=None): # create layout if XOFFSET is None: l, s = Layout(self), self.s else: l, s = Layout(self, XOFFSET=XOFFSET), self.s # set window # (compute best XOFFSET - up to 64/72 cards can be in the Waste) decks = self.gameinfo.decks maxrows = max(rows, 4*decks) if maxrows <= 12: maxrows += 1 w1, w2 = maxrows*l.XS+l.XM, 2*l.XS if w2 + XCARDS * l.XOFFSET > w1: l.XOFFSET = int((w1 - w2) / XCARDS) # (piles up to 12 cards are playable without overlap # in default window size) h = max(2*l.YS, l.YS+(playcards-1)*l.YOFFSET) self.setSize(w1, l.YM + l.YS + h + l.YS + l.TEXT_HEIGHT) # create stacks # foundations x = l.XM + (maxrows - 4*decks) * l.XS // 2 y = l.YM for i in range(4*decks): s.foundations.append( self.Foundation_Class( x, y, self, suit=i//decks, max_move=self.FOUNDATION_MAX_MOVE)) x = x + l.XS # rows x = l.XM + (maxrows - rows) * l.XS // 2 y = l.YM + l.YS for i in range(rows): s.rows.append(self.RowStack_Class(x, y, self, max_move=self.ROW_MAX_MOVE)) x = x + l.XS # talon, waste x = self.width - l.XS y = self.height - l.YS s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds, num_deal=num_deal) l.createText(s.talon, "n") if max_rounds > 1: l.createRoundText(s.talon, 'nnn') x -= l.XS s.waste = WasteStack(x, y, self) s.waste.CARD_XOFFSET = -l.XOFFSET l.createText(s.waste, "n") # define stack-groups l.defaultStackGroups()