wasn't printing bets

and fixed last fix
This commit is contained in:
Matt Turnbull 2008-12-10 00:48:45 +00:00
parent 215d5a74b2
commit 91105824bd
2 changed files with 29 additions and 14 deletions

View File

@ -188,15 +188,19 @@ class Everleaf(HandHistoryConverter):
m = self.rexx.action_re.finditer(hand.streets.group(street)) m = self.rexx.action_re.finditer(hand.streets.group(street))
hand.actions[street] = [] hand.actions[street] = []
for action in m: for action in m:
if action.group('ATYPE') == 'raises': if action.group('ATYPE') == ' raises':
hand.addRaiseTo( street, action.group('PNAME'), action.group('BET') ) hand.addRaiseTo( street, action.group('PNAME'), action.group('BET') )
elif action.group('ATYPE') == 'calls': elif action.group('ATYPE') == ' calls':
hand.addCall( street, action.group('PNAME'), action.group('BET') ) hand.addCall( street, action.group('PNAME'), action.group('BET') )
elif action.group('ATYPE') == 'bets': elif action.group('ATYPE') == ': bets':
hand.addBet( street, action.group('PNAME'), action.group('BET') ) hand.addBet( street, action.group('PNAME'), action.group('BET') )
elif action.group('ATYPE') == ' folds':
hand.addFold( street, action.group('PNAME'))
elif action.group('ATYPE') == ' checks':
hand.addCheck( street, action.group('PNAME'))
else: else:
#print "DEBUG: unimplemented readAction: %s %s" %(action.group('PNAME'),action.group('ATYPE'),) print "DEBUG: unimplemented readAction: %s %s" %(action.group('PNAME'),action.group('ATYPE'),)
hand.actions[street] += [[action.group('PNAME'), action.group('ATYPE')]] #hand.actions[street] += [[action.group('PNAME'), action.group('ATYPE')]]
def readShowdownActions(self, hand): def readShowdownActions(self, hand):

View File

@ -353,9 +353,15 @@ class Hand:
def addBet(self, street, player=None, amount=0): def addBet(self, street, player=None, amount=0):
self.bets[street][player].append(Decimal(amount)) self.bets[street][player].append(Decimal(amount))
self.orderedBets[street].append(Decimal(amount)) #self.orderedBets[street].append(Decimal(amount))
self.actions[street] += [[player, 'bets', amount]] self.actions[street] += [[player, 'bets', amount]]
def addFold(self, street, player):
self.actions[street] += [[player, 'folds']]
def addCheck(self, street, player):
self.actions[street] += [[player, 'checks']]
def addCollectPot(self,player, pot): def addCollectPot(self,player, pot):
if player not in self.collected: if player not in self.collected:
self.collected[player] = pot self.collected[player] = pot
@ -401,7 +407,7 @@ Known bug: doesn't take into account side pots"""
print "*** HOLE CARDS ***" print "*** HOLE CARDS ***"
if self.involved: if self.involved:
print "Dealt to %s [%s %s]" %(self.hero , self.holecards[self.hero][0], self.holecards[self.hero][1]) print "Dealt to %s [%s]" %(self.hero , " ".join(self.holecards[self.hero]))
if 'PREFLOP' in self.actions: if 'PREFLOP' in self.actions:
for act in self.actions['PREFLOP']: for act in self.actions['PREFLOP']:
@ -435,18 +441,21 @@ Known bug: doesn't take into account side pots"""
for s in self.board.values(): for s in self.board.values():
board += s board += s
if board: # sometimes hand ends preflop without a board if board: # sometimes hand ends preflop without a board
print "Board [%s]" % (board) print "Board [%s]" % (" ".join(board))
#print self.board #print self.board
for player in self.players: for player in self.players:
if player[1] in self.collected and self.holecards[player[1]]: seatnum = player[0]
print "Seat %d: %s showed [%s %s] and won ($%s)" % (player[0], player[1], self.holecards[player[1]][0], self.holecards[player[1]][1], self.collected[player[1]]) name = player[1]
elif player[1] in self.collected: if name in self.collected and self.holecards[name]:
print "Seat %d: %s collected ($%s)" % (player[0], player[1], self.collected[player[1]]) # TODO: (bug) hero cards will always be 'shown' because they are known to us. Better to explicitly flag those who 'show' their cards.
print "Seat %d: %s showed [%s] and won ($%s)" % (seatnum, name, " ".join(self.holecards[name]), self.collected[name])
elif name in self.collected:
print "Seat %d: %s collected ($%s)" % (seatnum, name, self.collected[name])
elif self.holecards[player[1]]: elif self.holecards[player[1]]:
print "Seat %d: %s showed [%s %s]" % (player[0], player[1], self.holecards[player[1]][0], self.holecards[player[1]][1]) print "Seat %d: %s showed [%s]" % (seatnum, name, " ".join(self.holecards[name]))
else: else:
print "Seat %d: %s folded (or mucked..)" % (player[0], player[1]) print "Seat %d: %s folded or mucked" % (seatnum, name)
print print
# TODO: # TODO:
@ -470,6 +479,8 @@ Known bug: doesn't take into account side pots"""
print "%s: %s " %(act[0], act[1]) print "%s: %s " %(act[0], act[1])
if act[1] == 'calls': if act[1] == 'calls':
print "%s: %s $%s" %(act[0], act[1], act[2]) print "%s: %s $%s" %(act[0], act[1], act[2])
if act[1] == 'bets':
print "%s: %s $%s" %(act[0], act[1], act[2])
if act[1] == 'raises': if act[1] == 'raises':
print "%s: %s $%s to $%s" %(act[0], act[1], act[2], act[3]) print "%s: %s $%s to $%s" %(act[0], act[1], act[2], act[3])