本文整理汇总了Python中hand.Hand.rank方法的典型用法代码示例。如果您正苦于以下问题:Python Hand.rank方法的具体用法?Python Hand.rank怎么用?Python Hand.rank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hand.Hand
的用法示例。
在下文中一共展示了Hand.rank方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import rank [as 别名]
class Player:
'''The player has a hand, money, and makes decisions during each round, taking community card information and passing hand information to the dealer.'''
hand = []
community = []
money = 100
bet = 0
def __init__(self):
'''Basic constructor, to declare type.'''
self.money = 100
return
def __init__(self,hand=None):
'''Optional hand parameter gives a player hole cards.'''
self.hand = Hand(hand)
self.money = 100
return
def __init__(self,hand=None,money=None):
'''Optional money parameter defines staring money.'''
self.hand = Hand(hand)
self.money = money
return
def setcommunity(self,community):
'''Gives a player information about the community cards.'''
self.community = community
return
def getrank(self):
'''Allows a player to determine their hand's current rank.'''
return self.hand.rank(self.hand.highest(self.community))
def fold(self,bet):
self.money -= bet
return
def raisepot(self,deal,bet):
deal.raisepot(self,bet)
return
def gethand(self):
'''Returns the cards in hand.'''
return self.hand.getcards()