Add stud/razz ante for FullTilt converter

This commit is contained in:
Worros 2009-02-26 00:45:46 +09:00
parent 65c34a7377
commit a71be6ddd3
2 changed files with 19 additions and 2 deletions

View File

@ -43,6 +43,7 @@ class FullTilt(HandHistoryConverter):
print "DEBUG player_re: " + player_re print "DEBUG player_re: " + player_re
self.re_PostSB = re.compile(r"^%s posts the small blind of \$?(?P<SB>[.0-9]+)" % player_re, re.MULTILINE) self.re_PostSB = re.compile(r"^%s posts the small blind of \$?(?P<SB>[.0-9]+)" % player_re, re.MULTILINE)
self.re_PostBB = re.compile(r"^%s posts (the big blind of )?\$?(?P<BB>[.0-9]+)" % player_re, re.MULTILINE) self.re_PostBB = re.compile(r"^%s posts (the big blind of )?\$?(?P<BB>[.0-9]+)" % player_re, re.MULTILINE)
self.re_Antes = re.compile(r"^%s antes \$?(?P<ANTE>[.0-9]+)" % player_re, re.MULTILINE)
self.re_BringIn = re.compile(r"^%s brings in for \$?(?P<BRINGIN>[.0-9]+)" % player_re, re.MULTILINE) self.re_BringIn = re.compile(r"^%s brings in for \$?(?P<BRINGIN>[.0-9]+)" % player_re, re.MULTILINE)
self.re_PostBoth = re.compile(r"^%s posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)" % player_re, re.MULTILINE) self.re_PostBoth = re.compile(r"^%s posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)" % player_re, re.MULTILINE)
self.re_HeroCards = re.compile(r"^Dealt to %s \[(?P<CARDS>.*)\]( \[(?P<NEWCARD>.*)\])?" % player_re, re.MULTILINE) self.re_HeroCards = re.compile(r"^Dealt to %s \[(?P<CARDS>.*)\]( \[(?P<NEWCARD>.*)\])?" % player_re, re.MULTILINE)
@ -155,7 +156,10 @@ class FullTilt(HandHistoryConverter):
def readAntes(self, hand): def readAntes(self, hand):
print "DEBUG: reading antes" print "DEBUG: reading antes"
print "DEBUG: FIXME reading antes" m = self.re_Antes.finditer(hand.string)
for player in m:
print "DEBUG: hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE'))
hand.addAnte(player.group('PNAME'), player.group('ANTE'))
def readBringIn(self, hand): def readBringIn(self, hand):
print "DEBUG: reading bring in" print "DEBUG: reading bring in"
@ -184,13 +188,13 @@ class FullTilt(HandHistoryConverter):
m = self.re_HeroCards.finditer(hand.streets.group(street)) m = self.re_HeroCards.finditer(hand.streets.group(street))
print "DEBUG: razz/stud readPlayerCards" print "DEBUG: razz/stud readPlayerCards"
print "DEBUG: STREET: %s", street print "DEBUG: STREET: %s", 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') #hand.hero = m.group('PNAME')
# "2c, qh" -> set(["2c","qc"]) # "2c, qh" -> set(["2c","qc"])
# Also works with Omaha hands. # Also works with Omaha hands.
cards = player.group('CARDS') cards = player.group('CARDS')
print "DEBUG: PNAME: %s CARDS: %s" %(player.group('PNAME'), player.group('CARDS'))
cards = set(cards.split(' ')) cards = set(cards.split(' '))
# hand.addHoleCards(cards, m.group('PNAME')) # hand.addHoleCards(cards, m.group('PNAME'))

View File

@ -185,6 +185,14 @@ Card ranks will be uppercased
c = c.replace(k,v) c = c.replace(k,v)
return c return c
def addAnte(self, player, ante):
if player is not None:
self.bets['ANTES'][player].append(Decimal(ante))
self.stacks[player] -= Decimal(ante)
act = (player, 'posts', "ante", ante, self.stacks[player]==0)
self.actions['ANTES'].append(act)
self.pot.addMoney(player, Decimal(ante))
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.
# TODO: # TODO:
@ -496,6 +504,11 @@ Map the tuple self.gametype onto the pokerstars string describing it
#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]))
if 'ANTES' in self.actions:
for act in self.actions['ANTES']:
print act
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 ***")