示例#1
0
    def betting_round(self):
        """ Run through a round of betting. Returns a victor if it exists.  """
        # pylint: disable=bad-builtin
        print(self.table)
        br = betting.BettingRound(self)

        _logger.debug('Starting iteration new Betting object.')
        for seat in br:
            if seat == self.find_hero():
                # Get player action
                while True:
                    actions = br.get_options(seat)
                    choice = input('{}?'.format(br.betmenu(actions)))
                    if choice.lower() in actions:
                        action = actions[choice]
                        break
                    else:
                        print('Invalid choice, try again.')
            else:
                # Get cpu decision
                action = br.cpu_decision(seat)

            br.process_option(action)
            act_str = br.action_string(action)
            space = betting.spacing(br.level())

            print(space, act_str)
            _logger.info(act_str)

        print('Pot: ${}'.format(self.pot))
示例#2
0
 def test_spacing_level1_returns2spaces(self):
     expected = '  '
     result = betting.spacing(1)
     self.assertEqual(expected, result)