Remove a tonne of debug, neaten output
This commit is contained in:
parent
3febe073cc
commit
baae7af5e0
|
@ -85,7 +85,7 @@ class Everleaf(HandHistoryConverter):
|
||||||
|
|
||||||
def compile_player_regexs(self):
|
def compile_player_regexs(self):
|
||||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, self.players)) + ")"
|
player_re = "(?P<PNAME>" + "|".join(map(re.escape, self.players)) + ")"
|
||||||
print "DEBUG player_re: " + player_re
|
#print "DEBUG player_re: " + player_re
|
||||||
self.re_PostSB = re.compile(r"^%s: posts small blind \[\$? (?P<SB>[.0-9]+)" % player_re, re.MULTILINE)
|
self.re_PostSB = re.compile(r"^%s: posts small blind \[\$? (?P<SB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||||
self.re_PostBB = re.compile(r"^%s: posts big blind \[\$? (?P<BB>[.0-9]+)" % player_re, re.MULTILINE)
|
self.re_PostBB = re.compile(r"^%s: posts big blind \[\$? (?P<BB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||||
self.re_PostBoth = re.compile(r"^%s: posts both blinds \[\$? (?P<SBBB>[.0-9]+)" % player_re, re.MULTILINE)
|
self.re_PostBoth = re.compile(r"^%s: posts both blinds \[\$? (?P<SBBB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||||
|
@ -148,8 +148,8 @@ class Everleaf(HandHistoryConverter):
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
print "DEBUG " + street + ":"
|
#print "DEBUG " + street + ":"
|
||||||
print hand.streets.group(street) + "\n"
|
#print hand.streets.group(street) + "\n"
|
||||||
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)
|
||||||
m = self.re_Board.search(hand.streets.group(street))
|
m = self.re_Board.search(hand.streets.group(street))
|
||||||
hand.setCommunityCards(street, m.group('CARDS').split(', '))
|
hand.setCommunityCards(street, m.group('CARDS').split(', '))
|
||||||
|
@ -159,7 +159,7 @@ class Everleaf(HandHistoryConverter):
|
||||||
m = self.re_PostSB.search(hand.string)
|
m = self.re_PostSB.search(hand.string)
|
||||||
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
||||||
except Exception, e: # no small blind
|
except Exception, e: # no small blind
|
||||||
print e
|
#print e
|
||||||
hand.addBlind(None, None, None)
|
hand.addBlind(None, None, None)
|
||||||
for a in self.re_PostBB.finditer(hand.string):
|
for a in self.re_PostBB.finditer(hand.string):
|
||||||
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
|
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FullTilt(HandHistoryConverter):
|
||||||
|
|
||||||
def compile_player_regexs(self):
|
def compile_player_regexs(self):
|
||||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, self.players)) + ")"
|
player_re = "(?P<PNAME>" + "|".join(map(re.escape, self.players)) + ")"
|
||||||
print "DEBUG player_re: " + player_re
|
#print "DEBUG player_re: " + player_re
|
||||||
self.re_PostSB = re.compile('.*\n(?P<PNAME>.*) posts the small blind of \$?(?P<SB>[.0-9]+)')
|
self.re_PostSB = re.compile('.*\n(?P<PNAME>.*) posts the small blind of \$?(?P<SB>[.0-9]+)')
|
||||||
self.re_PostBB = re.compile('.*\n(?P<PNAME>.*) posts (the big blind of )?\$?(?P<BB>[.0-9]+)')
|
self.re_PostBB = re.compile('.*\n(?P<PNAME>.*) posts (the big blind of )?\$?(?P<BB>[.0-9]+)')
|
||||||
self.re_PostBoth = re.compile('.*\n(?P<PNAME>.*) posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)')
|
self.re_PostBoth = re.compile('.*\n(?P<PNAME>.*) posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)')
|
||||||
|
|
|
@ -135,7 +135,7 @@ 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
|
#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])
|
||||||
|
@ -148,7 +148,7 @@ player (string) name of player
|
||||||
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
|
#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)
|
||||||
|
@ -194,7 +194,7 @@ Card ranks will be uppercased
|
||||||
# If a player posts a big & small blind
|
# If a player posts a big & small blind
|
||||||
# - FIXME: We dont record this for later printing yet
|
# - FIXME: We dont record this for later printing yet
|
||||||
|
|
||||||
print "DEBUG addBlind: %s posts %s, %s" % (player, blindtype, amount)
|
#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)
|
||||||
|
@ -208,7 +208,7 @@ Card ranks will be uppercased
|
||||||
# extra small blind is 'dead'
|
# extra small blind is 'dead'
|
||||||
self.lastBet['PREFLOP'] = Decimal(self.bb)
|
self.lastBet['PREFLOP'] = Decimal(self.bb)
|
||||||
self.posted = self.posted + [[player,blindtype]]
|
self.posted = self.posted + [[player,blindtype]]
|
||||||
print "DEBUG: self.posted: %s" %(self.posted)
|
#print "DEBUG: self.posted: %s" %(self.posted)
|
||||||
|
|
||||||
|
|
||||||
def addCall(self, street, player=None, amount=None):
|
def addCall(self, street, player=None, amount=None):
|
||||||
|
@ -218,7 +218,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])
|
#print "DEBUG %s calls %s, stack %s" % (player, amount, self.stacks[player])
|
||||||
act = (player, 'calls', amount, self.stacks[player]==0)
|
act = (player, 'calls', amount, self.stacks[player]==0)
|
||||||
self.actions[street].append(act)
|
self.actions[street].append(act)
|
||||||
self.pot.addMoney(player, Decimal(amount))
|
self.pot.addMoney(player, Decimal(amount))
|
||||||
|
@ -290,7 +290,7 @@ 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 bets %s, stack %s" % (player, amount, self.stacks[player])
|
#print "DEBUG %s bets %s, stack %s" % (player, amount, self.stacks[player])
|
||||||
act = (player, 'bets', amount, self.stacks[player]==0)
|
act = (player, 'bets', amount, self.stacks[player]==0)
|
||||||
self.actions[street].append(act)
|
self.actions[street].append(act)
|
||||||
self.lastBet[street] = Decimal(amount)
|
self.lastBet[street] = Decimal(amount)
|
||||||
|
@ -298,7 +298,7 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
|
|
||||||
|
|
||||||
def addFold(self, street, player):
|
def addFold(self, street, player):
|
||||||
print "DEBUG: %s %s folded" % (street, player)
|
#print "DEBUG: %s %s folded" % (street, player)
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
self.folded.add(player)
|
self.folded.add(player)
|
||||||
self.pot.addFold(player)
|
self.pot.addFold(player)
|
||||||
|
@ -306,19 +306,13 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
|
|
||||||
|
|
||||||
def addCheck(self, street, player):
|
def addCheck(self, street, player):
|
||||||
print "DEBUG: %s %s checked" % (street, player)
|
#print "DEBUG: %s %s checked" % (street, player)
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
self.actions[street].append((player, 'checks'))
|
self.actions[street].append((player, 'checks'))
|
||||||
|
|
||||||
# dart1 wins $ 51.09 USD from main pot with a full house, queens full of threes [ Qh, Qc, Qd, 3c, 3s ]
|
|
||||||
# dart1 wins $ 41.07 USD from side pot with a full house, queens full of threes [ Qh, Qc, Qd, 3c, 3s ]
|
|
||||||
# DEBUG: dart1 collected 51.09
|
|
||||||
# DEBUG: dart1 collected 41.07
|
|
||||||
# [WARNING] %s collected pot more than once; avoidable by reading winnings only from summary lines?
|
|
||||||
# TODO: Should we just add the pots together??
|
|
||||||
|
|
||||||
def addCollectPot(self,player, pot):
|
def addCollectPot(self,player, pot):
|
||||||
print "DEBUG: %s collected %s" % (player, pot)
|
#print "DEBUG: %s collected %s" % (player, pot)
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
self.collected = self.collected + [[player, pot]]
|
self.collected = self.collected + [[player, pot]]
|
||||||
if player not in self.collectees:
|
if player not in self.collectees:
|
||||||
|
@ -424,7 +418,7 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
# we probably don't need a showdown section in pseudo stars format for our filtering purposes
|
# we probably don't need a showdown section in pseudo stars format for our filtering purposes
|
||||||
if 'SHOWDOWN' in self.actions:
|
if 'SHOWDOWN' in self.actions:
|
||||||
print >>fh, _("*** SHOW DOWN ***")
|
print >>fh, _("*** SHOW DOWN ***")
|
||||||
print >>fh, "DEBUG: what do they show"
|
# print >>fh, "DEBUG: what do they show"
|
||||||
|
|
||||||
# Current PS format has the lines:
|
# Current PS format has the lines:
|
||||||
# Uncalled bet ($111.25) returned to s0rrow
|
# Uncalled bet ($111.25) returned to s0rrow
|
||||||
|
|
|
@ -98,7 +98,7 @@ class HandHistoryConverter:
|
||||||
tmp = tmp + "\thhdir: '%s'\n" % (self.hhdir)
|
tmp = tmp + "\thhdir: '%s'\n" % (self.hhdir)
|
||||||
tmp = tmp + "\tfiletype: '%s'\n" % (self.filetype)
|
tmp = tmp + "\tfiletype: '%s'\n" % (self.filetype)
|
||||||
tmp = tmp + "\tinfile: '%s'\n" % (self.file)
|
tmp = tmp + "\tinfile: '%s'\n" % (self.file)
|
||||||
# tmp = tmp + "\toutfile: '%s'\n" % (self.ofile)
|
tmp = tmp + "\toutfile: '%s'\n" % (self.ofile)
|
||||||
#tmp = tmp + "\tgametype: '%s'\n" % (self.gametype[0])
|
#tmp = tmp + "\tgametype: '%s'\n" % (self.gametype[0])
|
||||||
#tmp = tmp + "\tgamebase: '%s'\n" % (self.gametype[1])
|
#tmp = tmp + "\tgamebase: '%s'\n" % (self.gametype[1])
|
||||||
#tmp = tmp + "\tlimit: '%s'\n" % (self.gametype[2])
|
#tmp = tmp + "\tlimit: '%s'\n" % (self.gametype[2])
|
||||||
|
@ -120,11 +120,11 @@ class HandHistoryConverter:
|
||||||
self.gametype = self.determineGameType()
|
self.gametype = self.determineGameType()
|
||||||
self.hands = self.splitFileIntoHands()
|
self.hands = self.splitFileIntoHands()
|
||||||
for hand in self.hands:
|
for hand in self.hands:
|
||||||
# print "\nInput:\n"+hand.string
|
#print "\nDEBUG: Input:\n"+hand.string
|
||||||
self.readHandInfo(hand)
|
self.readHandInfo(hand)
|
||||||
|
|
||||||
self.readPlayerStacks(hand)
|
self.readPlayerStacks(hand)
|
||||||
print "DEBUG stacks:", hand.stacks
|
#print "DEBUG stacks:", hand.stacks
|
||||||
# at this point we know the player names, they are in hand.players
|
# at this point we know the player names, they are in hand.players
|
||||||
playersThisHand = set([player[1] for player in hand.players])
|
playersThisHand = set([player[1] for player in hand.players])
|
||||||
if playersThisHand <= self.players: # x <= y means 'x is subset of y'
|
if playersThisHand <= self.players: # x <= y means 'x is subset of y'
|
||||||
|
@ -164,7 +164,7 @@ class HandHistoryConverter:
|
||||||
|
|
||||||
outfile.close()
|
outfile.close()
|
||||||
endtime = time.time()
|
endtime = time.time()
|
||||||
print "Processed %d hands in %d seconds" % (len(self.hands), endtime-starttime)
|
print "Processed %d hands in %.3f seconds" % (len(self.hands), endtime - starttime)
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# These functions are parse actions that may be overridden by the inheriting class
|
# These functions are parse actions that may be overridden by the inheriting class
|
||||||
|
|
Loading…
Reference in New Issue
Block a user