예제 #1
0
    def test_display_val(self):
        print('\n' + '*****' * 20)
        print('Test: Display Value of Cards Dealtto Player\n')
        deck = engine.Deck()
        player_hand = engine.Hand()

        player_hand.add_card(deck.deal())
        player_hand.add_card(deck.deal())
        print("Player Hand\n" + player_hand.display_hand() + '\n')
        print(player_hand.display_value())
예제 #2
0
 def test_handle_ace(self):
     print('\n' + '*****' * 20)
     print('Test: Test Handle Ace Method\n')
     deck = engine.Deck()
     player_hand = engine.Hand()
     player_hand.add_card(deck.deal())
     player_hand.add_card(deck.deal())
     print("Player Hand\n" + player_hand.display_hand() + '\n')
     player_hand.handle_ace()
     self.assertTrue(player_hand.curr_val == 21
                     or player_hand.curr_val == 11)
예제 #3
0
 def test_player_take_cards(self):
     print('\n' + '*****' * 20)
     print('Test: Player Take Cards\n')
     game = engine.Game()
     deck = engine.Deck()
     game.deck = deck
     player_hand = engine.Hand()
     player_hand.add_card(deck.deal())
     card = engine.Card('Spades', 'Six')
     player_hand.add_card(card)
     print("Player Hand\n" + player_hand.display_hand() + '\n')
     game.player_take_cards(player_hand)
예제 #4
0
 def test_rand_player_take_cards(self):
     print('\n' + '*****' * 20)
     print('Test: Player Take Cards\n')
     game = engine.Game()
     deck = engine.Deck()
     game.deck = deck
     deck.shuffle()
     player_hand = engine.Hand()
     player_hand.add_card(deck.deal())
     player_hand.add_card(deck.deal())
     print("Player Hand\n" + player_hand.display_hand() + '\n')
     game.player_take_cards(player_hand)
예제 #5
0
    def test_deal_hands(self):
        print('\n' + '*****' * 20)
        print('Test: Dealing Cards to Player and Dealer\n')
        deck = engine.Deck()
        player_hand = engine.Hand()
        dealer = engine.Hand()

        player_hand.add_card(deck.deal())
        dealer.add_card(deck.deal())
        player_hand.add_card(deck.deal())
        dealer.add_card(deck.deal())
        print('Reveal Hands')
        print("Player Hand\n" + player_hand.display_hand())
        print("Dealer Hand\n" + dealer.display_hand(True))
예제 #6
0
 def test_dealer_take_cards(self):
     print('\n' + '*****' * 20)
     print('Test: Dealer Take Cards\n')
     game = engine.Game()
     deck = engine.Deck()
     game.deck = deck
     deck.shuffle()
     dealer = engine.Hand()
     # for i in range(2):
     dealer.add_card(game.deck.deal())
     dealer.add_card(game.deck.deal())
     print("Dealer Hand\n" + dealer.display_hand() + '\n')
     game.dealer_take_cards(dealer)
     print("Updated Hand\n" + dealer.display_hand() + '\n')
     print(f'Dealer Hand\n{dealer.curr_val}\n')
예제 #7
0
 def test_create_deck(self):
     deck = engine.Deck()
     print(deck)
예제 #8
0
 def test_deal_hand(self):
     deck = engine.Deck()
     hand = engine.Hand()
     hand.add_card(deck.deal())
     print(hand.display_hand())