From b1217b417f08269bc5a464a4b2f7ba09abb73e1b Mon Sep 17 00:00:00 2001 From: Erki Ferenc Date: Sat, 11 Sep 2010 16:06:46 +0200 Subject: [PATCH 1/2] Added new regression test file A newly joined player has zero stack but having actions --- ...1-0.02-20100807.newPlayerWithZeroStack.txt | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pyfpdb/regression-test-files/cash/PartyPoker/Flop/NLHE-USD-0.01-0.02-20100807.newPlayerWithZeroStack.txt diff --git a/pyfpdb/regression-test-files/cash/PartyPoker/Flop/NLHE-USD-0.01-0.02-20100807.newPlayerWithZeroStack.txt b/pyfpdb/regression-test-files/cash/PartyPoker/Flop/NLHE-USD-0.01-0.02-20100807.newPlayerWithZeroStack.txt new file mode 100644 index 00000000..3e9785bd --- /dev/null +++ b/pyfpdb/regression-test-files/cash/PartyPoker/Flop/NLHE-USD-0.01-0.02-20100807.newPlayerWithZeroStack.txt @@ -0,0 +1,45 @@ +Game #9507514114 starts. + +#Game No : 9507514114 +***** Hand History for Game 9507514114 ***** +$2 USD NL Texas Hold'em - Saturday, August 07, 17:05:05 CEST 2010 +Table Table 178053 (Real Money) +Seat 3 is the button +Total number of players : 9/9 +Seat 9: Player1 ( $1.60 USD ) +Seat 4: Player2 ( $1.98 USD ) +Seat 7: Player3 ( $2.90 USD ) +Seat 3: Player4 ( $1.97 USD ) +Seat 8: Player5 ( $2.43 USD ) +Seat 6: Player6 ( $2 USD ) +Seat 5: Player7 ( $2 USD ) +Seat 2: Player8 ( $0 USD ) +Seat 1: Player9 ( $1.83 USD ) +Player8 has joined the table. +Player2 posts small blind [$0.01 USD]. +Player7 posts big blind [$0.02 USD]. +Player8 posts big blind [$0.02 USD]. +** Dealing down cards ** +Dealt to Player3 [ 7c 6c ] +Player6 calls [$0.02 USD] +Player3 calls [$0.02 USD] +Player5 calls [$0.02 USD] +Player1 folds +Player9 folds +Player8 checks +Player4 folds +Player2 calls [$0.01 USD] +Player7 checks +** Dealing Flop ** [ 5d, 2s, 8h ] +Player2 checks +Player7 bets [$0.09 USD] +Player6 folds +Player3 calls [$0.09 USD] +Player5 folds +Player8 folds +Player2 folds +** Dealing Turn ** [ Kd ] +Player7 bets [$0.21 USD] +Player3 folds +Player7 does not show cards. +Player7 wins $0.50 USD \ No newline at end of file From 5c0bfa3bd0cf0b272856dea4de37791b04f95c0f Mon Sep 17 00:00:00 2001 From: Erki Ferenc Date: Fri, 10 Sep 2010 21:54:10 +0200 Subject: [PATCH 2/2] 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}"