本文整理汇总了Python中pysollib.stack.AC_RowStack类的典型用法代码示例。如果您正苦于以下问题:Python AC_RowStack类的具体用法?Python AC_RowStack怎么用?Python AC_RowStack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AC_RowStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createGame
def createGame(self):
# create layout
l, s = Layout(self), self.s
# set window
self.setSize(l.XM+10*l.XS, max(l.YM+2*l.YS+12*l.YOFFSET,
l.YM+5*l.YS))
# create stacks
x = l.XM
for i in range(2):
y = l.YM+l.YS
for j in range(4):
s.foundations.append(SS_FoundationStack(x, y, self, suit=j))
y += l.YS
x += l.XS
x, y = l.XM+2*l.XS, l.YM
for i in range(8):
stack = AC_RowStack(x, y, self, max_move=1)
stack.getBottomImage = stack._getReserveBottomImage
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
s.rows.append(stack)
x += l.XS
x, y = l.XM+2*l.XS, l.YM+l.YS
for i in range(8):
stack = OpenStack(x, y, self, max_accept=0)
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
s.reserves.append(stack)
x += l.XS
s.talon = KingsdownEights_Talon(l.XM, l.YM, self, max_rounds=1)
l.createText(s.talon, "se")
# define stack-groups
l.defaultStackGroups()
示例2: createGame
def createGame(self, max_rounds=2):
l, s = Layout(self), self.s
self.setSize(l.XM+8*l.XS, l.YM+4*l.YS)
self.base_card = None
i = 0
for x, y in ((l.XM, l.YM),
(l.XM+7*l.XS, l.YM),
(l.XM, l.YM+3*l.YS),
(l.XM+7*l.XS, l.YM+3*l.YS),
):
s.foundations.append(
SS_FoundationStack(x, y, self, suit=i, mod=13))
i += 1
y = l.YM+l.YS
for i in range(2):
x = l.XM+l.XS
for j in range(6):
stack = AC_RowStack(x, y, self, max_move=1, mod=13)
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
s.rows.append(stack)
x += l.XS
y += l.YS
x, y = l.XM+3*l.XS, l.YM
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()
示例3: createGame
def createGame(self):
l, s = Layout(self), self.s
self.setSize(l.XM + 8*l.XS, l.YM + 4.5*l.YS)
x, y = l.XM, l.YM
for i in range(8):
s.foundations.append(TheRedAndTheBlack_Foundation(x, y, self,
suit=i//2))
x += l.XS
x, y = l.XM+2*l.XS, l.YM+l.YS
for i in range(4):
stack = AC_RowStack(x, y, self, max_move=1)
stack.getBottomImage = stack._getReserveBottomImage
stack.CARD_YOFFSET = 0
s.rows.append(stack)
x += l.XS
x, y = l.XM+2*l.XS, l.YM+2*l.YS
for i in range(4):
s.reserves.append(TheRedAndTheBlack_Reserve(x, y, self))
x += l.XS
x, y = l.XM+3*l.XS, l.YM+3.5*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")
# define stack-groups
l.defaultStackGroups()
示例4: acceptsCards
def acceptsCards(self, from_stack, cards):
if not AC_RowStack.acceptsCards(self, from_stack, cards):
return False
if not self.cards:
return (from_stack is self.game.s.talon or
from_stack in self.game.s.reserves)
return True
示例5: moveMove
def moveMove(self, ncards, to_stack, frames=-1, shadow=-1):
state = self.game.getState()
if state > 0:
AC_RowStack.moveMove(
self, ncards, to_stack, frames=frames, shadow=shadow)
return
assert to_stack in self.game.s.foundations
assert ncards == 1
assert not self.game.s.waste.cards
self.game.moveMove(
ncards, self, to_stack, frames=frames, shadow=shadow)
for s in self.game.s.foundations:
s.cap.base_rank = to_stack.cards[0].rank
freerows = [s for s in self.game.s.rows if not s.cards]
self.game.s.talon.dealRow(rows=freerows, sound=True)
self.game.s.talon.dealCards() # deal first card to WasteStack
示例6: acceptsCards
def acceptsCards(self, from_stack, cards):
if not AC_RowStack.acceptsCards(self, from_stack, cards):
return False
if (from_stack in self.game.s.reserves or
from_stack in self.game.s.foundations):
return False
return True
示例7: acceptsCards
def acceptsCards(self, from_stack, cards):
if not self.basicAcceptsCards(from_stack, cards):
return 0
stackcards = self.cards
if stackcards:
if (stackcards[-1].suit == 4 or cards[0].suit == 4):
return stackcards[-1].rank == cards[0].rank + 1
return AC_RowStack.acceptsCards(self, from_stack, cards)
示例8: canMoveCards
def canMoveCards(self, cards):
if self.game.base_rank is None:
return False
if not AC_RowStack.canMoveCards(self, cards):
return False
if len(cards) == 1 or len(self.cards) == len(cards):
return True
return False
示例9: acceptsCards
def acceptsCards(self, from_stack, cards):
if not AC_RowStack.acceptsCards(self, from_stack, cards):
return False
if not self.cards and from_stack is self.game.s.waste:
for stack in self.game.s.reserves:
if stack.cards:
return False
return True
if from_stack in self.game.s.rows and \
len(cards) != len(from_stack.cards):
return False
return True
示例10: basicAcceptsCards
def basicAcceptsCards(self, from_stack, cards):
if from_stack in self.game.s.rows:
if len(cards) != 1 and len(cards) != len(from_stack.cards):
return False
return AC_RowStack.basicAcceptsCards(self, from_stack, cards)
示例11: acceptsCards
def acceptsCards(self, from_stack, cards):
if self.game.getState() == 0:
return False
if from_stack in self.game.s.reserves:
return False
return AC_RowStack.acceptsCards(self, from_stack, cards)
示例12: __init__
def __init__(self, x, y, game, **cap):
kwdefault(cap, mod=13, max_move=1)
AC_RowStack.__init__(self, x, y, game, **cap)
示例13: acceptsCards
def acceptsCards(self, from_stack, cards):
if not AC_RowStack.acceptsCards(self, from_stack, cards):
return False
if from_stack is self.game.s.waste:
return False
return True
示例14: acceptsCards
def acceptsCards(self, from_stack, cards):
if not AC_RowStack.acceptsCards(self, from_stack, cards):
return False
if from_stack in self.game.s.reserves:
return False
return True
示例15: acceptsCards
def acceptsCards(self, from_stack, cards):
if not AC_RowStack.acceptsCards(self, from_stack, cards):
return False
if self.cards:
return len(cards) == 1
return True