From 5c0bfa3bd0cf0b272856dea4de37791b04f95c0f Mon Sep 17 00:00:00 2001 From: Erki Ferenc Date: Fri, 10 Sep 2010 21:54:10 +0200 Subject: [PATCH] PartyPoker fixes - fix the "newly joined unseated active players are taking actions" problem - fix the "newly joined seated active players with zero initial stacks" problem --- pyfpdb/PartyPokerToFpdb.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index ffb41678..b228e391 100755 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -362,6 +362,39 @@ class PartyPoker(HandHistoryConverter): 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 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]) + + def findFirstEmptySeat(startSeat): + while startSeat in occupiedSeats: + if startSeat >= hand.maxseats: + startSeat = 0 + startSeat += 1 + return startSeat + + 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) + + if unseatedActivePlayers: + for player in unseatedActivePlayers: + previousBBPoster = match_BBPostingPlayers[match_BBPostingPlayers.index(player)-1] + previousBBPosterSeat = dict([(f[1], f[0]) for f in hand.players])[previousBBPoster] + occupiedSeats = list([(f[0]) for f in hand.players]) + occupiedSeats.sort() + newPlayerSeat = findFirstEmptySeat(previousBBPosterSeat) + hand.addPlayer(newPlayerSeat,player,clearMoneyString(ringLimit)) + def markStreets(self, hand): m = re.search( r"\*{2} Dealing down cards \*{2}"