Exemple #1
0
	def evaluate(self):
		'''Return the payouts, shows, etc.
		'''
		if not self.hand_over:
			raise GameError, "hand is not over yet"

		self.show = []
		# fold to this player
		if len(self.in_players) == 1:
			winner_pos, winner_obj = self.in_players[0]
			tot = self.pot.total
			self.payouts = [[(winner_pos, tot)]]
		else:
			raw_evals = eval_hands(
			[(pos, p.hand) for pos, p in self.in_players], self.community)
			self.payouts = self.pot.payout(raw_evals, self.dealer)
			hand_key = dict((pos, (hand, cards)) for pos, hand, cards, place in raw_evals)

			shot_at_pot = {}
			best_hands = {}
			for amt, players in self.pot.pots:
				best_hands[amt] = ()
				for p in players:
					shot_at_pot.setdefault(p, []).append(amt)
			
			show = []
			for pos, p in self.call_around():
				if self.show_all:
					show.append((pos, hand_key[pos]))
				else:
					show_it = False
					for amt in shot_at_pot[pos]:
						hand_score, cards = hand_key[pos]
						if hand_score > best_hands[amt]:
							show_it = True
							best_hands[amt] = hand_score
					if show_it:
						show.append((pos, hand_key[pos]))
					else:
						show.append((pos, None))
						p.fold()

			self.show = show
Exemple #2
0
def hand_string(pocket, common):
	return get_hand_phrase(eval_hands([["foo", pocket]], common)[0][1])