Merge branch 'exp' of git://git.assembla.com/mctfpdb
This commit is contained in:
commit
5a568527b8
|
@ -118,9 +118,9 @@ class Everleaf(HandHistoryConverter):
|
||||||
def readPlayerStacks(self, hand):
|
def readPlayerStacks(self, hand):
|
||||||
m = self.rexx.player_info_re.finditer(hand.string)
|
m = self.rexx.player_info_re.finditer(hand.string)
|
||||||
players = []
|
players = []
|
||||||
print "\nReading stacks - players seen:"
|
#print "\nReading stacks - players seen:"
|
||||||
for a in m:
|
for a in m:
|
||||||
print a.group('PNAME')
|
#print a.group('PNAME')
|
||||||
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
|
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
|
||||||
|
|
||||||
def markStreets(self, hand):
|
def markStreets(self, hand):
|
||||||
|
@ -129,9 +129,9 @@ class Everleaf(HandHistoryConverter):
|
||||||
#m = re.search('(\*\* Dealing down cards \*\*\n)(?P<PREFLOP>.*?\n\*\*)?( Dealing Flop \*\* \[ (?P<FLOP1>\S\S), (?P<FLOP2>\S\S), (?P<FLOP3>\S\S) \])?(?P<FLOP>.*?\*\*)?( Dealing Turn \*\* \[ (?P<TURN1>\S\S) \])?(?P<TURN>.*?\*\*)?( Dealing River \*\* \[ (?P<RIVER1>\S\S) \])?(?P<RIVER>.*)', hand.string,re.DOTALL)
|
#m = re.search('(\*\* Dealing down cards \*\*\n)(?P<PREFLOP>.*?\n\*\*)?( Dealing Flop \*\* \[ (?P<FLOP1>\S\S), (?P<FLOP2>\S\S), (?P<FLOP3>\S\S) \])?(?P<FLOP>.*?\*\*)?( Dealing Turn \*\* \[ (?P<TURN1>\S\S) \])?(?P<TURN>.*?\*\*)?( Dealing River \*\* \[ (?P<RIVER1>\S\S) \])?(?P<RIVER>.*)', hand.string,re.DOTALL)
|
||||||
|
|
||||||
m = re.search(r"\*\* Dealing down cards \*\*(?P<PREFLOP>.+(?=\*\* Dealing Flop \*\*)|.+)"
|
m = re.search(r"\*\* Dealing down cards \*\*(?P<PREFLOP>.+(?=\*\* Dealing Flop \*\*)|.+)"
|
||||||
r"(\*\* Dealing Flop \*\* \[ (?P<FLOP1>\S\S), (?P<FLOP2>\S\S), (?P<FLOP3>\S\S) \](?P<FLOP>.+(?=\*\* Dealing Turn \*\*)|.+))?"
|
r"(\*\* Dealing Flop \*\* \[ \S\S, \S\S, \S\S \](?P<FLOP>.+(?=\*\* Dealing Turn \*\*)|.+))?"
|
||||||
r"(\*\* Dealing Turn \*\* \[ (?P<TURN1>\S\S) \](?P<TURN>.+(?=\*\* Dealing River \*\*)|.+))?"
|
r"(\*\* Dealing Turn \*\* \[ \S\S \](?P<TURN>.+(?=\*\* Dealing River \*\*)|.+))?"
|
||||||
r"(\*\* Dealing River \*\* \[ (?P<RIVER1>\S\S) \](?P<RIVER>.+))?", hand.string,re.DOTALL)
|
r"(\*\* Dealing River \*\* \[ \S\S \](?P<RIVER>.+))?", hand.string,re.DOTALL)
|
||||||
# that wasn't easy.
|
# that wasn't easy.
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,11 +192,15 @@ class Everleaf(HandHistoryConverter):
|
||||||
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):
|
||||||
|
|
|
@ -306,7 +306,7 @@ class Hand:
|
||||||
|
|
||||||
def setCommunityCards(self, street, cards):
|
def setCommunityCards(self, street, cards):
|
||||||
self.board[street] = [self.card(c) for c in cards]
|
self.board[street] = [self.card(c) for c in cards]
|
||||||
print self.board[street]
|
#print self.board[street]
|
||||||
|
|
||||||
def card(self,c):
|
def card(self,c):
|
||||||
"""upper case the ranks but not suits, 'atjqk' => 'ATJQK'"""
|
"""upper case the ranks but not suits, 'atjqk' => 'ATJQK'"""
|
||||||
|
@ -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
|
||||||
|
@ -382,7 +388,7 @@ Known bug: doesn't take into account side pots"""
|
||||||
|
|
||||||
def printHand(self):
|
def printHand(self):
|
||||||
# PokerStars format.
|
# PokerStars format.
|
||||||
print "### Pseudo stars format ###"
|
print "\n### Pseudo stars format ###"
|
||||||
print "%s Game #%s: %s ($%s/$%s) - %s" %(self.sitename, self.handid, "XXXXhand.gametype", self.sb, self.bb, self.starttime)
|
print "%s Game #%s: %s ($%s/$%s) - %s" %(self.sitename, self.handid, "XXXXhand.gametype", self.sb, self.bb, self.starttime)
|
||||||
print "Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)
|
print "Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)
|
||||||
for player in self.players:
|
for player in self.players:
|
||||||
|
@ -401,24 +407,24 @@ 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']:
|
||||||
self.printActionLine(act)
|
self.printActionLine(act)
|
||||||
|
|
||||||
if 'FLOP' in self.actions:
|
if 'FLOP' in self.actions:
|
||||||
print "*** FLOP *** [%s %s %s]" %(self.streets.group("FLOP1"), self.streets.group("FLOP2"), self.streets.group("FLOP3"))
|
print "*** FLOP *** [%s]" %( " ".join(self.board['Flop']))
|
||||||
for act in self.actions['FLOP']:
|
for act in self.actions['FLOP']:
|
||||||
self.printActionLine(act)
|
self.printActionLine(act)
|
||||||
|
|
||||||
if 'TURN' in self.actions:
|
if 'TURN' in self.actions:
|
||||||
print "*** TURN *** [%s %s %s] [%s]" %(self.streets.group("FLOP1"), self.streets.group("FLOP2"), self.streets.group("FLOP3"), self.streets.group("TURN1"))
|
print "*** TURN *** [%s] [%s]" %( " ".join(self.board['Flop']), " ".join(self.board['Turn']))
|
||||||
for act in self.actions['TURN']:
|
for act in self.actions['TURN']:
|
||||||
self.printActionLine(act)
|
self.printActionLine(act)
|
||||||
|
|
||||||
if 'RIVER' in self.actions:
|
if 'RIVER' in self.actions:
|
||||||
print "*** RIVER *** [%s %s %s %s] [%s]" %(self.streets.group("FLOP1"), self.streets.group("FLOP2"), self.streets.group("FLOP3"), self.streets.group("TURN1"), self.streets.group("RIVER1"))
|
print "*** RIVER *** [%s] [%s]" %(" ".join(self.board['Flop']+self.board['Turn']), " ".join(self.board['River']) )
|
||||||
for act in self.actions['RIVER']:
|
for act in self.actions['RIVER']:
|
||||||
self.printActionLine(act)
|
self.printActionLine(act)
|
||||||
|
|
||||||
|
@ -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])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user