Win2day: Update to parse NLHE
Hasn't been modified since contribution - used the 'old' set() interface for cards. This interface was dropped after we realised we needed ordering for stud cards
This commit is contained in:
parent
178afa4773
commit
57405e7483
|
@ -100,8 +100,10 @@ class Win2day(HandHistoryConverter):
|
||||||
|
|
||||||
m = self.re_GameInfo.search(handText)
|
m = self.re_GameInfo.search(handText)
|
||||||
if not m:
|
if not m:
|
||||||
print "determineGameType:", handText
|
tmp = handText[0:100]
|
||||||
return None
|
log.error(_("determineGameType: Unable to recognise gametype from: '%s'") % tmp)
|
||||||
|
log.error(_("determineGameType: Raising FpdbParseError"))
|
||||||
|
raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp)
|
||||||
|
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
|
|
||||||
|
@ -194,15 +196,15 @@ class Win2day(HandHistoryConverter):
|
||||||
if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
|
if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
|
||||||
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
|
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
|
||||||
|
|
||||||
boardCards = set([])
|
boardCards = []
|
||||||
if street == 'FLOP':
|
if street == 'FLOP':
|
||||||
m = self.re_Card.findall(hand.streets[street])
|
m = self.re_Card.findall(hand.streets[street])
|
||||||
for card in m:
|
for card in m:
|
||||||
boardCards.add(self.convertWin2dayCards(card))
|
boardCards.append(self.convertWin2dayCards(card))
|
||||||
else:
|
else:
|
||||||
m = self.re_BoardLast.search(hand.streets[street])
|
m = self.re_BoardLast.search(hand.streets[street])
|
||||||
boardCards.add(self.convertWin2dayCards(m.group('CARD')))
|
boardCards.append(self.convertWin2dayCards(m.group('CARD')))
|
||||||
|
|
||||||
hand.setCommunityCards(street, boardCards)
|
hand.setCommunityCards(street, boardCards)
|
||||||
|
|
||||||
def readAntes(self, hand):
|
def readAntes(self, hand):
|
||||||
|
@ -237,7 +239,7 @@ class Win2day(HandHistoryConverter):
|
||||||
for found in m:
|
for found in m:
|
||||||
hand.hero = found.group('PNAME')
|
hand.hero = found.group('PNAME')
|
||||||
for card in self.re_Card.finditer(found.group('CARDS')):
|
for card in self.re_Card.finditer(found.group('CARDS')):
|
||||||
print self.convertWin2dayCards(card.group('CARD'))
|
#print self.convertWin2dayCards(card.group('CARD'))
|
||||||
newcards.append(self.convertWin2dayCards(card.group('CARD')))
|
newcards.append(self.convertWin2dayCards(card.group('CARD')))
|
||||||
|
|
||||||
#hand.addHoleCards(holeCards, m.group('PNAME'))
|
#hand.addHoleCards(holeCards, m.group('PNAME'))
|
||||||
|
@ -279,13 +281,13 @@ class Win2day(HandHistoryConverter):
|
||||||
newcards = player.group('NEWCARDS')
|
newcards = player.group('NEWCARDS')
|
||||||
oldcards = player.group('OLDCARDS')
|
oldcards = player.group('OLDCARDS')
|
||||||
if newcards == None:
|
if newcards == None:
|
||||||
newcards = set()
|
newcards = []
|
||||||
else:
|
else:
|
||||||
newcards = set(newcards.split(' '))
|
newcards = newcards.split(' ')
|
||||||
if oldcards == None:
|
if oldcards == None:
|
||||||
oldcards = set()
|
oldcards = []
|
||||||
else:
|
else:
|
||||||
oldcards = set(oldcards.split(' '))
|
oldcards = oldcards.split(' ')
|
||||||
hand.addDrawHoleCards(newcards, oldcards, player.group('PNAME'), street)
|
hand.addDrawHoleCards(newcards, oldcards, player.group('PNAME'), street)
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,10 +351,10 @@ class Win2day(HandHistoryConverter):
|
||||||
|
|
||||||
def readShowdownActions(self, hand):
|
def readShowdownActions(self, hand):
|
||||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||||
showdownCards = set([])
|
showdownCards = []
|
||||||
for card in self.re_Card.finditer(shows.group('CARDS')):
|
for card in self.re_Card.finditer(shows.group('CARDS')):
|
||||||
#print "DEBUG:", card, card.group('CARD'), self.convertWin2dayCards(card.group('CARD'))
|
#print "DEBUG:", card, card.group('CARD'), self.convertWin2dayCards(card.group('CARD'))
|
||||||
showdownCards.add(self.convertWin2dayCards(card.group('CARD')))
|
showdownCards.append(self.convertWin2dayCards(card.group('CARD')))
|
||||||
|
|
||||||
hand.addShownCards(showdownCards, shows.group('PNAME'))
|
hand.addShownCards(showdownCards, shows.group('PNAME'))
|
||||||
|
|
||||||
|
@ -366,7 +368,7 @@ class Win2day(HandHistoryConverter):
|
||||||
for m in self.re_ShownCards.finditer(hand.handText):
|
for m in self.re_ShownCards.finditer(hand.handText):
|
||||||
if m.group('CARDS') is not None:
|
if m.group('CARDS') is not None:
|
||||||
cards = m.group('CARDS')
|
cards = m.group('CARDS')
|
||||||
cards = set(cards.split(' '))
|
cards = cards.split(' ')
|
||||||
hand.addShownCards(cards=cards, player=m.group('PNAME'))
|
hand.addShownCards(cards=cards, player=m.group('PNAME'))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user