p128 - corrected 2 bugs in PrintHand.py. finished stud blackbox testdata.

This commit is contained in:
steffen123 2008-10-09 05:30:09 +01:00
parent bc76d4baf0
commit 5dfa5061cf
6 changed files with 41 additions and 34 deletions

View File

@ -112,6 +112,7 @@ def mainParser(db, cursor, site, category, hand):
tableResult=fpdb_simple.parseTableLine(site, base, hand[0])
maxSeats=tableResult['maxSeats']
tableName=tableResult['tableName']
#print "before part5, antes:", antes
#part 5: final preparations, then call fpdb_save_to_db.saveHoldem with
# the arrays as they are - that file will fill them.

View File

@ -26,6 +26,7 @@ def ring_stud(cursor, base, category, site_hand_no, gametype_id, hand_start_time
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName, maxSeats)
#print "before calling store_hands_players_stud, antes:", antes
hands_players_ids=fpdb_simple.store_hands_players_stud(cursor, hands_id, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes, seatNos)

View File

@ -579,6 +579,7 @@ def parseActionAmount(line, atype, site, isTourney):
else:
if not isTourney:
pos=line.rfind("$")+1
#print "parseActionAmount, line:", line, "line[pos:]:", line[pos:]
amount=float2int(line[pos:])
else:
#print "line:"+line+"EOL"
@ -676,7 +677,6 @@ def parseActionType(line):
#parses the ante out of the given line and checks which player paid it, updates antes accordingly.
def parseAnteLine(line, site, isTourney, names, antes):
#print "parseAnteLine line: ",line
for i in range(len(names)):
if (line.startswith(names[i].encode("latin-1"))): #found the ante'er
pos=line.rfind("$")+1
@ -690,6 +690,7 @@ def parseAnteLine(line, site, isTourney, names, antes):
pos1=line.rfind("ante")+5
pos2=line.find(" ",pos1)
antes[i]+=int(line[pos1:pos2])
#print "parseAnteLine line: ", line, "antes[i]", antes[i], "antes", antes
#end def parseAntes
#returns the buyin of a tourney in cents
@ -743,7 +744,7 @@ def parseCardLine(site, category, street, line, names, cardValues, cardSuits, bo
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
#print "parseCardLine(in stud else), street:", street
cardValues[playerNo][0]=line[pos:pos+1]
cardSuits[playerNo][0]=line[pos+1:pos+2]
pos+=3
@ -753,8 +754,8 @@ def parseCardLine(site, category, street, line, names, cardValues, cardSuits, bo
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
#print "cardValues:", cardValues
#print "cardSuits:", cardSuits
else:
print "line:",line,"street:",street
raise FpdbError("invalid category")
@ -1280,6 +1281,7 @@ def store_hands_players_stud(cursor, hands_id, player_ids, start_cashes, antes,
card_values, card_suits, winnings, rakes, seatNos):
#stores hands_players rows for stud/razz games. returns an array of the resulting IDs
result=[]
#print "before inserts in store_hands_players_stud, antes:", antes
for i in range (len(player_ids)):
cursor.execute ("""INSERT INTO HandsPlayers
(handId, playerId, startCash, ante,

View File

@ -148,7 +148,7 @@ for i in range (len(handsPlayers)):
else:
printstr+=ful.cards2String(line[5:13])
elif (category=="razz" or category=="studhi" or category=="studhilo"):
printstr+=" ante:"+str(line[3])+" cards:"
printstr+=" ante:"+str(line[4])+" cards:"
printstr+=ful.cards2String(line[5:19])
else:
print "TODO: raise error, print_hand.py"
@ -167,7 +167,7 @@ for i in range (len(handsPlayers)):
line=handsActions[j][2:]
printstr="playerName:"+playerNames[i]
printstr+=" street:"+ful.street_int2String(category, line[0])+" streetActionNo:"+str(line[1])+" action:"+line[2]
printstr+=" amount:"+str(line[3])
printstr+=" amount:"+str(line[4])
print printstr
cursor.close()

View File

@ -3,7 +3,7 @@ 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
handId: 5 tableName: Lydia siteHandNo: 15043388146 gametypeId: 3 handStart: 2008-02-04 03:04:15 seats: 6 maxSeats: 8
From Table Gametypes
====================
@ -17,27 +17,27 @@ 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:VISTA GIRL playerStartcash:83 ante:2 cards:?? ?? 8h ?? ?? ?? ?? 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
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:5
playerName:br1an street:1 streetActionNo:0 action:check amount:0
playerName:br1an street:2 streetActionNo:1 action:call amount:20
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:20
playerName:steffen780 street:0 streetActionNo:1 action:call amount:5
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:5
playerName:willowdale street:1 streetActionNo:2 action:check amount:0
playerName:willowdale street:2 streetActionNo:0 action:bet amount:20
playerName:willowdale street:3 streetActionNo:1 action:check amount:0
playerName:willowdale street:4 streetActionNo:1 action:bet amount:20

View File

@ -20,22 +20,25 @@ 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=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"
#./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
./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
#./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
./PrintPlayerHudData.py -p$1 -nplayer3 -oE -e10 -b25 > ps-flags-CBflop.found.txt && colordiff ps-flags-CBflop.found.txt ps-flags-CBflop.expected.txt
../pyfpdb/fpdb_import.py -p$1 --file=ps-studhilo-ring-showdown.txt -x
echo "it should've now reported another successful store of 1 hand"
./PrintHand.py -p$1 --hand=15043388146 > ps.15043388146.found.txt && colordiff ps.15043388146.found.txt ps.15043388146.expected.txt
echo "if everything was printed as expected this worked"