本文整理汇总了Python中deuces.Card.print_pretty_cards方法的典型用法代码示例。如果您正苦于以下问题:Python Card.print_pretty_cards方法的具体用法?Python Card.print_pretty_cards怎么用?Python Card.print_pretty_cards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类deuces.Card
的用法示例。
在下文中一共展示了Card.print_pretty_cards方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handRank
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
def handRank(self):
scores = []
for i in range(2):
if self.player_list[i].folded == False:
strength = self.evaluator.evaluate(self.table, self.player_list[i].hand)
scores.append([i, strength])
print self.player_list[i].name + ": " + self.evaluator.class_to_string(self.evaluator.get_rank_class(strength))
Card.print_pretty_cards(self.player_list[i].hand)
scores = sorted(scores,key=itemgetter(1))
groups = groupby(scores, itemgetter(1))
result = [[item[0] for item in data] for (key, data) in groups]
for i in result[0]:
print self.player_list[i].name + " wins!"
return result
示例2: rounds
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
def rounds(self, round_num):
if round_num == 1:
print("The Flop")
self.table += self.deck.draw(3)
elif round_num == 2:
print("The Turn")
self.table += [self.deck.draw(1)]
elif round_num == 3:
print("The River")
self.table += [self.deck.draw(1)]
else:
print("Showdown")
Card.print_pretty_cards(self.table)
for i in range(len(self.player_list)):
self.strengths[i].append(self.player_list[i].calc_hand_strength(self))
示例3: pretty
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
def pretty(self):
print 'Front:'
Card.print_pretty_cards(self.front.cards)
print 'Mid:'
Card.print_pretty_cards(self.mid.cards)
print 'Back:'
Card.print_pretty_cards(self.back.cards)
示例4: sorted
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
from __future__ import division
import pickle
from deuces import Card, Evaluator, Deck
test = pickle.load(open("preflop_scores.p", "rb"))
pre_flop = test.copy()
for key in pre_flop:
pre_flop[key] = pre_flop[key][0] / pre_flop[key][1]
results = sorted(pre_flop.items(), key=lambda x: x[1], reverse=True)
for i in range(0, 30):
Card.print_pretty_cards(list(results[i][0]))
print "Winning Percentage: " + str(results[i][1] * 100)
示例5: dealCards
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
def dealCards(self):
for i in range(2):
self.player_list[i].hand = self.deck.draw(2)
print self.player_list[i].name
Card.print_pretty_cards(self.player_list[i].hand)
示例6: Deck
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
# new deck
deck = Deck()
deck.shuffle()
evaluator = Evaluator()
print "\nFirst we deal 2 cards to each team..."
ans3 = raw_input("\nHit <enter> to see the hands: ")
# random board and hands
hand1 = deck.draw(2)
hand2 = deck.draw(2)
hand3 = deck.draw(2)
hand4 = deck.draw(2)
leftovers = deck.draw(44)
# print the hands
_=os.system("clear")
print "%s TEAM has hand " % team1
Card.print_pretty_cards(hand1)
print "\n%s TEAM has hand " % team2
Card.print_pretty_cards(hand2)
print "\n%s TEAM has hand " % team3
Card.print_pretty_cards(hand3)
print "\n%s TEAM has hand " % team4
Card.print_pretty_cards(hand4)
print "\nWow nice hands!"
ans4 = raw_input("\nHit <enter> to continue: ")
_=os.system("clear")
# simulate boards
print "Now let's simulate boards..."
# win/tie counts
wins1 = 0
wins2 = 0
wins3 = 0
示例7: card_allocation_module
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
hand_value = 0
account_value = 0
score = 0
rank = 0
def card_allocation_module(no_of_players):
print "\nReceived input is : ", no_of_Players
return [0]
no_of_Players= raw_input("Enter your input: ");
player=[Player() for i in range(int(no_of_Players))]
for i in range(int(no_of_Players)):
player[i].hand_value=deck.draw(2)
Card.print_pretty_cards(player[i].hand_value)
##for i in range(int(no_of_Players)):
## print "\nplayer[",i,"].hand_value=",player[i].hand_value
## print "player[",i,"].account_value=",player[i].account_value
## print "player[",i,"].score=",player[i].score
card_allocation_module(no_of_Players)
print "\n"
##player[0].hand_value=deck.draw(2)
##player[1].hand_value=deck.draw(2)
Card.print_pretty_cards(board)
##Card.print_pretty_cards(player[0].hand_value)
##Card.print_pretty_cards(player[1].hand_value)
示例8: take_action
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
def take_action(ws, event_name, data):
global MY_SITE
global HAND_CARDS
global BOARD_CARDS
global MINBET
if event_name in ["__game_prepare", "__game_start"]:
pass
elif event_name == "__new_round":
my_site, online_player_number = get_my_site(data)
hand_cards = [player for player in data['players'] if player['playerName'] == name_md5][0]['cards']
HAND_CARDS = [Card.new('{}{}'.format(hand_card[0], str.lower(hand_card[-1]))) for hand_card in hand_cards]
if my_site == 1:
MY_SITE = SB
return
elif my_site == 2:
MY_SITE = BB
return
elif online_player_number >= 8:
if my_site <= 4:
MY_SITE = UTG
return
if online_player_number - my_site >= 2:
MY_SITE = MP
return
if online_player_number - my_site >= 1:
MY_SITE = CO
return
else:
MY_SITE = BTN
return
else:
if my_site <= 3:
MY_SITE = UTG
return
if online_player_number - my_site >= 2:
MY_SITE = MP
return
if online_player_number - my_site >= 1:
MY_SITE = CO
return
else:
MY_SITE = BTN
return
elif event_name == "__bet":
BOARD_CARDS = [Card.new('{}{}'.format(card[0], str.lower(card[-1]))) for card in data['game']['board']]
MINBET = data['self']['minBet']
Card.print_pretty_cards(HAND_CARDS + BOARD_CARDS)
win_prob = poker_deuces.calculate_winning_probability(HAND_CARDS, BOARD_CARDS, len(
[player for player in data['game']['players'] if not player['folded']]), SAMPLE_COUNT)
print('my winning probability: {}%'.format(win_prob * 100))
ws.send(json.dumps({
"eventName": "__action",
"data": {
"action": "bet"
}
}))
elif event_name == "__action":
BOARD_CARDS = [Card.new('{}{}'.format(card[0], str.lower(card[-1]))) for card in data['game']['board']]
MINBET = data['self']['minBet']
Card.print_pretty_cards(HAND_CARDS + BOARD_CARDS)
win_prob = poker_deuces.calculate_winning_probability(HAND_CARDS, BOARD_CARDS, len([player for player in data['game']['players'] if not player['folded']]), SAMPLE_COUNT)
print('my winning probability: {}%'.format(win_prob * 100))
ws.send(json.dumps({
"eventName": "__action",
"data": {
"action": "call"
}
}))
elif event_name == "__show_action":
BOARD_CARDS = [Card.new('{}{}'.format(card[0], str.lower(card[-1]))) for card in data['table']['board']]
# MINBET = data['action']['amount']
win_prob = poker_deuces.calculate_winning_probability(HAND_CARDS, BOARD_CARDS, len(
[player for player in data['players'] if not player['folded']]), SAMPLE_COUNT)
Card.print_pretty_cards(HAND_CARDS + BOARD_CARDS)
print('my winning probability: {}%'.format(win_prob * 100))
elif event_name == "__round_end":
MY_SITE = None
MINBET = None
HAND_CARDS = []
BOARD_CARDS = []
print('Round End')
elif event_name == "__game_over":
print('Game Over')
os._exit(0)
else:
pass
示例9: __str__
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
def __str__ (self):
return Card.print_pretty_cards(self.hand)
示例10: Evaluator
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
from deuces import Card, Evaluator, Deck
# create a card
card = Card.new("Qh")
# create a board and hole cards
board = [Card.new("2h"), Card.new("2s"), Card.new("Jc")]
hand = [Card.new("Qs"), Card.new("Th")]
# pretty print cards to console
Card.print_pretty_cards(board + hand)
# create an evaluator
evaluator = Evaluator()
# and rank your hand
rank = evaluator.evaluate(board, hand)
print "Rank for your hand is: %d" % rank
# or for random cards or games, create a deck
print "Dealing a new hand..."
deck = Deck()
board = deck.draw(5)
player1_hand = deck.draw(2)
player2_hand = deck.draw(2)
print "The board:"
Card.print_pretty_cards(board)
print "Player 1's cards:"
Card.print_pretty_cards(player1_hand)
示例11: dealCards
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import print_pretty_cards [as 别名]
def dealCards(self):
for i in range(0, self.player_num):
self.player_list[i].hand = self.deck.draw(2)
Card.print_pretty_cards(self.player_list[i].hand)