Merge branch 'master' of git://git.assembla.com/fpdboz.git

This commit is contained in:
Eric Blade 2009-12-22 13:36:52 -05:00
commit 932695b40f
5 changed files with 39 additions and 7 deletions

View File

@ -16,6 +16,25 @@
#agpl-3.0.txt in the docs folder of the package.
# From fpdb_simple
card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8,
"9" : 9, "T" : 10, "J" : 11, "Q" : 12, "K" : 13, "A" : 14}
# FIXME: the following is a workaround until switching to newimport.
# This should be moved into DerivedStats
# I'd also like to change HandsPlayers.startCards to a different datatype
# so we can 'trivially' add different start card classifications
def calcStartCards(hand, player):
if hand.gametype['category'] == 'holdem':
hcs = hand.join_holecards(player, asList=True)
#print "DEBUG: hcs: %s" % hcs
value1 = card_map[hcs[0][0]]
value2 = card_map[hcs[1][0]]
return twoStartCards(value1, hcs[0][1], value2, hcs[1][1])
else:
# FIXME: Only do startCards value for holdem at the moment
return 0
def twoStartCards(value1, suit1, value2, suit2):

View File

@ -47,6 +47,7 @@ class DerivedStats():
self.handsplayers[player[1]]['wonWhenSeenStreet1'] = 0.0
self.handsplayers[player[1]]['sawShowdown'] = False
self.handsplayers[player[1]]['wonAtSD'] = 0.0
self.handsplayers[player[1]]['startCards'] = 0
for i in range(5):
self.handsplayers[player[1]]['street%dCalls' % i] = 0
self.handsplayers[player[1]]['street%dBets' % i] = 0
@ -57,7 +58,6 @@ class DerivedStats():
#FIXME - Everything below this point is incomplete.
self.handsplayers[player[1]]['position'] = 2
self.handsplayers[player[1]]['tourneyTypeId'] = 1
self.handsplayers[player[1]]['startCards'] = 0
self.handsplayers[player[1]]['street0_3BChance'] = False
self.handsplayers[player[1]]['street0_3BDone'] = False
self.handsplayers[player[1]]['stealAttemptChance'] = False
@ -172,7 +172,7 @@ class DerivedStats():
# self.handsplayers[player[1]]['card%s' % i] = Card.encodeCard(card)
for i, card in enumerate(hcs[:7]):
self.handsplayers[player[1]]['card%s' % (i+1)] = Card.encodeCard(card)
self.handsplayers[player[1]]['startCards'] = Card.calcStartCards(hand, player[1])
# position,
#Stud 3rd street card test

View File

@ -89,6 +89,7 @@ class PartyPoker(HandHistoryConverter):
(?P<TTYPE>[a-zA-Z0-9 ]+)\s+
(?: \#|\(|)(?P<TABLE>\d+)\)?\s+
(?:[^ ]+\s+\#(?P<MTTTABLE>\d+).+)? # table number for mtt
(\(No\sDP\)\s)?
\((?P<PLAY>Real|Play)\s+Money\)\s+ # FIXME: check if play money is correct
Seat\s+(?P<BUTTON>\d+)\sis\sthe\sbutton
""",

View File

@ -203,6 +203,8 @@ class PokerStars(HandHistoryConverter):
if key == 'TOURNO':
hand.tourNo = info[key]
if key == 'BUYIN':
#FIXME: The key looks like: '€0.82+€0.18 EUR'
# This should be parsed properly and used
hand.buyin = info[key]
if key == 'LEVEL':
hand.level = info[key]

View File

@ -1,4 +1,5 @@
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
@ -538,6 +539,10 @@ def parseAnteLine(line, isTourney, names, antes):
#returns the buyin of a tourney in cents
def parseBuyin(topline):
pos1 = topline.find("$")+1
if pos1 != 0:
pos2 = topline.find("+")
else:
pos1 = topline.find("")+3
pos2 = topline.find("+")
return float2int(topline[pos1:pos2])
@ -635,9 +640,14 @@ def parseCashesAndSeatNos(lines):
#returns the buyin of a tourney in cents
def parseFee(topline):
pos1=topline.find("$")+1
pos1=topline.find("$",pos1)+1
pos2=topline.find(" ", pos1)
pos1 = topline.find("$")+1
if pos1 != 0:
pos1 = topline.find("$", pos1)+1
pos2 = topline.find(" ", pos1)
else:
pos1 = topline.find("")+3
pos1 = topline.find("", pos1)+3
pos2 = topline.find(" ", pos1)
return float2int(topline[pos1:pos2])
#returns a datetime object with the starttime indicated in the given topline