From d2f5633384174fa9964739e0571cc05deff97d10 Mon Sep 17 00:00:00 2001 From: Erki Ferenc Date: Tue, 28 Sep 2010 15:46:51 +0200 Subject: [PATCH 1/2] PartyPoker: improved handling of players with zero or unknown stacks --- pyfpdb/PartyPokerToFpdb.py | 43 ++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index a96308c0..aee095b8 100755 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -348,19 +348,19 @@ class PartyPoker(HandHistoryConverter): def readPlayerStacks(self, hand): log.debug("readPlayerStacks") m = self.re_PlayerInfo.finditer(hand.handText) - players = [] + maxKnownStack = 0 + zeroStackPlayers = [] for a in m: - hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), - clearMoneyString(a.group('CASH'))) - - # detecting new active players without a seat - # and new active players with zero stack + if a.group('CASH') > '0': + #record max known stack for use with players with unknown stack + maxKnownStack = max(a.group('CASH'),maxKnownStack) + hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), clearMoneyString(a.group('CASH'))) + else: + #zero stacked players are added later + zeroStackPlayers.append([int(a.group('SEAT')), a.group('PNAME'), clearMoneyString(a.group('CASH'))]) if hand.gametype['type'] == 'ring': - re_JoiningPlayers = re.compile(r"(?P.*) has joined the table") - re_BBPostingPlayers = re.compile(r"(?P.*) posts big blind") - seatedPlayers = list([(f[1]) for f in hand.players]) - + #finds first vacant seat after an exact seat def findFirstEmptySeat(startSeat): while startSeat in occupiedSeats: if startSeat >= hand.maxseats: @@ -368,14 +368,25 @@ class PartyPoker(HandHistoryConverter): startSeat += 1 return startSeat + re_JoiningPlayers = re.compile(r"(?P.*) has joined the table") + re_BBPostingPlayers = re.compile(r"(?P.*) posts big blind") + match_JoiningPlayers = re_JoiningPlayers.findall(hand.handText) match_BBPostingPlayers = re_BBPostingPlayers.findall(hand.handText) - ringLimit = self.re_GameInfoRing.search(hand.handText).groupdict()['RINGLIMIT'] - unseatedActivePlayers = list(set(match_BBPostingPlayers) - set(seatedPlayers)) - for player in seatedPlayers: - if hand.stacks[player] == 0 and player in match_BBPostingPlayers: - hand.stacks[player] = Decimal(ringLimit) + #add every player with zero stack, but: + #if a zero stacked player is just joined the table in this very hand then set his stack to maxKnownStack + for p in zeroStackPlayers: + if p[1] in match_JoiningPlayers: + p[2] = clearMoneyString(maxKnownStack) + hand.addPlayer(p[0],p[1],p[2]) + + seatedPlayers = list([(f[1]) for f in hand.players]) + + #it works for all known cases as of 2010-09-28 + #should be refined with using match_ActivePlayers instead of match_BBPostingPlayers + #as a leaving and rejoining player could be active without posting a BB (sample HH needed) + unseatedActivePlayers = list(set(match_BBPostingPlayers) - set(seatedPlayers)) if unseatedActivePlayers: for player in unseatedActivePlayers: @@ -384,7 +395,7 @@ class PartyPoker(HandHistoryConverter): occupiedSeats = list([(f[0]) for f in hand.players]) occupiedSeats.sort() newPlayerSeat = findFirstEmptySeat(previousBBPosterSeat) - hand.addPlayer(newPlayerSeat,player,clearMoneyString(ringLimit)) + hand.addPlayer(newPlayerSeat,player,clearMoneyString(maxKnownStack)) def markStreets(self, hand): m = re.search( From bb0bb3c2dd55b65b221e345a66b91515dd9d1c5c Mon Sep 17 00:00:00 2001 From: Erki Ferenc Date: Tue, 28 Sep 2010 15:56:02 +0200 Subject: [PATCH 2/2] l10n: fixed a typo --- pyfpdb/locale/fpdb-hu_HU.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/locale/fpdb-hu_HU.po b/pyfpdb/locale/fpdb-hu_HU.po index 01f6c30b..ecd6c69e 100644 --- a/pyfpdb/locale/fpdb-hu_HU.po +++ b/pyfpdb/locale/fpdb-hu_HU.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.20.905 plus git\n" "POT-Creation-Date: 2010-09-22 20:10+CEST\n" -"PO-Revision-Date: 2010-09-23 11:36+0200\n" +"PO-Revision-Date: 2010-09-28 15:55+0200\n" "Last-Translator: Ferenc Erki \n" "Language-Team: Hungarian \n" "Language: hu\n" @@ -1449,7 +1449,7 @@ msgstr "Sessionök" #: GuiTourneyGraphViewer.py:185 msgid "Tournaments" -msgstr "Verseny3k" +msgstr "Versenyek" #: GuiTourneyGraphViewer.py:212 GuiTourneyGraphViewer.py:225 msgid ""