From bc76d4baf099ce405f3be075ae4dd379cf579049 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 9 Oct 2008 05:04:31 +0100 Subject: [PATCH] p127 - fixed stud importer bugs missing hole cards and added one blackbox hand verification for studhilo. --- pyfpdb/fpdb_parse_logic.py | 4 ++ pyfpdb/fpdb_simple.py | 21 ++++-- regression-test/ps-studhilo-ring-showdown.txt | 67 +++++++++++++++++++ regression-test/ps.15043388146.expected.txt | 43 ++++++++++++ regression-test/regression-test.sh | 26 +++---- 5 files changed, 140 insertions(+), 21 deletions(-) create mode 100644 regression-test/ps-studhilo-ring-showdown.txt create mode 100644 regression-test/ps.15043388146.expected.txt diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py index 8ee8f5b2..c6e9ad9f 100644 --- a/pyfpdb/fpdb_parse_logic.py +++ b/pyfpdb/fpdb_parse_logic.py @@ -86,6 +86,10 @@ def mainParser(db, cursor, site, category, hand): for i in range(len(hand)): if (lineTypes[i]=="cards"): fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits) + #if category=="studhilo": + # print "hand[i]:", hand[i] + # print "cardValues:", cardValues + # print "cardSuits:", cardSuits elif (lineTypes[i]=="action"): fpdb_simple.parseActionLine (site, base, isTourney, hand[i], lineStreets[i], playerIDs, names, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo) elif (lineTypes[i]=="win"): diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index 5d26df28..6187d536 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -730,18 +730,31 @@ def parseCardLine(site, category, street, line, names, cardValues, cardSuits, bo raise FpdbError("read too many/too few holecards in parseCardLine") elif (category=="razz" or category=="studhi" or category=="studhilo"): if (line.find("shows")==-1): - cardValues[playerNo][street-1]=line[pos:pos+1] - cardSuits[playerNo][street-1]=line[pos+1:pos+2] + #print "parseCardLine(in stud if), street:", street + if line[pos+2]=="]": #-> not (hero and 3rd street) + cardValues[playerNo][street+2]=line[pos:pos+1] + cardSuits[playerNo][street+2]=line[pos+1:pos+2] + else: + #print "hero card1:", line[pos:pos+2], "hero card2:", line[pos+3:pos+5], "hero card3:", line[pos+6:pos+8], + cardValues[playerNo][street]=line[pos:pos+1] + cardSuits[playerNo][street]=line[pos+1:pos+2] + cardValues[playerNo][street+1]=line[pos+3:pos+4] + cardSuits[playerNo][street+1]=line[pos+4:pos+5] + cardValues[playerNo][street+2]=line[pos+6:pos+7] + cardSuits[playerNo][street+2]=line[pos+7:pos+8] else: + print "parseCardLine(in stud else), street:", street cardValues[playerNo][0]=line[pos:pos+1] cardSuits[playerNo][0]=line[pos+1:pos+2] pos+=3 cardValues[playerNo][1]=line[pos:pos+1] cardSuits[playerNo][1]=line[pos+1:pos+2] - if street==7: - pos+=15 + if street==4: + pos=pos=line.rfind("]")-2 cardValues[playerNo][6]=line[pos:pos+1] cardSuits[playerNo][6]=line[pos+1:pos+2] + print "cardValues:", cardValues + print "cardSuits:", cardSuits else: print "line:",line,"street:",street raise FpdbError("invalid category") diff --git a/regression-test/ps-studhilo-ring-showdown.txt b/regression-test/ps-studhilo-ring-showdown.txt new file mode 100644 index 00000000..7c69615b --- /dev/null +++ b/regression-test/ps-studhilo-ring-showdown.txt @@ -0,0 +1,67 @@ +PokerStars Game #15043388146: 7 Card Stud Hi/Lo Limit ($0.10/$0.20) - 2008/02/03 - 22:04:15 (ET) +Table 'Lydia' 8-max +Seat 2: olimpicon99 ($5.31 in chips) +Seat 4: PokerPig55 ($1.58 in chips) +Seat 5: VISTA GIRL ($0.83 in chips) +Seat 6: br1an ($5.10 in chips) +Seat 7: steffen780 ($4 in chips) +Seat 8: willowdale ($3.92 in chips) +olimpicon99: posts the ante $0.02 +PokerPig55: posts the ante $0.02 +VISTA GIRL: posts the ante $0.02 +br1an: posts the ante $0.02 +steffen780: posts the ante $0.02 +willowdale: posts the ante $0.02 +*** 3rd STREET *** +Dealt to olimpicon99 [8c] +Dealt to PokerPig55 [Kh] +Dealt to VISTA GIRL [8h] +Dealt to br1an [2d] +Dealt to steffen780 [Kc 9h 9c] +Dealt to willowdale [5s] +br1an: brings in for $0.05 +steffen780: calls $0.05 +willowdale: calls $0.05 +olimpicon99: folds +olimpicon99 leaves the table +PokerPig55: folds +VISTA GIRL: folds +*** 4th STREET *** +Dealt to br1an [2d] [Qh] +Dealt to steffen780 [Kc 9h 9c] [5c] +Dealt to willowdale [5s] [4s] +br1an: checks +steffen780: checks +willowdale: checks +*** 5th STREET *** +Dealt to br1an [2d Qh] [6d] +Dealt to steffen780 [Kc 9h 9c 5c] [8s] +Dealt to willowdale [5s 4s] [Ad] +willowdale: bets $0.20 +br1an: calls $0.20 +steffen780: folds +*** 6th STREET *** +Dealt to br1an [2d Qh 6d] [6h] +Dealt to willowdale [5s 4s Ad] [5h] +br1an: checks +willowdale: checks +*** RIVER *** +br1an: checks +willowdale: bets $0.20 +br1an: calls $0.20 +*** SHOW DOWN *** +willowdale: shows [3s 4d 5s 4s Ad 5h 2c] (HI: a straight, Ace to Five; LO: 5,4,3,2,A) +br1an: shows [4c 7d 2d Qh 6d 6h 2h] (HI: two pair, Sixes and Deuces) +willowdale collected $0.51 from pot +willowdale collected $0.51 from pot +*** SUMMARY *** +Total pot $1.07 | Rake $0.05 +Seat 2: olimpicon99 folded on the 3rd Street (didn't bet) +Seat 4: PokerPig55 folded on the 3rd Street (didn't bet) +Seat 5: VISTA GIRL folded on the 3rd Street (didn't bet) +Seat 6: br1an showed [4c 7d 2d Qh 6d 6h 2h] and lost with HI: two pair, Sixes and Deuces +Seat 7: steffen780 folded on the 5th Street +Seat 8: willowdale showed [3s 4d 5s 4s Ad 5h 2c] and won ($1.02) with HI: a straight, Ace to Five; LO: 5,4,3,2,A + + + diff --git a/regression-test/ps.15043388146.expected.txt b/regression-test/ps.15043388146.expected.txt new file mode 100644 index 00000000..639baa1f --- /dev/null +++ b/regression-test/ps.15043388146.expected.txt @@ -0,0 +1,43 @@ +Connected to MySQL on localhost. Print Hand Utility +options.site: PokerStars siteId: 2 + +From Table Hands +================ +handId: 4 tableName: Lydia siteHandNo: 15043388146 gametypeId: 2 handStart: 2008-02-04 03:04:15 seats: 6 maxSeats: 8 + +From Table Gametypes +==================== +type: ring base: stud category: studhilo limitType: fl hiLo: s + sbet: 10 bbet: 20 + +From Table BoardCards +===================== + +From Table HandsPlayers +======================= +playerName:olimpicon99 playerStartcash:531 ante:2 cards:?? ?? 8c ?? ?? ?? ?? winnings:0 rake:0 +playerName:PokerPig55 playerStartcash:158 ante:2 cards:?? ?? Kh ?? ?? ?? ?? winnings:0 rake:0 +playerName:VISTA GIRL playerStartcash:83 ante:2 cards:?? ?? 8 ?? ?? ?? ??h winnings:0 rake:0 +playerName:br1an playerStartcash:510 ante:2 cards:4c 7d 2d Qh 6d 6h 2h winnings:0 rake:0 +playerName:steffen780 playerStartcash:400 ante:2 cards:Kc 9h 9c 5c 8s ?? ?? winnings:0 rake:0 +playerName:willowdale playerStartcash:392 ante:2 cards:3s 4d 5s 4s Ad 5h 2c winnings:102 rake:5 + +From Table HandsActions +======================= +#playerName:olimpicon99 street:0 streetActionNo:3 action:fold amount:0 +#playerName:PokerPig55 street:0 streetActionNo:4 action:fold amount:0 +#playerName:VISTA GIRL street:0 streetActionNo:5 action:fold amount:0 +#playerName:br1an street:0 streetActionNo:0 action:blind amount:0 +#playerName:br1an street:1 streetActionNo:0 action:check amount:0 +#playerName:br1an street:2 streetActionNo:1 action:call amount:0 +#playerName:br1an street:3 streetActionNo:0 action:check amount:0 +#playerName:br1an street:4 streetActionNo:0 action:check amount:0 +#playerName:br1an street:4 streetActionNo:2 action:call amount:0 +#playerName:steffen780 street:0 streetActionNo:1 action:call amount:0 +#playerName:steffen780 street:1 streetActionNo:1 action:check amount:0 +#playerName:steffen780 street:2 streetActionNo:2 action:fold amount:0 +#playerName:willowdale street:0 streetActionNo:2 action:call amount:0 +#playerName:willowdale street:1 streetActionNo:2 action:check amount:0 +#playerName:willowdale street:2 streetActionNo:0 action:bet amount:0 +#playerName:willowdale street:3 streetActionNo:1 action:check amount:0 +#playerName:willowdale street:4 streetActionNo:1 action:bet amount:0 diff --git a/regression-test/regression-test.sh b/regression-test/regression-test.sh index 5bf93149..1609b8b8 100755 --- a/regression-test/regression-test.sh +++ b/regression-test/regression-test.sh @@ -20,30 +20,22 @@ echo "Please note for this to work you need to work on an empty database, otherw rm *.found.txt ../pyfpdb/fpdb_import.py -p$1 --file=ps-lhe-ring-3hands.txt -x ../pyfpdb/fpdb_import.py -p$1 --file=ps-lhe-ring-3hands.txt -x -#../pyfpdb/fpdb_import.py -p$1 --file=ftp-stud-hilo-ring-001.txt -x -#../pyfpdb/fpdb_import.py -p$1 --file=ftp-omaha-hi-pl-ring-001-005.txt -x +../pyfpdb/fpdb_import.py -p$1 --file=ps-studhilo-ring-showdown.txt -x echo "it should've reported first that it stored 3, then that it had 3 duplicates" -#echo " then 1 stored, then 5 stored" +echo " then 1 stored" -./PrintHand.py -p$1 --hand=14519394979 > ps.14519394979.found.txt && colordiff ps.14519394979.found.txt ps.14519394979.expected.txt -./PrintHand.py -p$1 --hand=14519420999 > ps.14519420999.found.txt && colordiff ps.14519420999.found.txt ps.14519420999.expected.txt -./PrintHand.py -p$1 --hand=14519433154 > ps.14519433154.found.txt && colordiff ps.14519433154.found.txt ps.14519433154.expected.txt +#./PrintHand.py -p$1 --hand=14519394979 > ps.14519394979.found.txt && colordiff ps.14519394979.found.txt ps.14519394979.expected.txt +#./PrintHand.py -p$1 --hand=14519420999 > ps.14519420999.found.txt && colordiff ps.14519420999.found.txt ps.14519420999.expected.txt +#./PrintHand.py -p$1 --hand=14519433154 > ps.14519433154.found.txt && colordiff ps.14519433154.found.txt ps.14519433154.expected.txt +./PrintHand.py -p$1 --hand=15043388146 > ps.15043388146.found.txt && colordiff ps.15043388146.found.txt ps.15043388146.expected.txt -./PrintPlayerHudData.py -p$1 -oM > ps-flags-M-2hands.found.txt && colordiff ps-flags-M-2hands.found.txt ps-flags-M-2hands.expected.txt -./PrintPlayerHudData.py -p$1 -nPlayer_5 -oB > ps-flags-B-1hands.found.txt && colordiff ps-flags-B-1hands.found.txt ps-flags-B-1hands.expected.txt +#./PrintPlayerHudData.py -p$1 -oM > ps-flags-M-2hands.found.txt && colordiff ps-flags-M-2hands.found.txt ps-flags-M-2hands.expected.txt +#./PrintPlayerHudData.py -p$1 -nPlayer_5 -oB > ps-flags-B-1hands.found.txt && colordiff ps-flags-B-1hands.found.txt ps-flags-B-1hands.expected.txt ../pyfpdb/fpdb_import.py -p$1 --file=ps-lhe-ring-call-3B-preflop-cb-no2b.txt -x echo "it should've now reported another successful store of 1 hand" -./PrintPlayerHudData.py -p$1 -nplayer3 -oE -e10 -b25 > ps-flags-CBflop.found.txt && colordiff ps-flags-CBflop.found.txt ps-flags-CBflop.expected.txt - -#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ftp.6367428246.found.txt && colordiff ftp.6367428246.found.txt ftp.6367428246.expected.txt - -#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ftp.6929537410.found.txt && colordiff ftp.6929537410.found.txt ftp.6929537410.expected.txt -#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ftp.6929553738.found.txt && colordiff ftp.6929553738.found.txt ftp.6929553738.expected.txt -#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ftp.6929572212.found.txt && colordiff ftp.6929572212.found.txt ftp.6929572212.expected.txt -#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ftp.6929576743.found.txt && colordiff ftp.6929576743.found.txt ftp.6929576743.expected.txt -#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ftp.6929587483.found.txt && colordiff ftp.6929587483.found.txt ftp.6929587483.expected.txt +#./PrintPlayerHudData.py -p$1 -nplayer3 -oE -e10 -b25 > ps-flags-CBflop.found.txt && colordiff ps-flags-CBflop.found.txt ps-flags-CBflop.expected.txt echo "if everything was printed as expected this worked"