a bit more FTP; works? on 7 hand sample. No regression test of Everleaf
:(
This commit is contained in:
parent
f230a82add
commit
1f1332b849
|
@ -72,19 +72,19 @@ class FullTilt(HandHistoryConverter):
|
||||||
HandHistoryConverter.__init__(self, config, file, sitename="FullTilt") # Call super class init.
|
HandHistoryConverter.__init__(self, config, file, sitename="FullTilt") # Call super class init.
|
||||||
self.sitename = "FullTilt"
|
self.sitename = "FullTilt"
|
||||||
self.setFileType("text", "cp1252")
|
self.setFileType("text", "cp1252")
|
||||||
self.rexx.setGameInfoRegex('.*- \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)')
|
self.rexx.setGameInfoRegex('- \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) -')
|
||||||
self.rexx.setSplitHandRegex('\n\n+')
|
self.rexx.setSplitHandRegex('\n\n+')
|
||||||
self.rexx.setHandInfoRegex('.*#(?P<HID>[0-9]+): Table (?P<TABLE>[- a-zA-Z]+) - \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) - (?P<GAMETYPE>[a-zA-Z\' ]+) - (?P<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+) ET - (?P<YEAR>[0-9]+)/(?P<MON>[0-9]+)/(?P<DAY>[0-9]+)')
|
self.rexx.setHandInfoRegex('.*#(?P<HID>[0-9]+): Table (?P<TABLE>[- a-zA-Z]+) - \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) - (?P<GAMETYPE>[a-zA-Z\' ]+) - (?P<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+) ET - (?P<YEAR>[0-9]+)/(?P<MON>[0-9]+)/(?P<DAY>[0-9]+)')
|
||||||
# self.rexx.setHandInfoRegex('.*#(?P<HID>[0-9]+): Table (?P<TABLE>[ a-zA-Z]+) - \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) - (?P<GAMETYPE>.*) - (?P<HR>[0-9]+):(?P<MIN>[0-9]+) ET - (?P<YEAR>[0-9]+)/(?P<MON>[0-9]+)/(?P<DAY>[0-9]+)Table (?P<TABLE>[ a-zA-Z]+)\nSeat (?P<BUTTON>[0-9]+)')
|
# self.rexx.setHandInfoRegex('.*#(?P<HID>[0-9]+): Table (?P<TABLE>[ a-zA-Z]+) - \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) - (?P<GAMETYPE>.*) - (?P<HR>[0-9]+):(?P<MIN>[0-9]+) ET - (?P<YEAR>[0-9]+)/(?P<MON>[0-9]+)/(?P<DAY>[0-9]+)Table (?P<TABLE>[ a-zA-Z]+)\nSeat (?P<BUTTON>[0-9]+)')
|
||||||
self.rexx.button_re = re.compile('The button is in seat #(?P<BUTTON>\d+)')
|
self.rexx.button_re = re.compile('The button is in seat #(?P<BUTTON>\d+)')
|
||||||
self.rexx.setPlayerInfoRegex('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \((\$(?P<CASH>[.0-9]+)|All-in)\)')
|
self.rexx.setPlayerInfoRegex('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(\$(?P<CASH>[.0-9]+)\)\n')
|
||||||
self.rexx.setPostSbRegex('.*\n(?P<PNAME>.*): posts the small blind of \$?(?P<SB>[.0-9]+)')
|
self.rexx.setPostSbRegex('.*\n(?P<PNAME>.*) posts the small blind of \$?(?P<SB>[.0-9]+)')
|
||||||
self.rexx.setPostBbRegex('.*\n(?P<PNAME>.*): posts the big blind of \$?(?P<BB>[.0-9]+)')
|
self.rexx.setPostBbRegex('.*\n(?P<PNAME>.*) posts (the big blind of )?\$?(?P<BB>[.0-9]+)')
|
||||||
self.rexx.setPostBothRegex('.*\n(?P<PNAME>.*): posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)')
|
self.rexx.setPostBothRegex('.*\n(?P<PNAME>.*) posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)')
|
||||||
self.rexx.setHeroCardsRegex('.*\nDealt\sto\s(?P<PNAME>.*)\s\[(?P<CARDS>.*)\]')
|
self.rexx.setHeroCardsRegex('.*\nDealt\sto\s(?P<PNAME>.*)\s\[(?P<CARDS>.*)\]')
|
||||||
self.rexx.setActionStepRegex('.*\n(?P<PNAME>.*)(?P<ATYPE> bets| checks| raises to| calls| folds)(\s\$(?P<BET>[.\d]+))?')
|
self.rexx.setActionStepRegex('.*\n(?P<PNAME>.*)(?P<ATYPE> bets| checks| raises to| calls| folds)(\s\$(?P<BET>[.\d]+))?')
|
||||||
self.rexx.setShowdownActionRegex('.*\n(?P<PNAME>.*) shows \[(?P<CARDS>.*)\]')
|
self.rexx.setShowdownActionRegex('.*\n(?P<PNAME>.*) shows \[(?P<CARDS>.*)\]')
|
||||||
self.rexx.setCollectPotRegex('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(.*\) collected \(\$(?P<POT>[.\d]+)\), mucked')
|
self.rexx.setCollectPotRegex(r"Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*?) (\(button\) |\(small blind\) |\(big blind\) )?(collected|showed \[.*\] and won) \(\$(?P<POT>[.\d]+)\)(, mucked| with.*)")
|
||||||
self.rexx.shown_cards_re = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(.*\) showed \[(?P<CARDS>.*)\].*')
|
self.rexx.shown_cards_re = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(.*\) showed \[(?P<CARDS>.*)\].*')
|
||||||
self.rexx.sits_out_re = re.compile('(?P<PNAME>.*) sits out')
|
self.rexx.sits_out_re = re.compile('(?P<PNAME>.*) sits out')
|
||||||
self.rexx.compileRegexes()
|
self.rexx.compileRegexes()
|
||||||
|
@ -141,9 +141,9 @@ class FullTilt(HandHistoryConverter):
|
||||||
hand.addStreets(m)
|
hand.addStreets(m)
|
||||||
|
|
||||||
def readCommunityCards(self, hand, street): # street has been matched by markStreets, so exists in this hand
|
def readCommunityCards(self, hand, street): # street has been matched by markStreets, so exists in this hand
|
||||||
self.rexx.board_re = re.compile(r"\[(?P<CARDS>.+)\]")
|
|
||||||
print hand.streets.group(street)
|
|
||||||
if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
|
if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
|
||||||
|
self.rexx.board_re = re.compile(r"\[(?P<CARDS>.+)\]")
|
||||||
|
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
|
||||||
m = self.rexx.board_re.search(hand.streets.group(street))
|
m = self.rexx.board_re.search(hand.streets.group(street))
|
||||||
hand.setCommunityCards(street, m.group('CARDS').split(' '))
|
hand.setCommunityCards(street, m.group('CARDS').split(' '))
|
||||||
|
|
||||||
|
|
|
@ -132,18 +132,20 @@ Assigns observed holecards to a player.
|
||||||
cards set of card bigrams e.g. set(['2h','Jc'])
|
cards set of card bigrams e.g. set(['2h','Jc'])
|
||||||
player (string) name of player
|
player (string) name of player
|
||||||
"""
|
"""
|
||||||
|
print "DEBUG: addHoleCards", cards,player
|
||||||
try:
|
try:
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
cards = set([self.card(c) for c in cards])
|
cards = set([self.card(c) for c in cards])
|
||||||
self.holecards[player].update(cards)
|
self.holecards[player].update(cards)
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
print "Tried to add holecards for unknown player: %s" % (player,)
|
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).
|
||||||
Card ranks will be uppercased
|
Card ranks will be uppercased
|
||||||
"""
|
"""
|
||||||
|
print "DEBUG: addShownCards", cards,player,holeandboard
|
||||||
if cards is not None:
|
if cards is not None:
|
||||||
self.shown.add(player)
|
self.shown.add(player)
|
||||||
self.addHoleCards(cards,player)
|
self.addHoleCards(cards,player)
|
||||||
|
@ -165,7 +167,7 @@ Card ranks will be uppercased
|
||||||
except FpdbParseError, e:
|
except FpdbParseError, e:
|
||||||
pass
|
pass
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print "tried to discard a card %s didn't have" % (player,)
|
print "[ERROR] discardHoleCard tried to discard a card %s didn't have" % (player,)
|
||||||
|
|
||||||
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]
|
||||||
|
@ -178,10 +180,11 @@ Card ranks will be uppercased
|
||||||
|
|
||||||
def addBlind(self, player, blindtype, amount):
|
def addBlind(self, player, blindtype, amount):
|
||||||
# if player is None, it's a missing small blind.
|
# if player is None, it's a missing small blind.
|
||||||
|
print "DEBUG addBlind: %s posts %s, %s" % (player, blindtype, amount)
|
||||||
if player is not None:
|
if player is not None:
|
||||||
self.bets['PREFLOP'][player].append(Decimal(amount))
|
self.bets['PREFLOP'][player].append(Decimal(amount))
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= Decimal(amount)
|
||||||
print "DEBUG %s stack %s" % (player, self.stacks[player])
|
#print "DEBUG %s posts, stack %s" % (player, self.stacks[player])
|
||||||
self.actions['PREFLOP'] += [(player, 'posts', blindtype, amount, self.stacks[player]==0)]
|
self.actions['PREFLOP'] += [(player, 'posts', blindtype, amount, self.stacks[player]==0)]
|
||||||
if blindtype == 'big blind':
|
if blindtype == 'big blind':
|
||||||
self.lastBet['PREFLOP'] = Decimal(amount)
|
self.lastBet['PREFLOP'] = Decimal(amount)
|
||||||
|
@ -198,6 +201,7 @@ Card ranks will be uppercased
|
||||||
self.bets[street][player].append(Decimal(amount))
|
self.bets[street][player].append(Decimal(amount))
|
||||||
#self.lastBet[street] = Decimal(amount)
|
#self.lastBet[street] = Decimal(amount)
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= Decimal(amount)
|
||||||
|
print "DEBUG %s calls %s, stack %s" % (player, amount, self.stacks[player])
|
||||||
self.actions[street] += [(player, 'calls', amount, self.stacks[player]==0)]
|
self.actions[street] += [(player, 'calls', amount, self.stacks[player]==0)]
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,21 +229,24 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
self.bets[street][player].append(Decimal(amount))
|
self.bets[street][player].append(Decimal(amount))
|
||||||
self.stacks[player] -= Decimal(amount)
|
self.stacks[player] -= Decimal(amount)
|
||||||
print "DEBUG %s stack %s" % (player, self.stacks[player])
|
print "DEBUG %s bets %s, stack %s" % (player, amount, self.stacks[player])
|
||||||
self.actions[street] += [(player, 'bets', amount, self.stacks[player]==0)]
|
self.actions[street] += [(player, 'bets', amount, self.stacks[player]==0)]
|
||||||
self.lastBet[street] = Decimal(amount)
|
self.lastBet[street] = Decimal(amount)
|
||||||
|
|
||||||
|
|
||||||
def addFold(self, street, player):
|
def addFold(self, street, player):
|
||||||
|
print "DEBUG: %s %s folded" % (street, player)
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
self.folded.add(player)
|
self.folded.add(player)
|
||||||
self.actions[street] += [(player, 'folds')]
|
self.actions[street] += [(player, 'folds')]
|
||||||
|
|
||||||
def addCheck(self, street, player):
|
def addCheck(self, street, player):
|
||||||
|
print "DEBUG: %s %s checked" % (street, player)
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
self.actions[street] += [(player, 'checks')]
|
self.actions[street] += [(player, 'checks')]
|
||||||
|
|
||||||
def addCollectPot(self,player, pot):
|
def addCollectPot(self,player, pot):
|
||||||
|
print "DEBUG: %s collected %s" % (player, pot)
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
if player not in self.collected:
|
if player not in self.collected:
|
||||||
self.collected[player] = pot
|
self.collected[player] = pot
|
||||||
|
@ -259,7 +266,7 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
#print street, self.bets[street][player]
|
#print street, self.bets[street][player]
|
||||||
self.totalpot += reduce(operator.add, self.bets[street][player], 0)
|
self.totalpot += reduce(operator.add, self.bets[street][player], 0)
|
||||||
|
|
||||||
print "conventional totalpot:", self.totalpot
|
print "DEBUG conventional totalpot:", self.totalpot
|
||||||
|
|
||||||
|
|
||||||
self.totalpot = 0
|
self.totalpot = 0
|
||||||
|
@ -283,15 +290,21 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
self.totalpot += Decimal(act[2])
|
self.totalpot += Decimal(act[2])
|
||||||
calls = calls + [Decimal(act[2])]
|
calls = calls + [Decimal(act[2])]
|
||||||
print "calls:", calls
|
print "calls:", calls
|
||||||
if act[1] == ('posts'):
|
elif act[1] == 'posts':
|
||||||
self.totalpot += Decimal(act[3])
|
self.totalpot += Decimal(act[3])
|
||||||
|
if act[2] == 'big blind':
|
||||||
|
# the bb gets called by out-of-blinds posts; but sb+bb only calls bb
|
||||||
|
calls = calls + [Decimal(act[3])]
|
||||||
uncalled = Decimal(act[3])
|
uncalled = Decimal(act[3])
|
||||||
|
elif act[2] == 'small blind':
|
||||||
|
pass
|
||||||
|
|
||||||
if uncalled > 0 and max(calls+[0]) < uncalled:
|
if uncalled > 0 and max(calls+[0]) < uncalled:
|
||||||
|
|
||||||
print "returning some bet, calls:", calls
|
print "DEBUG returning some bet, calls:", calls
|
||||||
print "returned: %.2f from %.2f" % ((uncalled - max(calls)), self.totalpot,)
|
print "DEBUG returned: %.2f from %.2f" % ((uncalled - max(calls)), self.totalpot,)
|
||||||
self.totalpot -= (uncalled - max(calls))
|
self.totalpot -= (uncalled - max(calls))
|
||||||
print "new totalpot:", self.totalpot
|
print "DEBUG new totalpot:", self.totalpot
|
||||||
|
|
||||||
|
|
||||||
if self.totalcollected is None:
|
if self.totalcollected is None:
|
||||||
|
@ -337,9 +350,9 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos))
|
print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos))
|
||||||
|
|
||||||
players_who_act_preflop = set([x[0] for x in self.actions['PREFLOP']])
|
players_who_act_preflop = set([x[0] for x in self.actions['PREFLOP']])
|
||||||
print players_who_act_preflop
|
#print players_who_act_preflop
|
||||||
print [x[1] for x in self.players]
|
#print [x[1] for x in self.players]
|
||||||
print [x for x in self.players if x[1] in players_who_act_preflop]
|
#print [x for x in self.players if x[1] in players_who_act_preflop]
|
||||||
for player in [x for x in self.players if x[1] in players_who_act_preflop]:
|
for player in [x for x in self.players if x[1] in players_who_act_preflop]:
|
||||||
#Only print stacks of players who do something preflop
|
#Only print stacks of players who do something preflop
|
||||||
print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2]))
|
print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2]))
|
||||||
|
@ -388,7 +401,7 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
print >>fh, "DEBUG: what do they show"
|
print >>fh, "DEBUG: what do they show"
|
||||||
|
|
||||||
print >>fh, _("*** SUMMARY ***")
|
print >>fh, _("*** SUMMARY ***")
|
||||||
print >>fh, _("Total pot $%s | Rake $%.2f" % (self.totalcollected, self.rake)) # TODO: side pots
|
print >>fh, _("Total pot $%s | Rake $%.2f" % (self.totalpot, self.rake)) # TODO: side pots
|
||||||
|
|
||||||
board = []
|
board = []
|
||||||
for s in self.board.values():
|
for s in self.board.values():
|
||||||
|
@ -400,13 +413,13 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
for player in self.players:
|
for player in self.players:
|
||||||
seatnum = player[0]
|
seatnum = player[0]
|
||||||
name = player[1]
|
name = player[1]
|
||||||
if name in self.collected and self.holecards[name]:
|
if name in self.collected and name in self.shown:
|
||||||
print >>fh, _("Seat %d: %s showed [%s] and won ($%s)" % (seatnum, name, " ".join(self.holecards[name]), self.collected[name]))
|
print >>fh, _("Seat %d: %s showed [%s] and won ($%s)" % (seatnum, name, " ".join(self.holecards[name]), self.collected[name]))
|
||||||
elif name in self.collected:
|
elif name in self.collected:
|
||||||
print >>fh, _("Seat %d: %s collected ($%s)" % (seatnum, name, self.collected[name]))
|
print >>fh, _("Seat %d: %s collected ($%s)" % (seatnum, name, self.collected[name]))
|
||||||
elif player[1] in self.shown:
|
elif name in self.shown:
|
||||||
print >>fh, _("Seat %d: %s showed [%s]" % (seatnum, name, " ".join(self.holecards[name])))
|
print >>fh, _("Seat %d: %s showed [%s]" % (seatnum, name, " ".join(self.holecards[name])))
|
||||||
elif player[1] in self.folded:
|
elif name in self.folded:
|
||||||
print >>fh, _("Seat %d: %s folded" % (seatnum, name))
|
print >>fh, _("Seat %d: %s folded" % (seatnum, name))
|
||||||
else:
|
else:
|
||||||
print >>fh, _("Seat %d: %s mucked" % (seatnum, name))
|
print >>fh, _("Seat %d: %s mucked" % (seatnum, name))
|
||||||
|
|
|
@ -115,7 +115,7 @@ class HandHistoryConverter:
|
||||||
print "\nInput:\n"+hand.string
|
print "\nInput:\n"+hand.string
|
||||||
self.readHandInfo(hand)
|
self.readHandInfo(hand)
|
||||||
self.readPlayerStacks(hand)
|
self.readPlayerStacks(hand)
|
||||||
print "DEBUG", hand.stacks
|
print "DEBUG stacks:", hand.stacks
|
||||||
self.markStreets(hand)
|
self.markStreets(hand)
|
||||||
self.readBlinds(hand)
|
self.readBlinds(hand)
|
||||||
self.readHeroCards(hand) # want to generalise to draw games
|
self.readHeroCards(hand) # want to generalise to draw games
|
||||||
|
|
Loading…
Reference in New Issue
Block a user