def computer_take_bet(chips: Chips):
    if chips.money >= 100:
        chips.bet = 50
        chips.money -= 50
    elif chips.money >= 50 < 100:
        chips.bet = 25
        chips.money -= 25
    elif chips.money > 10 < 50:
        chips.bet = 5
        chips.money -= 5
    else:
        chips.bet = 1
        chips.money -= 1
Exemplo n.º 2
0
    def test_chips_values(self):
        #Make sure negative value errors are raised
        test_chips = Chips()
        test_chips.bet = -1
        test_chips.total = 100

        self.assertRaises(ValueError, Chips.take_bet, test_chips)
Exemplo n.º 3
0
    def test_chips_types(self):
        #Make sure type errors are raised
        test_chips_values = Chips()
        test_chips_values.bet = 'hey'
        test_chips_values.total = 'waht'

        self.assertRaises(TypeError, Chips.take_bet, test_chips_values)
Exemplo n.º 4
0
def take_bet(chips: Chips) -> None:
    while True:
        try:
            chips.bet = int(input('How many chips would you like to bet? '))
        except:
            print('Sorry, please provide an integer')
        else:
            if chips.bet > chips.total:
                print(
                    f'Sorry, you don\'t have enough chips! You have {chips.total}'
                )
            else:
                break
Exemplo n.º 5
0
def take_bet(chips: Chips):
    while True:
        print(f'Place bet, you have {chips.money} avaliable:')
        try:
            chips.bet = int(input())
        except ValueError:
            print(
                'INVALID INPUT, must be a number... \nyou imbecile muttonhead..'
            )
        else:
            if chips.bet <= 0:
                print(
                    f'INVALID, number must be over zero. \n-???... errr.. no words.. oh wait, ..you moron.'
                )
            elif chips.bet > chips.money:
                print(
                    f'You cannot bet {chips.bet}, when you only have {chips.money} avaliable. \n-did you even graduated kindergarden!! haha, you bonehead'
                )
            else:
                chips.money -= chips.bet
                break