本文整理汇总了Python中board.Board.pot方法的典型用法代码示例。如果您正苦于以下问题:Python Board.pot方法的具体用法?Python Board.pot怎么用?Python Board.pot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类board.Board
的用法示例。
在下文中一共展示了Board.pot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hand_win_ties
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import pot [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)
示例2: test_hand_win_ties_uneven_split
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import pot [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)
示例3: test_distribute_hand_ties_two
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import pot [as 别名]
def test_distribute_hand_ties_two(self):
p1 = Player('p1',100)
p2 = Player('p2', 100)
p3 = Player('p3', 100)
p4 = Player('p4', 100)
p5 = Player('p5', 100)
p1.bid = 30
p2.bid = 60
p3.bid = 60
p4.bid = 60
p5.bid = 60
p1.hand_value = 12
p2.hand_value = 8.1
p3.hand_value = 8.2
p4.hand_value = 11
p5.hand_value = 12
players = [p1,p2,p3,p4,p5]
test_board = Board(players,10)
test_board.pot = sum([player.bid for player in players])
ranked_players = test_board.sort_player_rankings(players)
test_board.distribute_tie_winnings(ranked_players[0])
self.assertEqual(p2.bid, 0)
self.assertEqual(p3.bid, 0)
self.assertEqual(p4.bid, 0)
self.assertEqual(p1.bid, 0)
self.assertEqual(p5.bid, 0)
self.assertEqual(p1.money, 30+45+100)
self.assertEqual(p5.money, 60+45+90+100)
self.assertEqual(p2.money, 100)
self.assertEqual(p3.money, 100)
self.assertEqual(p4.money, 100)
self.assertEqual(test_board.pot,0)
示例4: test_partial_bids
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import pot [as 别名]
def test_partial_bids(self):
p1 = Player('p1',100)
p2 = Player('p2', 100)
p3 = Player('p3', 100)
p4 = Player('p4', 100)
p5 = Player('p5', 120)
p1.bid = 10
p2.bid = 20
p3.bid = 30
players = [p1,p2,p3,p4,p5]
test_board = Board(players,10)
test_board.pot = 60
test_board.return_partial_bid([p1,p2,p3])
self.assertEqual(p1.bid,0)
self.assertEqual(p2.bid,10)
self.assertEqual(p3.bid,20)
self.assertEqual(test_board.pot,30)
test_board.return_partial_bid([p1,p2,p3])
self.assertEqual(p1.bid,0)
self.assertEqual(p2.bid,0)
self.assertEqual(p3.bid,10)
self.assertEqual(test_board.pot,10)
test_board.return_partial_bid([p1,p2,p3])
self.assertEqual(p1.bid,0)
self.assertEqual(p2.bid,0)
self.assertEqual(p3.bid,0)
self.assertEqual(test_board.pot,0)
示例5: test_hand_win_multiple_winners
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import pot [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)
示例6: test_hand_win
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import pot [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)
示例7: test_hand_win_first_player_not_highest_bid
# 需要导入模块: from board import Board [as 别名]
# 或者: from board.Board import pot [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)