def test_win_conditions_win_causes_player_win_counter_to_go_up(self): player, player_hand, dealer_hand = self.setup_win_scenario() win_conditions(player, player_hand, dealer_hand) self.assertEqual(player.wins, 1)
def test_win_conditions_lose(self): player, player_hand, dealer_hand = self.setup_lose_scenario() win_conditions(player, player_hand, dealer_hand) self.assertEqual(player.money, Decimal(0.00))
x = deck.deal() player_hand.add_card(x) print("You were dealt a {}.".format(x)) print("Your score is: {}".format(player_hand.score())) # dealer logic print( "The dealer shows his hand and has {}".format( dealer_hand.show_cards())) while((dealer_hand.score() <= 17) and (dealer_hand.score() < player_hand.score()) and (player_hand.score() <= 21)): x = deck.deal() dealer_hand.add_card(x) print("The dealer hits and gets a {}".format(x)) print("His score is {}.".format(dealer_hand.score())) # win/lose conditions win_conditions(player, player_hand, dealer_hand) player.games_played += 1 player.update_percentage() print("") play_another = (input("Are you up for another hand? (y/n)").lower()) # Goodbye message/warning. clearscreen() if player.money <= 0: print("Sorry friend, you've got to have money to rent a seat. Have a nice one.") print( "Thanks for playing! You're leaving the table win percentage of {}%.".format( player.win_percentage))