Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winamax fixes #17

Open
wants to merge 5 commits into
base: chazdazzle
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyfpdb/Hand.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ def __init__(self, config, hhc, sitename, gametype, handText, builtFrom = "HHC",
pass # or indeed don't pass and complain instead
log.debug("HoldemOmahaHand")
self.allStreets = ['BLINDSANTES', 'PREFLOP','FLOP','TURN','RIVER']
self.holeStreets = ['PREFLOP']
self.holeStreets = ['BLINDSANTES', 'PREFLOP']
if gametype['category']=='irish':
self.discardStreets = ['TURN']
else:
Expand Down
40 changes: 24 additions & 16 deletions pyfpdb/WinamaxToFpdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def my_f(*args, **kwds):
\)\s-\s
(?P<DATETIME>.*)
Table:\s\'(?P<TABLE>[^(]+)
(.(?P<TOURNO>\d+).\#(?P<TABLENO>\d+))?.*
(.(?P<TOURNO>\d+).\s?\#(?P<TABLENO>\d+))?.*
\'
\s(?P<MAXPLAYER>\d+)\-max
\s(?P<MONEY>\(real\smoney\))?
Expand Down Expand Up @@ -125,15 +125,16 @@ def compilePlayerRegexs(self, hand):
#ANTES/BLINDS
#helander2222 posts blind ($0.25), lopllopl posts blind ($0.50).
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
subst = {'PLYR': player_re, 'CUR': self.sym[hand.gametype['currency']]}
self.re_PostSB = re.compile('%(PLYR)s posts small blind (%(CUR)s)?(?P<SB>[\.0-9]+)(%(CUR)s)?' % subst, re.MULTILINE)
subst = {'PLYR': player_re, 'PLYR2': player_re.replace('PNAME', 'PNAME2'), 'CUR': self.sym[hand.gametype['currency']]}
self.re_PostBB = re.compile('%(PLYR)s posts big blind (%(CUR)s)?(?P<BB>[\.0-9]+)(%(CUR)s)?' % subst, re.MULTILINE)
self.re_PostSB = re.compile('%(PLYR)s posts small blind (%(CUR)s)?(?P<SB>[\.0-9]+)(%(CUR)s)?(out of position)?' % subst, re.MULTILINE)
self.re_DenySB = re.compile('(?P<PNAME>.*) deny SB' % subst, re.MULTILINE)
self.re_Antes = re.compile(r"^%(PLYR)s posts ante (%(CUR)s)?(?P<ANTE>[\.0-9]+)(%(CUR)s)?" % subst, re.MULTILINE)
self.re_BringIn = re.compile(r"^%(PLYR)s brings[- ]in( low|) for (%(CUR)s)?(?P<BRINGIN>[\.0-9]+(%(CUR)s)?)" % subst, re.MULTILINE)
self.re_PostBoth = re.compile('(?P<PNAME>.*): posts small \& big blind \( (%(CUR)s)?(?P<SBBB>[\.0-9]+)(%(CUR)s)?\)' % subst)
self.re_PostDead = re.compile('(?P<PNAME>.*) posts dead blind \((%(CUR)s)?(?P<DEAD>[\.0-9]+)(%(CUR)s)?\)' % subst, re.MULTILINE)
self.re_HeroCards = re.compile('Dealt\sto\s%(PLYR)s\s\[(?P<CARDS>.*)\]' % subst)
self.re_AlternativeSBBB = re.compile(u"%(PLYR)s posts (%(CUR)s)?(?P<SB>[\.0-9]+)(%(CUR)s)?\s%(PLYR2)s posts (%(CUR)s)?(?P<BB>[\.0-9]+)(%(CUR)s)?\s" % subst, re.MULTILINE)

self.re_Action = re.compile('(, )?(?P<PNAME>.*?)(?P<ATYPE> bets| checks| raises| calls| folds)( (%(CUR)s)?(?P<BET>[\d\.]+)(%(CUR)s)?)?( and is all-in)?' % subst)
self.re_ShowdownAction = re.compile('(?P<PNAME>[^\(\)\n]*) (\((small blind|big blind|button)\) )?shows \[(?P<CARDS>.+)\]')
Expand Down Expand Up @@ -317,17 +318,13 @@ def readPlayerStacks(self, hand):
plist[a.group('PNAME')] = [int(a.group('SEAT')), a.group('CASH')]

def markStreets(self, hand):
m = re.search(r"\*\*\* ANTE\/BLINDS \*\*\*(?P<PREFLOP>.+(?=\*\*\* FLOP \*\*\*)|.+)"
m = re.search(r"\*\*\* ANTE\/BLINDS \*\*\*(?P<BLINDSANTES>.+(?=\*\*\* PRE\-FLOP \*\*\*)|.+)"
r"\*\*\* PRE\-FLOP \*\*\*(?P<PREFLOP>.+(?=\*\*\* FLOP \*\*\*)|.+)"
r"(\*\*\* FLOP \*\*\*(?P<FLOP> \[\S\S \S\S \S\S\].+(?=\*\*\* TURN \*\*\*)|.+))?"
r"(\*\*\* TURN \*\*\* \[\S\S \S\S \S\S](?P<TURN>\[\S\S\].+(?=\*\*\* RIVER \*\*\*)|.+))?"
r"(\*\*\* RIVER \*\*\* \[\S\S \S\S \S\S \S\S](?P<RIVER>\[\S\S\].+))?", hand.handText,re.DOTALL)

try:
hand.addStreets(m)
# print "adding street", m.group(0)
# print "---"
except:
log.info(_("Failed to add streets. handtext=%s"))
hand.addStreets(m)

#Needs to return a list in the format
# ['player1name', 'player2name', ...] where player1name is the sb and player2name is bb,
Expand Down Expand Up @@ -355,12 +352,8 @@ def readCommunityCards(self, hand, street): # street has been matched by markStr

def readBlinds(self, hand):
if not self.re_DenySB.search(hand.handText):
try:
m = self.re_PostSB.search(hand.handText)
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
except exceptions.AttributeError: # no small blind
log.warning( _("No small blinds found.")+str(sys.exc_info()) )
#hand.addBlind(None, None, None)
for a in self.re_PostSB.finditer(hand.handText):
hand.addBlind(a.group('PNAME'), 'small blind', a.group('SB'))
for a in self.re_PostBB.finditer(hand.handText):
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
amount = Decimal(a.group('BB').replace(u',', u''))
Expand All @@ -370,6 +363,21 @@ def readBlinds(self, hand):
hand.addBlind(a.group('PNAME'), 'secondsb', a.group('DEAD'))
for a in self.re_PostBoth.finditer(hand.handText):
hand.addBlind(a.group('PNAME'), 'small & big blinds', a.group('SBBB'))
if hand.actions['BLINDSANTES'] == []:
#if no blinds are found, try alternative method: sometimes Winamax writes
# *** ANTE/BLINDS ***
# Jadepoker posts 15
# eveauber posts 30
# instead of :
# *** ANTE/BLINDS ***
# Jadepoker posts small blind 15
# eveauber posts big blind 30
try:
m = self.re_AlternativeSBBB.search(hand.handText)
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
hand.addBlind(m.group('PNAME2'), 'big blind', m.group('BB'))
except:
log.warning( _("Alternate method for finding sb and bb failed.")+str(sys.exc_info()) )

def readAntes(self, hand):
log.debug(_("reading antes"))
Expand Down