本文整理匯總了Python中pysollib.stack.BasicRowStack.acceptsCards方法的典型用法代碼示例。如果您正苦於以下問題:Python BasicRowStack.acceptsCards方法的具體用法?Python BasicRowStack.acceptsCards怎麽用?Python BasicRowStack.acceptsCards使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pysollib.stack.BasicRowStack
的用法示例。
在下文中一共展示了BasicRowStack.acceptsCards方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
if from_stack is self.game.s.talon or \
from_stack in self.game.s.reserves:
return True
return False
示例2: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
# check
if self.cards or self.game.s.talon.cards:
return False
return True
示例3: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
if self.id % self.game.RSTEP == 0:
return cards[0].rank == self.game.RBASE
left = self.game.s.rows[self.id - 1]
return left.cards and left.cards[-1].rank + 1 == cards[0].rank
示例4: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
if not self.cards:
return True
c1, c2 = self.cards[-1], cards[0]
if c1.rank == c2.rank+1:
return True
return c1.rank == c2.rank
示例5: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
if self.cards:
# check the rank - an ACE equals a Six
rank = self.cards[-1].rank
if rank == ACE:
rank = 5
if (rank + self.cap.dir) % self.cap.mod != cards[0].rank:
return False
return True
示例6: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
if self.id % 10 != 0:
# left neighbour
s = self.game.s.rows[self.id - 1]
if s.cards and s.cards[-1].suit == cards[0].suit \
and (s.cards[-1].rank + 1) % 13 == cards[0].rank:
return True
if self.id % 10 != 10 - 1:
# right neighbour
s = self.game.s.rows[self.id + 1]
if s.cards and s.cards[-1].suit == cards[0].suit \
and (s.cards[-1].rank - 1) % 13 == cards[0].rank:
return True
return False
示例7: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
# this stack accepts any one card from the Waste pile
return from_stack is self.game.s.waste
示例8: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return 0
# check
return not (self.cards or self.game.s.talon.cards)
示例9: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
return len(self.cards) == 0
示例10: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return 0
if not self.cards:
return 1
return self.cards[-1].rank > cards[0].rank
示例11: acceptsCards
# 需要導入模塊: from pysollib.stack import BasicRowStack [as 別名]
# 或者: from pysollib.stack.BasicRowStack import acceptsCards [as 別名]
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
# this stack accepts any one card from the Talon
return from_stack is self.game.s.talon and len(cards) == 1