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

This commit is contained in:
eblade 2009-03-13 16:07:38 -04:00
commit 2ad252ded6

View File

@ -406,7 +406,7 @@ class HoldemOmahaHand(Hand):
self.totalPot() # finalise it (total the pot) self.totalPot() # finalise it (total the pot)
hhc.getRake(self) hhc.getRake(self)
def addHoleCards(self, cards, player): def addHoleCards(self, cards, player, shown=False):
"""\ """\
Assigns observed holecards to a player. Assigns observed holecards to a player.
cards list of card bigrams e.g. ['2h','Jc'] cards list of card bigrams e.g. ['2h','Jc']
@ -416,6 +416,8 @@ player (string) name of player
try: try:
self.checkPlayerExists(player) self.checkPlayerExists(player)
cardset = set(self.card(c) for c in cards) cardset = set(self.card(c) for c in cards)
if shown and len(cardset) > 0:
self.shown.add(player)
if 'PREFLOP' in self.holecards[player]: if 'PREFLOP' in self.holecards[player]:
self.holecards[player]['PREFLOP'].update(cardset) self.holecards[player]['PREFLOP'].update(cardset)
else: else:
@ -435,7 +437,7 @@ Card ranks will be uppercased
elif holeandboard is not None: elif holeandboard is not None:
holeandboard = set([self.card(c) for c in holeandboard]) holeandboard = set([self.card(c) for c in holeandboard])
board = set([c for s in self.board.values() for c in s]) board = set([c for s in self.board.values() for c in s])
self.addHoleCards(holeandboard.difference(board),player) self.addHoleCards(holeandboard.difference(board),player,shown=True)
def writeHand(self, fh=sys.__stdout__): def writeHand(self, fh=sys.__stdout__):
@ -532,10 +534,13 @@ Card ranks will be uppercased
print >>fh, _("Seat %d: %s showed [%s] and won ($%s)" % (seatnum, name, " ".join(self.holecards[name]['PREFLOP']), self.collectees[name])) print >>fh, _("Seat %d: %s showed [%s] and won ($%s)" % (seatnum, name, " ".join(self.holecards[name]['PREFLOP']), self.collectees[name]))
elif name in self.collectees: elif name in self.collectees:
print >>fh, _("Seat %d: %s collected ($%s)" % (seatnum, name, self.collectees[name])) print >>fh, _("Seat %d: %s collected ($%s)" % (seatnum, name, self.collectees[name]))
elif name in self.shown: #~ elif name in self.shown:
print >>fh, _("Seat %d: %s showed [%s]" % (seatnum, name, " ".join(self.holecards[name]['PREFLOP']))) #~ print >>fh, _("Seat %d: %s showed [%s]" % (seatnum, name, " ".join(self.holecards[name]['PREFLOP'])))
elif name in self.folded: elif name in self.folded:
print >>fh, _("Seat %d: %s folded" % (seatnum, name)) print >>fh, _("Seat %d: %s folded" % (seatnum, name))
else:
if name in self.shown:
print >>fh, _("Seat %d: %s showed [%s] and lost with..." % (seatnum, name, " ".join(self.holecards[name]['PREFLOP'])))
else: else:
print >>fh, _("Seat %d: %s mucked" % (seatnum, name)) print >>fh, _("Seat %d: %s mucked" % (seatnum, name))