addPlayerCards done - now need to print it

This commit is contained in:
Worros 2009-02-27 00:35:15 +09:00
parent 7f1fd2ca38
commit 6d862cff52
2 changed files with 22 additions and 6 deletions

View File

@ -191,12 +191,12 @@ class FullTilt(HandHistoryConverter):
print hand.streets.group(street) print hand.streets.group(street)
for player in m: for player in m:
print player.groups() print player.groups()
#hand.hero = m.group('PNAME')
# "2c, qh" -> set(["2c","qc"])
# Also works with Omaha hands.
cards = player.group('CARDS') cards = player.group('CARDS')
if player.group('NEWCARD') != None:
print cards
cards = cards + " " + player.group('NEWCARD')
cards = set(cards.split(' ')) cards = set(cards.split(' '))
# hand.addHoleCards(cards, m.group('PNAME')) hand.addPlayerCards(cards, player.group('PNAME'))
def readAction(self, hand, street): def readAction(self, hand, street):
m = self.re_Action.finditer(hand.streets.group(street)) m = self.re_Action.finditer(hand.streets.group(street))

View File

@ -146,6 +146,22 @@ player (string) name of player
except FpdbParseError, e: except FpdbParseError, e:
print "[ERROR] Tried to add holecards for unknown player: %s" % (player,) print "[ERROR] Tried to add holecards for unknown player: %s" % (player,)
def addPlayerCards(self, cards, player):
"""\
Assigns observed cards to a player.
cards set of card bigrams e.g. set(['2h','Jc'])
player (string) name of player
Should probably be merged with addHoleCards
"""
print "DEBUG: addPlayerCards", cards,player
try:
self.checkPlayerExists(player)
cards = set([self.card(c) for c in cards])
self.holecards[player].update(cards)
except FpdbParseError, e:
print "[ERROR] Tried to add holecards for unknown player: %s" % (player,)
def addShownCards(self, cards, player, holeandboard=None): def addShownCards(self, cards, player, holeandboard=None):
"""\ """\
For when a player shows cards for any reason (for showdown or out of choice). For when a player shows cards for any reason (for showdown or out of choice).
@ -514,12 +530,12 @@ Map the tuple self.gametype onto the pokerstars string describing it
if 'ANTES' in self.actions: if 'ANTES' in self.actions:
for act in self.actions['ANTES']: for act in self.actions['ANTES']:
print act
print >>fh, _("%s: posts the ante $%s" %(act[0], act[3])) print >>fh, _("%s: posts the ante $%s" %(act[0], act[3]))
if 'THIRD' in self.actions: if 'THIRD' in self.actions:
print >>fh, _("*** 3RD STREET ***") print >>fh, _("*** 3RD STREET ***")
for player in [x for x in self.players if x[1] in players_who_post_antes]:
print >>fh, _("Dealt to ")
for act in self.actions['THIRD']: for act in self.actions['THIRD']:
#FIXME: Need some logic here for bringin vs completes #FIXME: Need some logic here for bringin vs completes
self.printActionLine(act, fh) self.printActionLine(act, fh)