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:
Worros 2010-09-20 14:08:41 +08:00
parent 178afa4773
commit 57405e7483

View File

@ -100,8 +100,10 @@ class Win2day(HandHistoryConverter):
m = self.re_GameInfo.search(handText)
if not m:
print "determineGameType:", handText
return None
tmp = handText[0:100]
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()
@ -194,14 +196,14 @@ class Win2day(HandHistoryConverter):
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)
boardCards = set([])
boardCards = []
if street == 'FLOP':
m = self.re_Card.findall(hand.streets[street])
for card in m:
boardCards.add(self.convertWin2dayCards(card))
boardCards.append(self.convertWin2dayCards(card))
else:
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)
@ -237,7 +239,7 @@ class Win2day(HandHistoryConverter):
for found in m:
hand.hero = found.group('PNAME')
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')))
#hand.addHoleCards(holeCards, m.group('PNAME'))
@ -279,13 +281,13 @@ class Win2day(HandHistoryConverter):
newcards = player.group('NEWCARDS')
oldcards = player.group('OLDCARDS')
if newcards == None:
newcards = set()
newcards = []
else:
newcards = set(newcards.split(' '))
newcards = newcards.split(' ')
if oldcards == None:
oldcards = set()
oldcards = []
else:
oldcards = set(oldcards.split(' '))
oldcards = oldcards.split(' ')
hand.addDrawHoleCards(newcards, oldcards, player.group('PNAME'), street)
@ -349,10 +351,10 @@ class Win2day(HandHistoryConverter):
def readShowdownActions(self, hand):
for shows in self.re_ShowdownAction.finditer(hand.handText):
showdownCards = set([])
showdownCards = []
for card in self.re_Card.finditer(shows.group('CARDS')):
#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'))
@ -366,7 +368,7 @@ class Win2day(HandHistoryConverter):
for m in self.re_ShownCards.finditer(hand.handText):
if m.group('CARDS') is not None:
cards = m.group('CARDS')
cards = set(cards.split(' '))
cards = cards.split(' ')
hand.addShownCards(cards=cards, player=m.group('PNAME'))
if __name__ == "__main__":