Updated the import process for Draw hands so that cards, along with additional draws can now be stored. HandsPlayers now includes 20 card fields to accomodate up to 4 five card hands for each player. The regex for the 'stands pat' action was also improved so that hero cards from those streets could be taken from that line of text
This commit is contained in:
parent
5eeafc4503
commit
a87f43f933
|
@ -73,7 +73,7 @@ except ImportError:
|
||||||
use_numpy = False
|
use_numpy = False
|
||||||
|
|
||||||
|
|
||||||
DB_VERSION = 151
|
DB_VERSION = 152
|
||||||
|
|
||||||
|
|
||||||
# Variance created as sqlite has a bunch of undefined aggregate functions.
|
# Variance created as sqlite has a bunch of undefined aggregate functions.
|
||||||
|
@ -1915,6 +1915,19 @@ class Database:
|
||||||
pdata[p]['card5'],
|
pdata[p]['card5'],
|
||||||
pdata[p]['card6'],
|
pdata[p]['card6'],
|
||||||
pdata[p]['card7'],
|
pdata[p]['card7'],
|
||||||
|
pdata[p]['card8'],
|
||||||
|
pdata[p]['card9'],
|
||||||
|
pdata[p]['card10'],
|
||||||
|
pdata[p]['card11'],
|
||||||
|
pdata[p]['card12'],
|
||||||
|
pdata[p]['card13'],
|
||||||
|
pdata[p]['card14'],
|
||||||
|
pdata[p]['card15'],
|
||||||
|
pdata[p]['card16'],
|
||||||
|
pdata[p]['card17'],
|
||||||
|
pdata[p]['card18'],
|
||||||
|
pdata[p]['card19'],
|
||||||
|
pdata[p]['card20'],
|
||||||
pdata[p]['winnings'],
|
pdata[p]['winnings'],
|
||||||
pdata[p]['rake'],
|
pdata[p]['rake'],
|
||||||
pdata[p]['totalProfit'],
|
pdata[p]['totalProfit'],
|
||||||
|
|
|
@ -214,10 +214,10 @@ class DerivedStats():
|
||||||
|
|
||||||
for player in hand.players:
|
for player in hand.players:
|
||||||
hcs = hand.join_holecards(player[1], asList=True)
|
hcs = hand.join_holecards(player[1], asList=True)
|
||||||
hcs = hcs + [u'0x', u'0x', u'0x', u'0x', u'0x']
|
hcs = hcs + [u'0x']*18
|
||||||
#for i, card in enumerate(hcs[:7], 1): #Python 2.6 syntax
|
#for i, card in enumerate(hcs[:20, 1): #Python 2.6 syntax
|
||||||
# self.handsplayers[player[1]]['card%s' % i] = Card.encodeCard(card)
|
# self.handsplayers[player[1]]['card%s' % i] = Card.encodeCard(card)
|
||||||
for i, card in enumerate(hcs[:7]):
|
for i, card in enumerate(hcs[:20]):
|
||||||
self.handsplayers[player[1]]['card%s' % (i+1)] = Card.encodeCard(card)
|
self.handsplayers[player[1]]['card%s' % (i+1)] = Card.encodeCard(card)
|
||||||
self.handsplayers[player[1]]['startCards'] = Card.calcStartCards(hand, player[1])
|
self.handsplayers[player[1]]['startCards'] = Card.calcStartCards(hand, player[1])
|
||||||
|
|
||||||
|
|
|
@ -172,10 +172,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
self.re_BringIn = re.compile(r"^%(PLAYERS)s brings in for [%(LS)s]?(?P<BRINGIN>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
self.re_BringIn = re.compile(r"^%(PLAYERS)s brings in for [%(LS)s]?(?P<BRINGIN>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
||||||
self.re_PostBoth = re.compile(r"^%(PLAYERS)s posts small \& big blinds \[[%(LS)s]? (?P<SBBB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
self.re_PostBoth = re.compile(r"^%(PLAYERS)s posts small \& big blinds \[[%(LS)s]? (?P<SBBB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
||||||
self.re_HeroCards = re.compile(r"^Dealt to %s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % player_re, re.MULTILINE)
|
self.re_HeroCards = re.compile(r"^Dealt to %s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % player_re, re.MULTILINE)
|
||||||
self.re_Action = re.compile(r"""
|
self.re_Action = re.compile(r"^%(PLAYERS)s(?P<ATYPE> bets| checks| raises to| completes it to| calls| folds| discards| stands pat)( [%(LS)s]?(?P<BET>[%(NUM)s]+))?(\son|\scards?)?(\s\[(?P<CARDS>.+?)\])?" % self.substitutions, re.MULTILINE)
|
||||||
^%(PLAYERS)s(?P<ATYPE> bets| checks| raises to| completes it to| calls| folds| discards| stands pat)
|
|
||||||
( [%(LS)s]?(?P<BET>[%(NUM)s]+))?
|
|
||||||
(\scards?(\s\[(?P<DISCARDED>.+?)\])?)?""" % self.substitutions, re.MULTILINE)
|
|
||||||
self.re_ShowdownAction = re.compile(r"^%s shows \[(?P<CARDS>.*)\]" % player_re, re.MULTILINE)
|
self.re_ShowdownAction = re.compile(r"^%s shows \[(?P<CARDS>.*)\]" % player_re, re.MULTILINE)
|
||||||
self.re_CollectPot = re.compile(r"^Seat (?P<SEAT>[0-9]+): %(PLAYERS)s (\(button\) |\(small blind\) |\(big blind\) )?(collected|showed \[.*\] and won) \([%(LS)s]?(?P<POT>[%(NUM)s]+)\)(, mucked| with.*)?" % self.substitutions, re.MULTILINE)
|
self.re_CollectPot = re.compile(r"^Seat (?P<SEAT>[0-9]+): %(PLAYERS)s (\(button\) |\(small blind\) |\(big blind\) )?(collected|showed \[.*\] and won) \([%(LS)s]?(?P<POT>[%(NUM)s]+)\)(, mucked| with.*)?" % self.substitutions, re.MULTILINE)
|
||||||
self.re_SitsOut = re.compile(r"^%s sits out" % player_re, re.MULTILINE)
|
self.re_SitsOut = re.compile(r"^%s sits out" % player_re, re.MULTILINE)
|
||||||
|
@ -487,9 +484,9 @@ class Fulltilt(HandHistoryConverter):
|
||||||
elif action.group('ATYPE') == ' checks':
|
elif action.group('ATYPE') == ' checks':
|
||||||
hand.addCheck( street, action.group('PNAME'))
|
hand.addCheck( street, action.group('PNAME'))
|
||||||
elif action.group('ATYPE') == ' discards':
|
elif action.group('ATYPE') == ' discards':
|
||||||
hand.addDiscard(street, action.group('PNAME'), action.group('BET'), action.group('DISCARDED'))
|
hand.addDiscard(street, action.group('PNAME'), action.group('BET'), action.group('CARDS'))
|
||||||
elif action.group('ATYPE') == ' stands pat':
|
elif action.group('ATYPE') == ' stands pat':
|
||||||
hand.addStandsPat( street, action.group('PNAME'))
|
hand.addStandsPat( street, action.group('PNAME'), action.group('CARDS'))
|
||||||
else:
|
else:
|
||||||
print _("FullTilt: DEBUG: unimplemented readAction: '%s' '%s'") %(action.group('PNAME'),action.group('ATYPE'),)
|
print _("FullTilt: DEBUG: unimplemented readAction: '%s' '%s'") %(action.group('PNAME'),action.group('ATYPE'),)
|
||||||
|
|
||||||
|
|
|
@ -661,10 +661,13 @@ Add a raise on [street] by [player] to [amountTo]
|
||||||
self.pot.addMoney(player, amount)
|
self.pot.addMoney(player, amount)
|
||||||
|
|
||||||
|
|
||||||
def addStandsPat(self, street, player):
|
def addStandsPat(self, street, player, cards):
|
||||||
self.checkPlayerExists(player)
|
self.checkPlayerExists(player)
|
||||||
act = (player, 'stands pat')
|
act = (player, 'stands pat')
|
||||||
self.actions[street].append(act)
|
self.actions[street].append(act)
|
||||||
|
if cards:
|
||||||
|
cards = cards.split(' ')
|
||||||
|
self.addHoleCards(street, player, open=[], closed=cards)
|
||||||
|
|
||||||
|
|
||||||
def addFold(self, street, player):
|
def addFold(self, street, player):
|
||||||
|
@ -1224,7 +1227,14 @@ class DrawHand(Hand):
|
||||||
def join_holecards(self, player, asList=False):
|
def join_holecards(self, player, asList=False):
|
||||||
"""With asList = True it returns the set cards for a player including down cards if they aren't know"""
|
"""With asList = True it returns the set cards for a player including down cards if they aren't know"""
|
||||||
# FIXME: This should actually return
|
# FIXME: This should actually return
|
||||||
holecards = [u'0x', u'0x', u'0x', u'0x', u'0x']
|
holecards = [u'0x']*20
|
||||||
|
|
||||||
|
for i, street in enumerate(self.holeStreets):
|
||||||
|
if player in self.holecards[street].keys():
|
||||||
|
allhole = self.holecards[street][player][0] + self.holecards[street][player][1]
|
||||||
|
for c in range(len(allhole)):
|
||||||
|
idx = c + (i*5)
|
||||||
|
holecards[idx] = allhole[c]
|
||||||
|
|
||||||
if asList == False:
|
if asList == False:
|
||||||
return " ".join(holecards)
|
return " ".join(holecards)
|
||||||
|
|
|
@ -145,7 +145,8 @@ class PokerStars(HandHistoryConverter):
|
||||||
(\s(%(CUR)s)?(?P<BET>[.\d]+))?(\sto\s%(CUR)s(?P<BETTO>[.\d]+))? # the number discarded goes in <BET>
|
(\s(%(CUR)s)?(?P<BET>[.\d]+))?(\sto\s%(CUR)s(?P<BETTO>[.\d]+))? # the number discarded goes in <BET>
|
||||||
\s*(and\sis\sall.in)?
|
\s*(and\sis\sall.in)?
|
||||||
(and\shas\sreached\sthe\s[%(CUR)s\d\.]+\scap)?
|
(and\shas\sreached\sthe\s[%(CUR)s\d\.]+\scap)?
|
||||||
(\scards?(\s\[(?P<DISCARDED>.+?)\])?)?\s*$"""
|
(\son|\scards?)?
|
||||||
|
(\s\[(?P<CARDS>.+?)\])?\s*$"""
|
||||||
% short_subst, re.MULTILINE|re.VERBOSE)
|
% short_subst, re.MULTILINE|re.VERBOSE)
|
||||||
re_ShowdownAction = re.compile(r"^%s: shows \[(?P<CARDS>.*)\]" % short_subst['PLYR'], re.MULTILINE)
|
re_ShowdownAction = re.compile(r"^%s: shows \[(?P<CARDS>.*)\]" % short_subst['PLYR'], re.MULTILINE)
|
||||||
re_sitsOut = re.compile("^%s sits out" % short_subst['PLYR'], re.MULTILINE)
|
re_sitsOut = re.compile("^%s sits out" % short_subst['PLYR'], re.MULTILINE)
|
||||||
|
@ -432,9 +433,9 @@ class PokerStars(HandHistoryConverter):
|
||||||
elif action.group('ATYPE') == ' checks':
|
elif action.group('ATYPE') == ' checks':
|
||||||
hand.addCheck( street, action.group('PNAME'))
|
hand.addCheck( street, action.group('PNAME'))
|
||||||
elif action.group('ATYPE') == ' discards':
|
elif action.group('ATYPE') == ' discards':
|
||||||
hand.addDiscard(street, action.group('PNAME'), action.group('BET'), action.group('DISCARDED'))
|
hand.addDiscard(street, action.group('PNAME'), action.group('BET'), action.group('CARDS'))
|
||||||
elif action.group('ATYPE') == ' stands pat':
|
elif action.group('ATYPE') == ' stands pat':
|
||||||
hand.addStandsPat( street, action.group('PNAME'))
|
hand.addStandsPat( street, action.group('PNAME'), action.group('CARDS'))
|
||||||
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')))
|
||||||
|
|
||||||
|
|
|
@ -633,6 +633,19 @@ class Sql:
|
||||||
card5 smallint,
|
card5 smallint,
|
||||||
card6 smallint,
|
card6 smallint,
|
||||||
card7 smallint,
|
card7 smallint,
|
||||||
|
card8 smallint, /* cards 8-20 for draw hands */
|
||||||
|
card9 smallint,
|
||||||
|
card10 smallint,
|
||||||
|
card11 smallint,
|
||||||
|
card12 smallint,
|
||||||
|
card13 smallint,
|
||||||
|
card14 smallint,
|
||||||
|
card15 smallint,
|
||||||
|
card16 smallint,
|
||||||
|
card17 smallint,
|
||||||
|
card18 smallint,
|
||||||
|
card19 smallint,
|
||||||
|
card20 smallint,
|
||||||
startCards smallint,
|
startCards smallint,
|
||||||
|
|
||||||
ante INT,
|
ante INT,
|
||||||
|
@ -760,6 +773,19 @@ class Sql:
|
||||||
card5 smallint,
|
card5 smallint,
|
||||||
card6 smallint,
|
card6 smallint,
|
||||||
card7 smallint,
|
card7 smallint,
|
||||||
|
card8 smallint, /* cards 8-20 for draw hands */
|
||||||
|
card9 smallint,
|
||||||
|
card10 smallint,
|
||||||
|
card11 smallint,
|
||||||
|
card12 smallint,
|
||||||
|
card13 smallint,
|
||||||
|
card14 smallint,
|
||||||
|
card15 smallint,
|
||||||
|
card16 smallint,
|
||||||
|
card17 smallint,
|
||||||
|
card18 smallint,
|
||||||
|
card19 smallint,
|
||||||
|
card20 smallint,
|
||||||
startCards smallint,
|
startCards smallint,
|
||||||
|
|
||||||
ante INT,
|
ante INT,
|
||||||
|
@ -886,6 +912,19 @@ class Sql:
|
||||||
card5 INT,
|
card5 INT,
|
||||||
card6 INT,
|
card6 INT,
|
||||||
card7 INT,
|
card7 INT,
|
||||||
|
card8 INT, /* cards 8-20 for draw hands */
|
||||||
|
card9 INT,
|
||||||
|
card10 INT,
|
||||||
|
card11 INT,
|
||||||
|
card12 INT,
|
||||||
|
card13 INT,
|
||||||
|
card14 INT,
|
||||||
|
card15 INT,
|
||||||
|
card16 INT,
|
||||||
|
card17 INT,
|
||||||
|
card18 INT,
|
||||||
|
card19 INT,
|
||||||
|
card20 INT,
|
||||||
startCards INT,
|
startCards INT,
|
||||||
|
|
||||||
ante INT,
|
ante INT,
|
||||||
|
@ -4799,6 +4838,19 @@ class Sql:
|
||||||
card5,
|
card5,
|
||||||
card6,
|
card6,
|
||||||
card7,
|
card7,
|
||||||
|
card8,
|
||||||
|
card9,
|
||||||
|
card10,
|
||||||
|
card11,
|
||||||
|
card12,
|
||||||
|
card13,
|
||||||
|
card14,
|
||||||
|
card15,
|
||||||
|
card16,
|
||||||
|
card17,
|
||||||
|
card18,
|
||||||
|
card19,
|
||||||
|
card20,
|
||||||
winnings,
|
winnings,
|
||||||
rake,
|
rake,
|
||||||
totalProfit,
|
totalProfit,
|
||||||
|
@ -4913,7 +4965,10 @@ class Sql:
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s
|
%s, %s, %s, %s, %s,
|
||||||
|
%s, %s, %s, %s, %s,
|
||||||
|
%s, %s, %s, %s, %s,
|
||||||
|
%s, %s
|
||||||
)"""
|
)"""
|
||||||
|
|
||||||
self.query['store_hands_actions'] = """insert into HandsActions (
|
self.query['store_hands_actions'] = """insert into HandsActions (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user