本文整理汇总了Python中hand.Hand.hole_cards方法的典型用法代码示例。如果您正苦于以下问题:Python Hand.hole_cards方法的具体用法?Python Hand.hole_cards怎么用?Python Hand.hole_cards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hand.Hand
的用法示例。
在下文中一共展示了Hand.hole_cards方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_single_hand
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import hole_cards [as 别名]
def read_single_hand(self, file_in, active_player):
"""Reads the components of a PokerStars hand in a PoserStars text file and returns them in a Hand object.
The current position of the file must me that the next file_in.readline() will return the first line of
the hand to read.
The active_player provided must be the one that the hole cards are shown in the file, or the function
will return an error.
Args:
file_in (File) : The PokerStars hand text file we are working on, already opened by the master function.
active_player (Player) : The active player in the file (the one we know the hole cards)
Returns:
(Hand) : A complete Hand object containing the information gathered.
"""
stack = -1 # Temporary variable used to get the active player chips from the txt file
current_hand = Hand(0, 0, [Card(0, "c"), Card(0, "c")], 0)
try:
[
current_hand.handNumber,
current_hand.tournamentNumber,
current_hand.timeStarted,
] = self.read_hand_starting_line(file_in.readline())
# TODO: Change the function so it reads the number of seats at the table, and not always 9 seats
while True:
file_position = file_in.tell()
stack = self.read_hand_seat_line(file_in.readline(), active_player)
if stack == -1: # Done reading hand seat lines
file_in.seek(file_position)
break
while True:
loss = self.read_blind_line(file_in.readline(), active_player)
if loss == None:
break
current_hand.loss += loss
current_hand.hole_cards = self.read_hole_cards_line(file_in.readline(), active_player)
while True:
value = self.read_bet_line(file_in.readline(), active_player)
if value == 0:
break
elif value == None:
continue
elif value < 0:
current_hand.loss += -value
else:
current_hand.gain += value
active_player.stack = stack
return current_hand
finally:
a = 0