示例#1
0
文件: PokerGame.py 项目: von/pyPoker
 def _get_action_request(self, hand_state):
     """Generate an ActionRequest for player whom action is currently on"""
     betting_round = hand_state.get_current_betting_round()
     player = betting_round.get_action_player()
     required_to_call = betting_round.required_to_call()
     minimum_bet = self.structure.get_minimum_bet(betting_round)
     if required_to_call == 0:
         if player.bet > 0:
             # If player has money in the pot, it must be a blind so
             # generate an option request
             request = ActionRequest.new_option_request(minimum_bet)
         else:
             # Else, is standard opening bet request
             request = ActionRequest.new_opening_bet_request(minimum_bet)
     else:
         request = ActionRequest.new_call_request(\
             required_to_call,
             raise_amount = required_to_call + minimum_bet)
     return request
示例#2
0
文件: PokerGame.py 项目: von/pyPoker
 def antes(self, hand_state):
     """Handle antes."""
     ante_amount = self.structure.get_ante()
     if ante_amount > 0:
         self.message("Collecting ante of %d" % ante_amount)
         active_players = self.table.get_active_players()
         betting = hand_state.new_betting_round()
         betting.set_action(active_players[0])
         request = ActionRequest.new_ante_request(ante_amount)
         for player in active_players:
             action = player.get_action(request, self, hand_state)
             request.validate_action(action)
             betting.process_action(action)
             self.report_action(player, action)
         betting.sweep_bets_into_pot()