本文整理汇总了Python中board.Board.assign_hand_win方法的典型用法代码示例。如果您正苦于以下问题:Python Board.assign_hand_win方法的具体用法?Python Board.assign_hand_win怎么用?Python Board.assign_hand_win使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类board.Board
的用法示例。
在下文中一共展示了Board.assign_hand_win方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hand_win_ties_uneven_split
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import assign_hand_win [as 别名]
def test_hand_win_ties_uneven_split(self):
p1 = Player('p1',100)
p2 = Player('p2', 100)
p3 = Player('p3', 100)
p4 = Player('p4', 100)
p5 = Player('p5', 100)
p1.hand_value = 12
p2.hand_value = 11
p3.hand_value = 12
p4.hand_value = 11
p5.hand_value = 12
players = [p1,p2,p3,p4,p5]
p1.bid = 31
p2.bid = 70
p3.bid = 50
p4.bid = 70
p5.bid = 60
test_board = Board(players, 10)
test_board.pot = sum([player.bid for player in players])
test_board.assign_hand_win(players)
self.assertEqual(test_board.pot, 0)
for player in players:
self.assertEqual(player.bid, 0)
for player in players:
print(player.money,player.name)
self.assertEqual(p1.money, 100+21+31)
self.assertEqual(p3.money, 100+21+19+50)
self.assertEqual(p5.money, 100+20+19+20+60)
示例2: test_hand_win_ties
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import assign_hand_win [as 别名]
def test_hand_win_ties(self):
p1 = Player('p1',100)
p2 = Player('p2', 100)
p3 = Player('p3', 100)
p4 = Player('p4', 100)
p5 = Player('p5', 100)
p1.hand_value = 12
p2.hand_value = 11
p3.hand_value = 12
p4.hand_value = 11
p5.hand_value = 12
players = [p1,p2,p3,p4,p5]
p1.bid = 30
p2.bid = 70
p3.bid = 50
p4.bid = 70
p5.bid = 60
test_board = Board(players, 10)
test_board.pot = sum([player.bid for player in players])
test_board.assign_hand_win(players)
self.assertEqual(test_board.pot, 0)
for player in players:
self.assertEqual(player.bid, 0)
self.assertEqual(p1.money, 100+60/3+30)
self.assertEqual(p5.money, 100+60/3+40/2+20/1+60)
self.assertEqual(p3.money, 100+60/3+40/2+50)
self.assertEqual(p4.money, 100+10)
示例3: test_hand_win_multiple_winners
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import assign_hand_win [as 别名]
def test_hand_win_multiple_winners(self):
p1 = Player('p1',100)
p2 = Player('p2', 100)
p3 = Player('p3', 100)
p4 = Player('p4', 100)
p5 = Player('p5', 120)
p1.hand_value = 10
p2.hand_value = 8.1
p3.hand_value = 8.2
p4.hand_value = 11
p5.hand_value = 12
players = [p1,p2,p3,p4,p5]
p1.bid = 60
p2.bid = 20
p3.bid = 40
p4.bid = 35
p5.bid = 30
test_board = Board(players, 10)
test_board.pot = sum([player.bid for player in players])
test_board.assign_hand_win(players)
self.assertEqual(p5.money, 260)
self.assertEqual(p4.money, 115)
self.assertEqual(p1.money, 130)
self.assertEqual(p3.money, 100)
self.assertEqual(p2.money, 100)
self.assertEqual(test_board.pot, 0)
for player in players:
self.assertEqual(player.bid, 0)
示例4: test_hand_win
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import assign_hand_win [as 别名]
def test_hand_win(self):
p1 = Player('p1',100)
p2 = Player('p2', 100)
p3 = Player('p3', 100)
p4 = Player('p4', 100)
p5 = Player('p5', 100)
p1.hand_value = 10
p2.hand_value = 8.1
p3.hand_value = 8.2
p4.hand_value = 11
p5.hand_value = 12
players = [p1,p2,p3,p4,p5]
for player in players:
player.bid = 10
test_board = Board(players, 10)
test_board.pot = 50
test_board.assign_hand_win(players)
self.assertEqual(p5.money, 150)
self.assertEqual(test_board.pot, 0)
for player in test_board.players:
self.assertEqual(player.bid, 0)
示例5: test_hand_win_first_player_not_highest_bid
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import assign_hand_win [as 别名]
def test_hand_win_first_player_not_highest_bid(self):
p1 = Player('p1',100)
p2 = Player('p2', 100)
p3 = Player('p3', 100)
p4 = Player('p4', 100)
p5 = Player('p5', 100)
p1.hand_value = 10
p2.hand_value = 8.1
p3.hand_value = 8.2
p4.hand_value = 11
p5.hand_value = 12
players = [p1,p2,p3,p4,p5]
for player in players[:4]:
player.bid = 10
p5.bid = 5
for player in players:
player_is_in_hand = True
test_board = Board(players, 10)
test_board.pot = 45
test_board.assign_hand_win(players)
self.assertEqual(p5.money, 125)
self.assertEqual(test_board.pot, 0)
for player in test_board.players:
self.assertEqual(player.bid, 0)
示例6: print_out_board
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import assign_hand_win [as 别名]
board.deduct_blinds()
print_out_board('Blinds are added to pot')
board.deal_cards()
print_out_board("cards are dealt")
board.betting_round()
if enough_players():
print_out_board("Players bet")
board.add_flop()
print(board.players)
if len(board.players) == 2:
board.players = [board.players[1],board.players[0]]
print(board.players)
print_out_board('Flop')
board.betting_round()
print_out_board('Post flop betting results')
if enough_players():
board.add_river()
print_out_board('River')
board.betting_round()
print_out_board('Post river betting results')
if enough_players():
board.add_turn()
print_out_board('Turn')
board.betting_round()
print_out_board('Post turn betting results')
if enough_players():
for player in board.players_in_hand():
player.hand_value, best_hand = hand_evaluator.find_best_hand(player.cards, board.community_cards)
print(player.name,[card.get_properties() for card in best_hand],player.hand_value)
board.assign_hand_win(board.players_in_hand())
print_out_board('Money assigned')