Everleaf update - Holecards read

This commit is contained in:
Worros 2008-11-12 14:12:18 +10:00
parent 21df5900e9
commit 6e182831ac
3 changed files with 70 additions and 39 deletions

View File

@ -22,36 +22,43 @@ from HandHistoryConverter import *
# Everleaf HH format # Everleaf HH format
#Everleaf Gaming Game #55198191 # Everleaf Gaming Game #55208539
#***** Hand history for game #55198191 ***** # ***** Hand history for game #55208539 *****
#Blinds $0.50/$1 NL Hold'em - 2008/09/01 - 10:02:11 # Blinds $0.50/$1 NL Hold'em - 2008/09/01 - 13:35:01
#Table Speed Kuala # Table Speed Kuala
#Seat 8 is the button # Seat 1 is the button
#Total number of players: 10 # Total number of players: 9
#Seat 1: spicybum ( $ 77.50 USD ) # Seat 1: BadBeatBox ( $ 98.97 USD )
#Seat 2: harrydebeng ( new player ) # Seat 3: EricBlade ( $ 73.96 USD )
#Seat 3: EricBlade ( new player ) # Seat 4: randy888 ( $ 196.50 USD )
#Seat 4: dollar_hecht ( $ 16.40 USD ) # Seat 5: BaronSengir ( $ 182.80 USD )
#Seat 5: Apolon76 ( $ 154.10 USD ) # Seat 6: dogge ( $ 186.06 USD )
#Seat 6: dogge ( new player ) # Seat 7: wings ( $ 50 USD )
#Seat 7: RonKoro ( $ 25.53 USD ) # Seat 8: schoffeltje ( $ 282.05 USD )
#Seat 8: jay68w ( $ 48.50 USD ) # Seat 9: harrydebeng ( $ 109.45 USD )
#Seat 9: KillerQueen1 ( $ 51.28 USD ) # Seat 10: smaragdar ( $ 96.50 USD )
#Seat 10: Cheburashka ( $ 49.61 USD ) # EricBlade: posts small blind [$ 0.50 USD]
#KillerQueen1: posts small blind [$ 0.50 USD] # randy888: posts big blind [$ 1 USD]
#Cheburashka: posts big blind [$ 1 USD] # wings: posts big blind [$ 1 USD]
#** Dealing down cards ** # ** Dealing down cards **
#spicybum folds # Dealt to EricBlade [ qc, 3c ]
#dollar_hecht calls [$ 1 USD] # BaronSengir folds
#Apolon76 folds # dogge folds
#RonKoro folds # wings raises [$ 2.50 USD]
#jay68w raises [$ 4.50 USD] # schoffeltje folds
#KillerQueen1 folds # harrydebeng calls [$ 3.50 USD]
#Cheburashka folds # smaragdar raises [$ 15.50 USD]
#dollar_hecht folds # BadBeatBox folds
#jay68w does not show cards # EricBlade folds
#jay68w wins $ 3.50 USD from main pot # randy888 folds
# wings calls [$ 12 USD]
# harrydebeng folds
# ** Dealing Flop ** [ qs, 3d, 8h ]
# wings: bets [$ 34.50 USD]
# smaragdar calls [$ 34.50 USD]
# ** Dealing Turn ** [ 2d ]
# ** Dealing River ** [ 6c ]
# smaragdar wins $ 102 USD from main pot with a pair of aces [ ad, ah, qs, 8h, 6c ]
class Everleaf(HandHistoryConverter): class Everleaf(HandHistoryConverter):
@ -66,6 +73,7 @@ class Everleaf(HandHistoryConverter):
self.rexx.setPlayerInfoRegex('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \( \$ (?P<CASH>[.0-9]+) USD \)') self.rexx.setPlayerInfoRegex('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \( \$ (?P<CASH>[.0-9]+) USD \)')
self.rexx.setPostSbRegex('.*\n(?P<PNAME>.*): posts small blind \[') self.rexx.setPostSbRegex('.*\n(?P<PNAME>.*): posts small blind \[')
self.rexx.setPostBbRegex('.*\n(?P<PNAME>.*): posts big blind \[') self.rexx.setPostBbRegex('.*\n(?P<PNAME>.*): posts big blind \[')
self.rexx.setHeroCardsRegex('.*\nDealt\sto\s(?P<PNAME>.*)\s\[ (?P<HOLECARDS>.*) \]')
self.rexx.compileRegexes() self.rexx.compileRegexes()
def readSupportedGames(self): def readSupportedGames(self):
@ -78,8 +86,6 @@ class Everleaf(HandHistoryConverter):
m = self.rexx.game_info_re.search(self.obs) m = self.rexx.game_info_re.search(self.obs)
gametype = gametype + [m.group('SB')] gametype = gametype + [m.group('SB')]
gametype = gametype + [m.group('BB')] gametype = gametype + [m.group('BB')]
# gametype = gametype + [self.float2int(m.group('SB'))]
# gametype = gametype + [self.float2int(m.group('BB'))]
return gametype return gametype
@ -87,7 +93,7 @@ class Everleaf(HandHistoryConverter):
m = self.rexx.hand_info_re.search(hand.string) m = self.rexx.hand_info_re.search(hand.string)
hand.handid = m.group('HID') hand.handid = m.group('HID')
hand.tablename = m.group('TABLE') hand.tablename = m.group('TABLE')
# These work, but the info is already in the Hand class - should be usecd for tourneys though. # These work, but the info is already in the Hand class - should be used for tourneys though.
# m.group('SB') # m.group('SB')
# m.group('BB') # m.group('BB')
# m.group('GAMETYPE') # m.group('GAMETYPE')
@ -121,6 +127,22 @@ class Everleaf(HandHistoryConverter):
for a in m: for a in m:
hand.posted = hand.posted + [a.group('PNAME')] hand.posted = hand.posted + [a.group('PNAME')]
def readHeroCards(self, hand):
m = self.rexx.hero_cards_re.search(hand.string)
if(m == None):
#Not involved in hand
hand.involved = False
else:
hand.hero = m.group('PNAME')
hand.holecards = m.group('HOLECARDS')
hand.holecards = hand.holecards.replace(',','')
#Must be a better way to do the following tr akqjt AKQJT
hand.holecards = hand.holecards.replace('a','A')
hand.holecards = hand.holecards.replace('k','K')
hand.holecards = hand.holecards.replace('q','Q')
hand.holecards = hand.holecards.replace('j','J')
hand.holecards = hand.holecards.replace('t','T')
def readAction(self): def readAction(self):
pass pass

View File

@ -46,7 +46,7 @@ class FpdbRegex:
self.__UNCALLED_BET_REGEX='^Uncalled bet \(\$([.\d]+)\) returned to (.*)' self.__UNCALLED_BET_REGEX='^Uncalled bet \(\$([.\d]+)\) returned to (.*)'
self.__POT_AND_RAKE_REGEX='^Total\spot\s\$([.\d]+).*\|\sRake\s\$([.\d]+)' self.__POT_AND_RAKE_REGEX='^Total\spot\s\$([.\d]+).*\|\sRake\s\$([.\d]+)'
self.__COLLECT_POT_REGEX='^(.*)\scollected\s\$([.\d]+)\sfrom\s((main|side)\s)?pot' self.__COLLECT_POT_REGEX='^(.*)\scollected\s\$([.\d]+)\sfrom\s((main|side)\s)?pot'
self.__POCKET_CARDS_REGEX='^Dealt\sto\s(.*)\s\[(\S{2})\s(\S{2})\]' self.__HERO_CARDS_REGEX='^Dealt\sto\s(.*)\s\[(\S{2})\s(\S{2})\]'
self.__SHOWN_CARDS_REGEX='^(.*):\sshows\s\[(\S{2})\s(\S{2})\]' self.__SHOWN_CARDS_REGEX='^(.*):\sshows\s\[(\S{2})\s(\S{2})\]'
self.__ACTION_STEP_REGEX='^(.*):\s(bets|checks|raises|calls|folds)((\s\$([.\d]+))?(\sto\s\$([.\d]+))?)?' self.__ACTION_STEP_REGEX='^(.*):\s(bets|checks|raises|calls|folds)((\s\$([.\d]+))?(\sto\s\$([.\d]+))?)?'
@ -74,7 +74,7 @@ class FpdbRegex:
self.summary_re = re.compile(self.__SUMMARY_REGEX) self.summary_re = re.compile(self.__SUMMARY_REGEX)
self.uncalled_bet_re = re.compile(self.__UNCALLED_BET_REGEX) self.uncalled_bet_re = re.compile(self.__UNCALLED_BET_REGEX)
self.collect_pot_re = re.compile(self.__COLLECT_POT_REGEX) self.collect_pot_re = re.compile(self.__COLLECT_POT_REGEX)
self.pocket_cards_re = re.compile(self.__POCKET_CARDS_REGEX) self.hero_cards_re = re.compile(self.__HERO_CARDS_REGEX)
self.cards_shown_re = re.compile(self.__SHOWN_CARDS_REGEX) self.cards_shown_re = re.compile(self.__SHOWN_CARDS_REGEX)
self.summary_cards_re = re.compile(self.__SUMMARY_CARDS_REGEX) self.summary_cards_re = re.compile(self.__SUMMARY_CARDS_REGEX)
self.summary_cards_extra_re = re.compile(self.__SUMMARY_CARDS_EXTRA_REGEX) self.summary_cards_extra_re = re.compile(self.__SUMMARY_CARDS_EXTRA_REGEX)
@ -138,8 +138,8 @@ class FpdbRegex:
def setCollectPotRegex(self, string): def setCollectPotRegex(self, string):
self.__COLLECT_POT_REGEX = string self.__COLLECT_POT_REGEX = string
def setPocketCardsRegex(self, string): def setHeroCardsRegex(self, string):
self.__POCKET_CARDS_REGEX = string self.__HERO_CARDS_REGEX = string
def setShownCardsRegex(self, string): def setShownCardsRegex(self, string):
self.__SHOWN_CARDS_REGEX = string self.__SHOWN_CARDS_REGEX = string

View File

@ -65,7 +65,11 @@ class HandHistoryConverter:
self.readHandInfo(hand) self.readHandInfo(hand)
self.readPlayerStacks(hand) self.readPlayerStacks(hand)
self.readBlinds(hand) self.readBlinds(hand)
self.writeHand("output file", hand) self.readHeroCards(hand)
if(hand.involved == True):
self.writeHand("output file", hand)
else:
pass #Don't write out observed hands
# Functions to be implemented in the inheriting class # Functions to be implemented in the inheriting class
def readSupportedGames(self): abstract def readSupportedGames(self): abstract
@ -87,6 +91,7 @@ class HandHistoryConverter:
# ['player1name', 'player2name', ...] where player1name is the sb and player2name is bb, # ['player1name', 'player2name', ...] where player1name is the sb and player2name is bb,
# addtional players are assumed to post a bb oop # addtional players are assumed to post a bb oop
def readBlinds(self, hand): abstract def readBlinds(self, hand): abstract
def readHeroCards(self, hand): abstract
def readAction(self): abstract def readAction(self): abstract
def sanityCheck(self): def sanityCheck(self):
@ -157,7 +162,7 @@ class HandHistoryConverter:
print "XXXXXXXXX FIXME XXXXXXXX" print "XXXXXXXXX FIXME XXXXXXXX"
print "*** HOLE CARDS ***" print "*** HOLE CARDS ***"
# print "Dealt to " + hero + " [" + holecards + "]" print "Dealt to %s [%s]" %(hand.hero ,hand.holecards)
# #
## ACTION STUFF ## ACTION STUFF
# #
@ -200,6 +205,9 @@ class Hand:
self.seating = [] self.seating = []
self.players = [] self.players = []
self.posted = [] self.posted = []
self.involved = True
self.hero = "Hiro"
self.holecards = "Xx Xx"
self.action = [] self.action = []
def printHand(self): def printHand(self):
@ -217,3 +225,4 @@ class Hand:
print self.players print self.players
print self.posted print self.posted
print self.action print self.action
print self.involved