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()
def createGame(self, **layout): # create layout l, s = Layout(self), self.s # set window w, h = l.XM+11*l.XS, l.YM+max(5*l.YS, 2*l.YS+16*l.YOFFSET) self.setSize(w, h) # create stacks x, y = l.XM, l.YM+l.YS for i in range(4): s.foundations.append(SS_FoundationStack(x, y, self, suit=i)) y += l.YS x, y = l.XM+10*l.XS, l.YM+l.YS 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 = l.XM+1.5*l.XS, l.YM for i in range(8): s.reserves.append(ReserveStack(x, y, self)) x += l.XS x, y = l.XM+1.5*l.XS, l.YM+l.YS for i in range(8): s.rows.append(UD_SS_RowStack(x, y, self)) x += l.XS s.talon = Cicely_Talon(l.XM, l.YM, self) l.createText(s.talon, "ne") l.setRegion(s.rows, (l.XM+1.5*l.XS-l.CW/2, l.YM+l.YS-l.CH/2, w-1.5*l.XS-l.CW/2, 999999)) # define stack-groups l.defaultStackGroups()
def createGame(self, playcards=13, reserves=0, texts=False): # create layout l, s = Layout(self), self.s # set window # (set size so that at least 13 cards are fully playable) w = max(3 * l.XS, l.XS + (playcards - 1) * l.XOFFSET) x0 = l.XM x1 = x0 + w + 2 * l.XM x2 = x1 + l.XS + 2 * l.XM x3 = x2 + w + l.XM h = l.YM + (4 + int(reserves != 0)) * l.YS + int(texts) * l.TEXT_HEIGHT self.setSize(x3, h) # create stacks y = l.YM if reserves: x = x1 - int(l.XS * (reserves - 1) / 2) for i in range(reserves): s.reserves.append(ReserveStack(x, y, self)) x += l.XS y += l.YS x = x1 for i in range(4): s.foundations.append( self.Foundation_Class(x, y, self, suit=i, max_move=0)) y += l.YS if texts: tx, ty, ta, tf = l.getTextAttr(None, "ss") tx, ty = x + tx, y - l.YS + ty font = self.app.getFont("canvas_default") self.texts.info = MfxCanvasText(self.canvas, tx, ty, anchor=ta, font=font) for x in (x0, x2): y = l.YM + l.YS * int(reserves != 0) for i in range(4): stack = self.RowStack_Class(x, y, self) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 s.rows.append(stack) y += l.YS x, y = self.width - l.XS, self.height - l.YS s.talon = InitialDealTalonStack(x, y, self) if reserves: l.setRegion( s.rows[:4], (-999, l.YM + l.YS - l.CH // 2, x1 - l.CW // 2, 999999)) else: l.setRegion(s.rows[:4], (-999, -999, x1 - l.CW // 2, 999999)) # default l.defaultAll()
def createGame(self, rows=8, playcards=13, reserve_max_cards=4): # create layout l, s = Layout(self), self.s decks = self.gameinfo.decks # set window # (set size so that at least 13 cards are fully playable) w = max(3*l.XS, l.XS+playcards*l.XOFFSET) self.setSize(l.XM+2*w+decks*l.XS, l.YM+l.TEXT_HEIGHT+(rows//2+1)*l.YS) # create stacks y = l.YM x = l.XM + w 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 stack = Zerline_ReserveStack(x, y, self, max_cards=reserve_max_cards) s.reserves.append(stack) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 l.createText(stack, "s") x = l.XM + w for j in range(decks): y = l.YM+l.TEXT_HEIGHT+l.YS for i in range(4): s.foundations.append( SS_FoundationStack( x, y, self, i, base_rank=KING, dir=1, max_move=0, mod=13)) y += l.YS x += l.XS x = l.XM for j in range(2): y = l.YM+l.TEXT_HEIGHT+l.YS for i in range(rows//2): stack = RK_RowStack( x, y, self, max_move=1, max_accept=1, base_rank=QUEEN) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 s.rows.append(stack) y += l.YS x += l.XM+w+decks*l.XS l.setRegion( s.rows[:4], (-999, l.YM+l.YS+l.TEXT_HEIGHT-l.CH//2, w-l.CW//2, 999999)) # define stack-groups l.defaultStackGroups() # set regions l.defaultRegions()
def createGame(self, playcards=13, reserves=0, texts=False): # create layout l, s = Layout(self), self.s # set window # (set size so that at least 13 cards are fully playable) w = max(3*l.XS, l.XS+(playcards-1)*l.XOFFSET) x0 = l.XM x1 = x0 + w + 2*l.XM x2 = x1 + l.XS + 2*l.XM x3 = x2 + w + l.XM h = l.YM + (4+int(reserves != 0))*l.YS + int(texts)*l.TEXT_HEIGHT self.setSize(x3, h) # create stacks y = l.YM if reserves: x = x1 - int(l.XS*(reserves-1)/2) for i in range(reserves): s.reserves.append(ReserveStack(x, y, self)) x += l.XS y += l.YS x = x1 for i in range(4): s.foundations.append( self.Foundation_Class(x, y, self, suit=i, max_move=0)) y += l.YS if texts: tx, ty, ta, tf = l.getTextAttr(None, "ss") tx, ty = x+tx, y-l.YS+ty font = self.app.getFont("canvas_default") self.texts.info = MfxCanvasText(self.canvas, tx, ty, anchor=ta, font=font) for x in (x0, x2): y = l.YM+l.YS*int(reserves != 0) for i in range(4): stack = self.RowStack_Class(x, y, self) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 s.rows.append(stack) y += l.YS x, y = self.width - l.XS, self.height - l.YS s.talon = InitialDealTalonStack(x, y, self) if reserves: l.setRegion( s.rows[:4], (-999, l.YM+l.YS-l.CH//2, x1-l.CW//2, 999999)) else: l.setRegion(s.rows[:4], (-999, -999, x1-l.CW//2, 999999)) # default l.defaultAll()
def createGame(self): # create layout l, s = Layout(self), self.s # set window # (set size so that at least 13 cards are fully playable) w = max(3 * l.XS, l.XS + 13 * l.XOFFSET) self.setSize(l.XM + 2 * w + 2 * l.XS, l.YM + 5 * l.YS + l.TEXT_HEIGHT) # create stacks x, y = l.XM, l.YM + 4 * l.YS s.talon = InitialDealTalonStack(x, y, self) x, y = l.XM + w - l.XS, self.height - l.YS for i in range(4): stack = OpenStack(x, y, self, max_accept=0) s.reserves.append(stack) l.createText(stack, 'n') x += l.XS x = l.XM + w for x in (l.XM + w, l.XM + w + l.XS): y = l.YM for i in range(4): s.foundations.append(RK_FoundationStack(x, y, self, max_move=0)) y += l.YS for x in (l.XM, l.XM + w + 2 * l.XS): y = l.YM for i in range(4): stack = RK_RowStack(x, y, self, max_move=1, max_accept=1, base_rank=ANY_RANK) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 s.rows.append(stack) y += l.YS l.setRegion(s.rows[:4], (-999, -999, w - l.CW // 2, l.YM + 4 * l.YS - l.CH // 2)) # define stack-groups l.defaultStackGroups() # set regions l.defaultRegions()
def createGame(self): # create layout l, s = Layout(self), self.s # set window # (set size so that at least 13 cards are fully playable) w = max(3*l.XS, l.XS+13*l.XOFFSET) self.setSize(l.XM+2*w+2*l.XS, l.YM + 5*l.YS + l.TEXT_HEIGHT) # create stacks x, y = l.XM, l.YM+4*l.YS s.talon = InitialDealTalonStack(x, y, self) x, y = l.XM+w-l.XS, self.height-l.YS for i in range(4): stack = OpenStack(x, y, self, max_accept=0) s.reserves.append(stack) l.createText(stack, 'n') x += l.XS x = l.XM + w for x in (l.XM + w, l.XM + w + l.XS): y = l.YM for i in range(4): s.foundations.append(RK_FoundationStack(x, y, self, max_move=0)) y += l.YS for x in (l.XM, l.XM + w + 2*l.XS): y = l.YM for i in range(4): stack = RK_RowStack( x, y, self, max_move=1, max_accept=1, base_rank=ANY_RANK) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 s.rows.append(stack) y += l.YS l.setRegion(s.rows[:4], (-999, -999, w-l.CW//2, l.YM+4*l.YS-l.CH//2)) # define stack-groups l.defaultStackGroups() # set regions l.defaultRegions()
tx, ty, ta, tf = l.getTextAttr(None, "ss") tx, ty = x+tx, y-l.YS+ty font = self.app.getFont("canvas_default") self.texts.info = MfxCanvasText(self.canvas, tx, ty, anchor=ta, font=font) for x in (x0, x2): y = l.YM+l.YS*int(reserves!=0) for i in range(4): stack = self.RowStack_Class(x, y, self) stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0 s.rows.append(stack) y += l.YS x, y = self.width - l.XS, self.height - l.YS s.talon = InitialDealTalonStack(x, y, self) if reserves: l.setRegion(s.rows[:4], (-999, l.YM+l.YS-l.CH/2, x1-l.CW/2, 999999)) else: l.setRegion(s.rows[:4], (-999, -999, x1-l.CW/2, 999999)) # default l.defaultAll() # # game overrides # def startGame(self): for i in range(4): self.s.talon.dealRow(frames=0) self.startDealSample() for i in range(2): self.s.talon.dealRow()